当前位置: 首页>>代码示例>>Java>>正文


Java Color.darker方法代码示例

本文整理汇总了Java中java.awt.Color.darker方法的典型用法代码示例。如果您正苦于以下问题:Java Color.darker方法的具体用法?Java Color.darker怎么用?Java Color.darker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Color的用法示例。


在下文中一共展示了Color.darker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deriveEmphColor

import java.awt.Color; //导入方法依赖的package包/类
private static Color deriveEmphColor(Component component) {
    // derive the color for emphasizing from background
    Color backColor = component.getBackground();
    Color emphColor;
    int backBrightness = (30*backColor.getRed()+59*backColor.getGreen()+11*backColor.getBlue())/100;
    if (backBrightness >= 128) {
        emphColor = backColor.darker();
    } else { // brightening a dark area seems visually less notable than darkening a bright area
        emphColor = backColor.brighter().brighter();
    }
    return emphColor;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:GridBagInfoProvider.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XComponentPeer.java

示例3: getColor

import java.awt.Color; //导入方法依赖的package包/类
static Color getColor(int index) {
    Color color;

    if (index >= PREDEFINED_COLORS.length) {
        color = getPredefinedColor(index % PREDEFINED_COLORS.length);
        int darkerFactor = index / PREDEFINED_COLORS.length;
        while (darkerFactor-- > 0) color = color.darker();
    } else {
        color = getPredefinedColor(index);
    }

    return color;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:TimelineColorFactory.java

示例4: 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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:XComponentPeer.java

示例5: drawProcessor

import java.awt.Color; //导入方法依赖的package包/类
private void drawProcessor(Color startC, Color border, boolean gradientFill, Graphics2D g2d) {
	double x = getProcessorXY().x, y = getProcessorXY().y;
	processor.setFrame(x, y, 2 * PROC_RAD, 2 * 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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:15,代码来源:QueueDrawer.java

示例6: 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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:15,代码来源:QueueDrawer.java

示例7: 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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:16,代码来源:QueueDrawer.java

示例8: 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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:15,代码来源:QueueDrawer.java

示例9: 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);
	}
 
开发者ID:max6cn,项目名称:jmt,代码行数:37,代码来源:QueueDrawer.java

示例10: 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();
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:12,代码来源:StatiDrawer.java

示例11: 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);
	}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:38,代码来源:QueueDrawer.java

示例12: 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);

	//		}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:37,代码来源:QueueDrawer.java

示例13: ensureContrastingColor

import java.awt.Color; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:55,代码来源:OutputOptions.java

示例14: 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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:73,代码来源:CoverageBar.java

示例15: getBorderColor

import java.awt.Color; //导入方法依赖的package包/类
private static Color getBorderColor(Color c) {
    return c.darker();
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:4,代码来源:EntityAxisStrip.java


注:本文中的java.awt.Color.darker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。