本文整理汇总了Java中java.awt.Color.LIGHT_GRAY属性的典型用法代码示例。如果您正苦于以下问题:Java Color.LIGHT_GRAY属性的具体用法?Java Color.LIGHT_GRAY怎么用?Java Color.LIGHT_GRAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.LIGHT_GRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
public void paint(Graphics g) {
if (isGtk) {
//Presumably we can get this fixed for JDK 1.5.1
Color c = getBackground();
if (c == null) {
c = UIManager.getColor("control"); //NOI18N
}
if (c == null) {
c = Color.LIGHT_GRAY;
}
Color oldC = g.getColor();
g.setColor(c);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(oldC);
}
super.paint(g);
}
示例2: PackageEditing
public PackageEditing(Component centerIn) {
super();
center = centerIn;
panel = new LPanel();
add(panel);
editing = new LLabel("EDITING", AV.AVFont, AV.green);
editing.addShadow();
editing.setLocation(0, 0);
panel.add(editing);
packageName = new LLabel("Test", AV.AVFontSmall, Color.LIGHT_GRAY);
panel.add(packageName);
variantName = new LLabel("Test", AV.AVFontSmall, Color.LIGHT_GRAY);
variantName.putUnder(packageName, 0, 0);
panel.add(variantName);
setSize(10, variantName.getY() + variantName.getHeight());
}
示例3: print
@Override public int print(Graphics default_graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
if(pageIndex!=0)
return NO_SUCH_PAGE;
pageFormat.setOrientation(PageFormat.LANDSCAPE);
Color foreground = this.foreground, background = this.background, grid = this.grid;
this.foreground = Color.BLACK; this.background = Color.WHITE; this.grid = Color.LIGHT_GRAY;
Graphics2D graphics = (Graphics2D) default_graphics;
graphics.translate(pageFormat.getImageableX(),
pageFormat.getImageableY());
this.paint(graphics);
Thread.yield(); //yield shortly that the graphics are printed properly
this.foreground = foreground; this.background = background; this.grid = grid;
return PAGE_EXISTS;
}
示例4: getColor
private static Color getColor(Level level) {
if (level == Level.SEVERE) {
return Color.RED;
} else if (level == Level.WARNING) {
return Color.ORANGE;
} else
return Color.LIGHT_GRAY;
}
示例5: configureEditedComponent
private void configureEditedComponent(JComponent c) {
if(c == null) return;
if(USE_NEW_ITEM_COLOR_SWITCHING) {
if(c.getForeground() == Color.LIGHT_GRAY) {
c.setForeground(getNormalForeground(c));
}
}
}
示例6: main
/**
*
* @param args
*/
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e1) {
e1.printStackTrace();
}
mxSwingConstants.SHADOW_COLOR = Color.LIGHT_GRAY;
mxConstants.W3C_SHADOWCOLOR = "#D3D3D3";
GraphEditor editor = new GraphEditor();
editor.createFrame(new EditorMenuBar(editor)).setVisible(true);
}
示例7: drawOverflowIndicator
/**
* Draws indicator in case the annotation text overflows on the y axis.
*
* @param anno
* the annotation
* @param g
* the graphics context to draw upon
* @param loc
* the location of the annotation
* @param printing
* if we are currently printing
*/
private void drawOverflowIndicator(final WorkflowAnnotation anno, final Graphics2D g, final Rectangle2D loc,
final boolean printing) {
if (printing) {
// never draw them for printing
return;
}
Graphics2D g2 = (Graphics2D) g.create();
int size = 20;
int xOffset = 10;
int yOffset = 10;
int stepSize = size / 4;
int dotSize = 3;
int x = (int) loc.getMaxX() - size - xOffset;
int y = (int) loc.getMaxY() - size - yOffset;
GradientPaint gp = new GradientPaint(x, y, Color.WHITE, x, y + size * 1.5f, Color.LIGHT_GRAY);
g2.setPaint(gp);
g2.fillRect(x, y, size, size);
g2.setColor(Color.BLACK);
g2.drawRect(x, y, size, size);
g2.fillOval(x + stepSize, y + stepSize * 2, dotSize, dotSize);
g2.fillOval(x + stepSize * 2, y + stepSize * 2, dotSize, dotSize);
g2.fillOval(x + stepSize * 3, y + stepSize * 2, dotSize, dotSize);
g2.dispose();
}
示例8: getColorForValue
public static Color getColorForValue(double value, int alpha, boolean logarithmic, double minValue, double maxValue,
Color minColor, Color maxColor) {
if (Double.isNaN(value)) {
return Color.LIGHT_GRAY;
}
// map value to [0,1]
if (minValue == maxValue) {
value = 0.5;
} else if (logarithmic) {
value = (Math.log(value) - Math.log(minValue)) / (Math.log(maxValue) - Math.log(minValue));
} else {
value = (value - minValue) / (maxValue - minValue);
}
Color MIN_LEGEND_COLOR = minColor;
Color MAX_LEGEND_COLOR = maxColor;
float[] minCol = Color.RGBtoHSB(MIN_LEGEND_COLOR.getRed(), MIN_LEGEND_COLOR.getGreen(), MIN_LEGEND_COLOR.getBlue(),
null);
float[] maxCol = Color.RGBtoHSB(MAX_LEGEND_COLOR.getRed(), MAX_LEGEND_COLOR.getGreen(), MAX_LEGEND_COLOR.getBlue(),
null);
double hColorDiff = maxCol[0] - minCol[0];
double sColorDiff = maxCol[1] - minCol[1];
double bColorDiff = maxCol[2] - minCol[2];
Color color = new Color(Color.HSBtoRGB((float) (minCol[0] + hColorDiff * value), (float) (minCol[1] + value
* sColorDiff), (float) (minCol[2] + value * bColorDiff)));
if (alpha < 255) {
color = DataStructureUtils.setColorAlpha(color, alpha);
}
return color;
}
示例9: drawViewButton
private RoundRectangle2D drawViewButton(double x, double y, Graphics2D g2d, boolean draw, boolean clicked) {
Rectangle2D dvR;
RoundRectangle2D dvRR;
Color tmp;
Color fg = Color.BLACK;
Color bg = Color.LIGHT_GRAY;
if (clicked) {
tmp = fg;
fg = bg;
bg = tmp;
}
if (nCpu > 2) {
fg = Color.DARK_GRAY.brighter().brighter();
bg = Color.LIGHT_GRAY;
}
dvR = drawCenteredText("change view", fg, bg, x, y, g2d, false, false);
dvRR = new RoundRectangle2D.Double(x, y, dvR.getWidth(), dvR.getHeight(), 5.0, 5.0);
if (draw) {
tmp = g2d.getColor();
g2d.setColor(bg);
g2d.fill(dvRR);
g2d.setColor(fg);
g2d.draw(dvRR);
drawCenteredText("change view", fg, bg, x + dvR.getWidth() / 2.0, y + dvR.getHeight() / 2.0, g2d, false, true);
g2d.setColor(tmp);
}
return dvRR;
}
示例10: setColor
public void setColor() {
// Color c = !layerVisible ? Color.LIGHT_GRAY : Color.GRAY;
Color c = Color.LIGHT_GRAY;
this.setBackground(c);
for (Component comp : this.getComponents())
if (!(comp instanceof JButton))
comp.setBackground(c);
}
示例11: getDrawPaint
/**
* @see edu.uci.ics.jung.graph.decorators.EdgePaintFunction#getDrawPaint(edu.uci.ics.jung.graph.Edge)
*/
public Paint getDrawPaint(Edge e) {
if ( mPred == null || mPred.size() == 0) return Color.BLACK;
if( isBlessed( e )) {
return new Color(0.0f, 0.0f, 1.0f, 0.5f);//Color.BLUE;
} else {
return Color.LIGHT_GRAY;
}
}
示例12: setColor
public void setColor() {
Color c = Color.LIGHT_GRAY;
this.setBackground(c);
for (Component comp : this.getComponents())
if (!(comp instanceof JButton))
comp.setBackground(c);
}
示例13: decodeColor
/**
* Decodes a color value. The parameter <code>str</code> is either the
* name of a Java color or a string in the form <code>"#rrggbb"</code>
* or <code>"#aarrggbb"</code>. As a special case, the string
* <code>"none"</code> returns <code>null</code>.
*
* @param str The string representation of the color
* @return The color value
*/
public static Color decodeColor(String str) {
if (str.equalsIgnoreCase("none")) return null;
if (str.equalsIgnoreCase("bg")) return BACKGROUND_FILL;
if (str.equalsIgnoreCase("black")) return Color.BLACK;
if (str.equalsIgnoreCase("blue")) return Color.BLUE;
if (str.equalsIgnoreCase("cyan")) return Color.CYAN;
if (str.equalsIgnoreCase("darkGray")) return Color.DARK_GRAY;
if (str.equalsIgnoreCase("DARK_GRAY")) return Color.DARK_GRAY;
if (str.equalsIgnoreCase("gray")) return Color.GRAY;
if (str.equalsIgnoreCase("green")) return Color.GREEN;
if (str.equalsIgnoreCase("lightGray")) return Color.LIGHT_GRAY;
if (str.equalsIgnoreCase("LIGHT_GRAY")) return Color.LIGHT_GRAY;
if (str.equalsIgnoreCase("magenta")) return Color.MAGENTA;
if (str.equalsIgnoreCase("orange")) return Color.ORANGE;
if (str.equalsIgnoreCase("pink")) return Color.PINK;
if (str.equalsIgnoreCase("red")) return Color.RED;
if (str.equalsIgnoreCase("white")) return Color.WHITE;
if (str.equalsIgnoreCase("yellow")) return Color.YELLOW;
try {
if (str.startsWith("0x")) {
str = str.substring(2);
} else if (str.startsWith("#")) {
str = str.substring(1);
}
int nDigits = str.length();
int aa = 0xFF;
if (nDigits == 8) {
aa = Integer.parseInt(str.substring(0, 2), 16);
str = str.substring(2);
} else if (nDigits != 6) {
throw new RuntimeException("decodeColor: Colors must have " +
"6 or 8 hexadecimal digits");
}
return new Color(Integer.parseInt(str, 16) | (aa << 24), true);
} catch (NumberFormatException ex) {
throw new RuntimeException("decodeColor: Illegal color " + str);
}
}
示例14: drawViewButton
private RoundRectangle2D drawViewButton(double x, double y, Graphics2D g2d, boolean draw, boolean clicked) {
Rectangle2D dvR;
RoundRectangle2D dvRR;
Color tmp;
Color fg = Color.BLACK;
Color bg = Color.LIGHT_GRAY;
if (clicked) {
tmp = fg;
fg = bg;
bg = tmp;
}
if (nCpu > 2) {
fg = Color.darkGray.brighter().brighter();
bg = Color.LIGHT_GRAY;
}
dvR = drawCenteredText("change view", fg, bg, x, y, g2d, false, false);
dvRR = new RoundRectangle2D.Double(x, y, dvR.getWidth(), dvR.getHeight(), 5.0, 5.0);
if (draw) {
tmp = g2d.getColor();
g2d.setColor(bg);
g2d.fill(dvRR);
g2d.setColor(fg);
g2d.draw(dvRR);
drawCenteredText("change view", fg, bg, x + dvR.getWidth() / 2.0, y + dvR.getHeight() / 2.0, g2d, false, true);
g2d.setColor(tmp);
}
return dvRR;
}
示例15: installUI
public void installUI(JComponent c) {
super.installUI(c);
//Fetch the "no properties" string - it's not going to change
//for the life of the session
// noPropsString = NbBundle.getMessage(MarginViewportUI.class,
// "CTL_NoProperties"); //NOI18N
//Set an appropriate font and color. Only really relevant on OS-X to
//keep the font consistent with other NB fonts
Color fg = UIManager.getColor("controlShadow"); //NOI18N
if (fg == null) {
fg = Color.LIGHT_GRAY;
}
c.setForeground(fg);
Color bg = UIManager.getColor("Tree.background"); //NOI18N
if (bg == null) {
bg = Color.WHITE;
}
c.setBackground(bg);
Font f = UIManager.getFont("Tree.font"); //NOI18N
if (f == null) {
f = UIManager.getFont("controlFont"); //NOI18N
}
if (f != null) {
c.setFont(f);
}
c.addContainerListener(this);
Component[] kids = c.getComponents();
for (int i = 0; i < kids.length; i++) {
//Should almost always be empty anyway, if not only one component,
//but for completeness...
kids[i].addComponentListener(this);
}
}