本文整理匯總了Java中java.awt.Color.brighter方法的典型用法代碼示例。如果您正苦於以下問題:Java Color.brighter方法的具體用法?Java Color.brighter怎麽用?Java Color.brighter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Color
的用法示例。
在下文中一共展示了Color.brighter方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawUtilizationMulti
import java.awt.Color; //導入方法依賴的package包/類
private void drawUtilizationMulti(double U, Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
double x = getProcessorXY().x, y = getProcessorXY().y;
try {
occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2 + ELEMS_GAP / 2, y + cpu * (PROC_RAD - ELEMS_GAP) + ELEMS_GAP * cpu * 3
- ELEMS_GAP / 2, PROC_RAD - ELEMS_GAP, (PROC_RAD - ELEMS_GAP) * (1 - U / nCpu));
} catch (Exception e) {
occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2 + ELEMS_GAP / 2, y + cpu * (PROC_RAD - ELEMS_GAP) + ELEMS_GAP * cpu * 3
- ELEMS_GAP / 2, PROC_RAD - ELEMS_GAP, 0);
}
occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2 + ELEMS_GAP / 2, y + cpu * (PROC_RAD - ELEMS_GAP) + ELEMS_GAP * cpu * 3 - ELEMS_GAP / 2,
PROC_RAD - ELEMS_GAP, PROC_RAD - ELEMS_GAP);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
occupiedArea = new Area(occupiedEll);
occupiedArea.subtract(new Area(occupiedRect));
g2d.fill(occupiedArea);
g2d.setPaint(Color.BLACK);
g2d.draw(occupiedArea);
}
示例2: draw3DOval
import java.awt.Color; //導入方法依賴的package包/類
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);
}
示例3: draw3DRect
import java.awt.Color; //導入方法依賴的package包/類
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: drawProcessor2
import java.awt.Color; //導入方法依賴的package包/類
private void drawProcessor2(Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
double x = getProcessorXY().x, y = getProcessorXY().y;
processor.setFrame(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, PROC_RAD, PROC_RAD);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + PROC_RAD * 2), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
g2d.fill(processor);
g2d.setPaint(border);
g2d.draw(processor);
}
示例5: drawPoint
import java.awt.Color; //導入方法依賴的package包/類
private void drawPoint(Color startC, Color border, boolean gradientFill, Graphics2D g2d, int point) {
double x = getProcessorXY().x, y = getProcessorXY().y;
processor.setFrame(x + PROC_RAD, y + PROC_RAD - ELEMS_GAP / 2 + ELEMS_GAP * point, 0.5, 0.5);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + PROC_RAD * 2), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
g2d.fill(processor);
g2d.setPaint(border);
g2d.draw(processor);
}
示例6: drawUtilization
import java.awt.Color; //導入方法依賴的package包/類
private void drawUtilization(double U, Color startC, Color border, boolean gradientFill, Graphics2D g2d) {
double x = getProcessorXY().x, y = getProcessorXY().y;
try {
occupiedRect = new Rectangle2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD * (1 - U));
} catch (Exception e) {
occupiedRect = new Rectangle2D.Double(x, y, 2 * PROC_RAD, 0.0);
}
occupiedEll = new Ellipse2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
occupiedArea = new Area(occupiedEll);
occupiedArea.subtract(new Area(occupiedRect));
g2d.fill(occupiedArea);
g2d.setPaint(Color.BLACK);
g2d.draw(occupiedArea);
// //draw informations about processes
// txtBounds = drawCenteredText("job n.:" + donejobs, Color.BLACK, x +
// PROC_RAD,y + PROC_RAD * 2 + 4 * ELEMS_GAP,g2d, false);
// //draw orizontal line parallel to occupation
//
// //draw box around text
// txtBounds.setFrame(
// x + PROC_RAD - txtBounds.getWidth() / 2,
// y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2,
// txtBounds.getWidth(),
// txtBounds.getHeight());
//
// g2d.draw(txtBounds);
}
示例7: drawUtilization2
import java.awt.Color; //導入方法依賴的package包/類
private void drawUtilization2(double U, Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
double x = getProcessorXY().x, y = getProcessorXY().y;
try {
occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, PROC_RAD
* (1 - U / nCpu));
} catch (Exception e) {
occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 0.0);
}
occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD / 2);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
occupiedArea = new Area(occupiedEll);
occupiedArea.subtract(new Area(occupiedRect));
g2d.fill(occupiedArea);
g2d.setPaint(Color.BLACK);
g2d.draw(occupiedArea);
// //draw informations about processes
// txtBounds = drawCenteredText("job n.:" + donejobs, Color.BLACK, x +
// PROC_RAD,y + PROC_RAD * 2 + 4 * ELEMS_GAP,g2d, false);
// //draw orizontal line parallel to occupation
//
// //draw box around text
// txtBounds.setFrame(
// x + PROC_RAD - txtBounds.getWidth() / 2,
// y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2,
// txtBounds.getWidth(),
// txtBounds.getHeight());
//
// g2d.draw(txtBounds);
}
示例8: drawOccupiedPercentage2
import java.awt.Color; //導入方法依賴的package包/類
private void drawOccupiedPercentage2(Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
//processor.setFrame(x+PROC_RAD/2 , y + cpu*PROC_RAD, 2 * PROC_RAD /2, 2 * PROC_RAD /2);
// if (remainingTime[cpu] != 0) {
double x = getProcessorXY().x, y = getProcessorXY().y;
occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD
* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2);
occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD / 2);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
occupiedArea = new Area(occupiedEll);
occupiedArea.subtract(new Area(occupiedRect));
g2d.fill(occupiedArea);
g2d.setPaint(Color.BLACK);
g2d.draw(occupiedArea);
// draw orizontal line parallel to occupation
Line2D.Double l = new Line2D.Double(x + PROC_RAD * 2 + ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2,//y + PROC_RAD * 2 * (1 - (double) remainingTime / (double) totTime) /2 + ELEMS_GAP * cpu - ELEMS_GAP /2 ,
x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2);//y + PROC_RAD * 2 * (1 - (double) remainingTime / (double) totTime) /2 + ELEMS_GAP * cpu - ELEMS_GAP /2 );
g2d.draw(l);
// draw vertical line
l = new Line2D.Double(x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2, x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2 / 2 + cpu
* PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2);
g2d.draw(l);
// }
}
示例9: setColors
import java.awt.Color; //導入方法依賴的package包/類
public void setColors(Color emptyC, Color queueC, Color probC, Color animC) {
this.emptyC = emptyC;
this.queueC = queueC;
this.probC = probC;
//this.probC = emptyC.darker().darker();
this.queueProbC = probC.brighter().brighter();
this.animBorderC = Color.BLACK;
this.animQueuesC = animC.darker();
this.animProbC = animC.brighter();
this.repaint();
}
示例10: drawProcessorMulti
import java.awt.Color; //導入方法依賴的package包/類
private void drawProcessorMulti(Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
double x = getProcessorXY().x, y = getProcessorXY().y;
processor.setFrame(x + PROC_RAD / 2 + ELEMS_GAP / 2, y + cpu * (PROC_RAD - ELEMS_GAP) + ELEMS_GAP * cpu * 3 - ELEMS_GAP / 2, PROC_RAD
- ELEMS_GAP, PROC_RAD - ELEMS_GAP);
if (gradientFill) {
GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + PROC_RAD * 2), startC.darker(),
false);
g2d.setPaint(gp);
} else {
g2d.setPaint(startC);
}
g2d.fill(processor);
g2d.setPaint(border);
g2d.draw(processor);
}
示例11: getNextColor
import java.awt.Color; //導入方法依賴的package包/類
/**
* 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;
}
示例12: ThinBevelBorder
import java.awt.Color; //導入方法依賴的package包/類
public ThinBevelBorder(int bevelType, Color highlight, Color shadow) {
super(bevelType, highlight.brighter(), highlight, shadow, shadow.brighter());
}
示例13: paintComponent
import java.awt.Color; //導入方法依賴的package包/類
@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);
}
示例14: BevelBorder
import java.awt.Color; //導入方法依賴的package包/類
/**
* 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());
}