Java Code Examples for java.awt.Color#brighter()
The following examples show how to use
java.awt.Color#brighter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Window6Impl.java From petscii-bbs with Mozilla Public License 2.0 | 6 votes |
private void printLines(String lines[]) { Color textColor = getTextColor(); Color textbackColor = getTextBackground(); // This is a feature that is not specified, but it is supported by // DOS Frotz if ((getFont().getStyle() & Font.BOLD) > 0 && !font.isReverseVideo()) { textColor = textColor.brighter(); } for (int i = 0; i < lines.length; i++) { String line = lines[i]; printLine(line, textbackColor, textColor); if (endsWithNewLine(line)) { newline(); } } }
Example 2
Source File: XComponentPeer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void draw3DOval(Graphics g, Color bg, int x, int y, int w, int h, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawArc(x, y, w, h, 45, 180); g.setColor(raised ? shadow : highlight); g.drawArc(x, y, w, h, 225, 180); g.setColor(c); }
Example 3
Source File: XComponentPeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
void draw3DRect(Graphics g, Color bg, int x, int y, int width, int height, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawLine(x, y, x, y + height); g.drawLine(x + 1, y, x + width - 1, y); g.setColor(raised ? shadow : highlight); g.drawLine(x + 1, y + height, x + width, y + height); g.drawLine(x + width, y, x + width, y + height - 1); g.setColor(c); }
Example 4
Source File: XComponentPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
void draw3DRect(Graphics g, Color bg, int x, int y, int width, int height, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawLine(x, y, x, y + height); g.drawLine(x + 1, y, x + width - 1, y); g.setColor(raised ? shadow : highlight); g.drawLine(x + 1, y + height, x + width, y + height); g.drawLine(x + width, y, x + width, y + height - 1); g.setColor(c); }
Example 5
Source File: XComponentPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void draw3DOval(Graphics g, Color bg, int x, int y, int w, int h, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawArc(x, y, w, h, 45, 180); g.setColor(raised ? shadow : highlight); g.drawArc(x, y, w, h, 225, 180); g.setColor(c); }
Example 6
Source File: XComponentPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void draw3DRect(Graphics g, Color bg, int x, int y, int width, int height, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawLine(x, y, x, y + height); g.drawLine(x + 1, y, x + width - 1, y); g.setColor(raised ? shadow : highlight); g.drawLine(x + 1, y + height, x + width, y + height); g.drawLine(x + width, y, x + width, y + height - 1); g.setColor(c); }
Example 7
Source File: XComponentPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
void draw3DOval(Graphics g, Color bg, int x, int y, int w, int h, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawArc(x, y, w, h, 45, 180); g.setColor(raised ? shadow : highlight); g.drawArc(x, y, w, h, 225, 180); g.setColor(c); }
Example 8
Source File: XComponentPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void draw3DRect(Graphics g, Color bg, int x, int y, int width, int height, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawLine(x, y, x, y + height); g.drawLine(x + 1, y, x + width - 1, y); g.setColor(raised ? shadow : highlight); g.drawLine(x + 1, y + height, x + width, y + height); g.drawLine(x + width, y, x + width, y + height - 1); g.setColor(c); }
Example 9
Source File: XComponentPeer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void draw3DOval(Graphics g, Color bg, int x, int y, int w, int h, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawArc(x, y, w, h, 45, 180); g.setColor(raised ? shadow : highlight); g.drawArc(x, y, w, h, 225, 180); g.setColor(c); }
Example 10
Source File: XComponentPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void draw3DRect(Graphics g, Color bg, int x, int y, int width, int height, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawLine(x, y, x, y + height); g.drawLine(x + 1, y, x + width - 1, y); g.setColor(raised ? shadow : highlight); g.drawLine(x + 1, y + height, x + width, y + height); g.drawLine(x + width, y, x + width, y + height - 1); g.setColor(c); }
Example 11
Source File: XComponentPeer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
void draw3DRect(Graphics g, Color bg, int x, int y, int width, int height, boolean raised) { Color c = g.getColor(); Color shadow = bg.darker(); Color highlight = bg.brighter(); g.setColor(raised ? highlight : shadow); g.drawLine(x, y, x, y + height); g.drawLine(x + 1, y, x + width - 1, y); g.setColor(raised ? shadow : highlight); g.drawLine(x + 1, y + height, x + width, y + height); g.drawLine(x + width, y, x + width, y + height - 1); g.setColor(c); }
Example 12
Source File: ResultBar.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected void paintComponent(Graphics g) { if (!(g instanceof Graphics2D)) { return; } int width = getWidth(); int barRectWidth = width; int height = getHeight(); int barRectHeight = height; if (barRectWidth <= 0 || barRectHeight <= 0) { return; } int amountFull = (int) (barRectWidth * passedPercentage / 100.0f); int amountSkip = (int) (barRectWidth * skippedPercentage / 100.0f); int amountAbort = (int) (barRectWidth * abortedPercentage / 100.0f); int amountFail = Math.abs(barRectWidth - amountFull - amountSkip - amountAbort); if(amountFail <= 1) { amountFail = 0; } Color notCoveredLight = NOT_COVERED_LIGHT; Color notCoveredDark = NOT_COVERED_DARK; Color coveredLight = COVERED_LIGHT; Color coveredDark = COVERED_DARK; Color noTestsLight = NO_TESTS_LIGHT; Color noTestsDark = NO_TESTS_DARK; Color abortedTestsLight = ABORTED_TESTS_LIGHT; Color abortedTestsDark = ABORTED_TESTS_DARK; if (emphasize) { coveredDark = coveredDark.darker(); notCoveredDark = notCoveredDark.darker(); noTestsDark = noTestsDark.darker(); abortedTestsDark = abortedTestsDark.darker(); } else if (selected) { coveredLight = coveredLight.brighter(); coveredDark = coveredDark.darker(); notCoveredLight = notCoveredLight.brighter(); notCoveredDark = notCoveredDark.darker(); noTestsLight = noTestsLight.brighter(); noTestsDark = noTestsDark.darker(); abortedTestsLight = abortedTestsLight.brighter(); abortedTestsDark = abortedTestsDark.darker(); } Graphics2D g2 = (Graphics2D) g; // running with no results yet -> gray Color light = noTestsLight; Color dark = noTestsDark; if (abortedReported || skippedReported || passedReported) { // running with at least one result or finished if (passedPercentage == 100.0) { // contains only successful tests -> green light = coveredLight; dark = coveredDark; } else if (abortedPercentage > 0.0) { // contains aborted tests -> abort color light = abortedTestsLight; dark = abortedTestsDark; } else if(100.0f - passedPercentage - abortedPercentage - skippedPercentage > 0.0001) { // contains failed tests -> red light = notCoveredLight; dark = notCoveredDark; } else if (skippedPercentage > 0.0) { // contains ignored tests -> gray light = noTestsLight; dark = noTestsDark; } } g2.setPaint(new GradientPaint(0, phase, light, 0, phase + height / 2, dark, true)); g2.fillRect(1, 1, barRectWidth, height); g2.setFont(getFont()); paintDropShadowText(g2, barRectWidth, barRectHeight); }
Example 13
Source File: OutputOptions.java From netbeans with Apache License 2.0 | 4 votes |
static Color ensureContrastingColor(Color fg, Color bg) { if (bg == null) { if (isNimbus()) { bg = UIManager.getColor("Tree.background"); //NOI18N if (null == bg) { bg = Color.WHITE; } } else { bg = UIManager.getColor("text"); //NOI18N if (bg == null) { bg = Color.WHITE; } } } if (fg == null) { if (isNimbus()) { fg = UIManager.getColor("Tree.foreground"); //NOI18N if (null == fg) { fg = Color.BLACK; } } else { fg = UIManager.getColor("textText"); //NOI18N if (fg == null) { fg = Color.BLACK; } } } if (Color.BLACK.equals(fg) && Color.WHITE.equals(fg)) { return fg; } boolean replace = fg.equals(bg); int dif = 0; if (!replace) { dif = difference(fg, bg); replace = dif < 60; } if (replace) { int lum = luminance(bg); boolean darker = lum >= 128; if (darker) { fg = fg.darker(); } else { fg = fg.brighter(); } } return fg; }
Example 14
Source File: CoverageBar.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected void paintComponent(Graphics g) { if (!(g instanceof Graphics2D)) { return; } int width = getWidth(); int barRectWidth = width; int height = getHeight(); int barRectHeight = height; if (barRectWidth <= 0 || barRectHeight <= 0) { return; } int amountFull = (int) (barRectWidth * coveragePercentage / 100.0f); Graphics2D g2 = (Graphics2D) g; g2.setColor(getBackground()); Color notCoveredLight = NOT_COVERED_LIGHT; Color notCoveredDark = NOT_COVERED_DARK; Color coveredLight = COVERED_LIGHT; Color coveredDark = COVERED_DARK; if (emphasize) { coveredDark = coveredDark.darker(); } else if (selected) { coveredLight = coveredLight.brighter(); coveredDark = coveredDark.darker(); } if (emphasize) { notCoveredDark = notCoveredDark.darker(); } else if (selected) { notCoveredLight = notCoveredLight.brighter(); notCoveredDark = notCoveredDark.darker(); } g2.setPaint(new GradientPaint(0, 0, notCoveredLight, 0, height / 2, notCoveredDark)); g2.fillRect(amountFull, 1, width - 1, height / 2); g2.setPaint(new GradientPaint(0, height / 2, notCoveredDark, 0, 2 * height, notCoveredLight)); g2.fillRect(amountFull, height / 2, width - 1, height / 2); g2.setColor(getForeground()); g2.setPaint(new GradientPaint(0, 0, coveredLight, 0, height / 2, coveredDark)); g2.fillRect(1, 1, amountFull, height / 2); g2.setPaint(new GradientPaint(0, height / 2, coveredDark, 0, 2 * height, coveredLight)); g2.fillRect(1, height / 2, amountFull, height / 2); Rectangle oldClip = g2.getClipBounds(); if (coveragePercentage > 0.0f) { g2.setColor(coveredDark); g2.clipRect(0, 0, amountFull + 1, height); g2.drawRect(0, 0, width - 1, height - 1); } if (coveragePercentage < 100.0f) { g2.setColor(notCoveredDark); g2.setClip(oldClip); g2.clipRect(amountFull, 0, width, height); g2.drawRect(0, 0, width - 1, height - 1); } g2.setClip(oldClip); g2.setFont(getFont()); paintDropShadowText(g2, barRectWidth, barRectHeight); }
Example 15
Source File: DisplayAreaSupport.java From visualvm with GNU General Public License v2.0 | 4 votes |
private ThinBevelBorder(int bevelType, Color highlight, Color shadow) { super(bevelType, highlight.brighter(), highlight, shadow, shadow.brighter()); }
Example 16
Source File: ColorGenerator.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
/** * Gets the next random colour * */ public Color getNextColor(){ ColorSpace usedCS; listToRead = listToRead % 8; if(availableSpacesList[listToRead].isEmpty()){ usedCS = usedSpacesList.removeFirst(); availableSpacesList[listToRead].addLast(new ColorSpace(usedCS.baseR, usedCS.baseG, usedCS.baseB, usedCS.radius/2)); availableSpacesList[listToRead].addLast(new ColorSpace( usedCS.baseR + usedCS.radius/2, usedCS.baseG, usedCS.baseB, usedCS.radius/2)); availableSpacesList[listToRead].addLast(new ColorSpace(usedCS.baseR, usedCS.baseG + usedCS.radius/2, usedCS.baseB, usedCS.radius/2)); availableSpacesList[listToRead].addLast(new ColorSpace( usedCS.baseR + usedCS.radius/2, usedCS.baseG + usedCS.radius/2, usedCS.baseB, usedCS.radius/2)); availableSpacesList[listToRead].addLast(new ColorSpace(usedCS.baseR, usedCS.baseG, usedCS.baseB + usedCS.radius/2, usedCS.radius/2)); availableSpacesList[listToRead].addLast(new ColorSpace( usedCS.baseR + usedCS.radius/2, usedCS.baseG, usedCS.baseB + usedCS.radius/2, usedCS.radius/2)); availableSpacesList[listToRead].addLast(new ColorSpace(usedCS.baseR, usedCS.baseG + usedCS.radius/2, usedCS.baseB + usedCS.radius/2, usedCS.radius/2)); availableSpacesList[listToRead].addLast(new ColorSpace( usedCS.baseR + usedCS.radius/2, usedCS.baseG + usedCS.radius/2, usedCS.baseB + usedCS.radius/2, usedCS.radius/2)); } usedCS = availableSpacesList[listToRead].removeFirst(); Color res = new Color(usedCS.baseR + usedCS.radius/2, usedCS.baseG + usedCS.radius/2, usedCS.baseB + usedCS.radius/2); usedSpacesList.addLast(usedCS); listToRead++; res = res.brighter(); return res; }
Example 17
Source File: BevelBorder.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * Creates a bevel border with the specified type, highlight and * shadow colors. * @param bevelType the type of bevel for the border * @param highlight the color to use for the bevel highlight * @param shadow the color to use for the bevel shadow */ public BevelBorder(int bevelType, Color highlight, Color shadow) { this(bevelType, highlight.brighter(), highlight, shadow, shadow.brighter()); }
Example 18
Source File: BevelBorder.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Creates a bevel border with the specified type, highlight and * shadow colors. * @param bevelType the type of bevel for the border * @param highlight the color to use for the bevel highlight * @param shadow the color to use for the bevel shadow */ public BevelBorder(int bevelType, Color highlight, Color shadow) { this(bevelType, highlight.brighter(), highlight, shadow, shadow.brighter()); }
Example 19
Source File: BevelBorder.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * Creates a bevel border with the specified type, highlight and * shadow colors. * @param bevelType the type of bevel for the border * @param highlight the color to use for the bevel highlight * @param shadow the color to use for the bevel shadow */ public BevelBorder(int bevelType, Color highlight, Color shadow) { this(bevelType, highlight.brighter(), highlight, shadow, shadow.brighter()); }
Example 20
Source File: BevelBorder.java From jdk8u_jdk with GNU General Public License v2.0 | 2 votes |
/** * Creates a bevel border with the specified type, highlight and * shadow colors. * @param bevelType the type of bevel for the border * @param highlight the color to use for the bevel highlight * @param shadow the color to use for the bevel shadow */ public BevelBorder(int bevelType, Color highlight, Color shadow) { this(bevelType, highlight.brighter(), highlight, shadow, shadow.brighter()); }