java.awt.Color#brighter ( )源码实例Demo

下面列出了java.awt.Color#brighter ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: petscii-bbs   文件: Window6Impl.java
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();
    }
  }
}
 
源代码2 项目: dragonwell8_jdk   文件: XComponentPeer.java
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);
}
 
源代码3 项目: jdk8u_jdk   文件: XComponentPeer.java
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);
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: XComponentPeer.java
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);
}
 
源代码5 项目: jdk8u-jdk   文件: XComponentPeer.java
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);
}
 
源代码6 项目: jdk8u_jdk   文件: XComponentPeer.java
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);
}
 
源代码7 项目: openjdk-8   文件: XComponentPeer.java
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);
}
 
源代码8 项目: jdk8u-dev-jdk   文件: XComponentPeer.java
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);
}
 
源代码9 项目: jdk8u-jdk   文件: XComponentPeer.java
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);
}
 
源代码10 项目: openjdk-jdk8u   文件: XComponentPeer.java
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);
}
 
源代码11 项目: openjdk-8-source   文件: XComponentPeer.java
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);
}
 
源代码12 项目: netbeans   文件: ResultBar.java
@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);
   }
 
源代码13 项目: gate-core   文件: ColorGenerator.java
/**
 * 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;
}
 
源代码14 项目: visualvm   文件: DisplayAreaSupport.java
private ThinBevelBorder(int bevelType, Color highlight, Color shadow) {
    super(bevelType, highlight.brighter(), highlight, shadow, shadow.brighter());
}
 
源代码15 项目: netbeans   文件: CoverageBar.java
@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);
}
 
源代码16 项目: netbeans   文件: OutputOptions.java
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;
}
 
源代码17 项目: openjdk-jdk9   文件: BevelBorder.java
/**
 * 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());
}
 
源代码18 项目: jdk8u_jdk   文件: BevelBorder.java
/**
 * 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());
}
 
源代码19 项目: jdk8u-jdk   文件: BevelBorder.java
/**
 * 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());
}
 
源代码20 项目: jdk8u60   文件: BevelBorder.java
/**
 * 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());
}