本文整理汇总了Java中java.awt.Color.GRAY属性的典型用法代码示例。如果您正苦于以下问题:Java Color.GRAY属性的具体用法?Java Color.GRAY怎么用?Java Color.GRAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.GRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pdfBuildPrefGroupLabel
protected PdfPCell pdfBuildPrefGroupLabel(CourseOffering co, PreferenceGroup prefGroup, String indentSpaces, boolean isEditable, String prevLabel) {
if (prefGroup instanceof Class_) {
Color color = (isEditable?Color.BLACK:Color.GRAY);
String label = prefGroup.toString();
Class_ aClass = (Class_) prefGroup;
label = aClass.getClassLabel(co);
if (prevLabel != null && label.equals(prevLabel)){
label = "";
}
PdfPCell cell = createCell();
addText(cell, indentSpaces+label, co.isIsControl(), false, Element.ALIGN_LEFT, color, true);
InstructionalMethod im = aClass.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalMethod();
if (im != null)
addText(cell, " (" + im.getReference() + ")", false, false, Element.ALIGN_LEFT, color, false);
return cell;
} else return super.pdfBuildPrefGroupLabel(co, prefGroup, indentSpaces, isEditable, null);
}
示例2: 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);
}
}
示例3: sync
public void sync() {
ExactModel data = ew.getData();
synchronized (data) {
classes = data.getClasses();
classNames = ArrayUtils.copy(data.getClassNames());
stationNames = ArrayUtils.copy(data.getStationNames());
stationNames = ArrayUtils.resize(stationNames, stationNames.length+1, null);
stationNames[stationNames.length-1] = "Arrival Process";
visits = ArrayUtils.copy2(data.getVisits());
// To set the Gray color for the Arrival Process (just for the UI)
colors = ArrayUtils.resize(colors, stationNames.length);
for (int i=0 ; i< stationNames.length; i++)
{
if (stationNames[i].equals("Arrival Process"))
{
colors[i] = Color.GRAY;
}
else
{
colors[i] = null;
}
}
ReferenceStation = ArrayUtils.copy(data.getReferenceStation());
classTypes = ArrayUtils.copy(data.getClassTypes());
}
for (int i=0;i<classes;i++) //if the class is open there is no RefStation
{
if (classTypes[i] == 1)
ReferenceStation[i] = stationNames.length-1;
else if (classTypes[i] == 0 && ReferenceStation[i] == stationNames.length-1)
ReferenceStation[i] = 0;
}
}
示例4: getColor
private Color getColor(TestStep step) {
if (step.isCommented()) {
return Color.GRAY;
} else if (step.hasBreakPoint()) {
return Color.BLUE;
}
return Color.BLACK;
}
示例5: getMissionChip
/**
* Gets the mission chip for a native settlement.
*
* @param g Graphics2D for getting the FontMetrics.
* @param owner The player that owns the mission.
* @param expert True if the unit is an expert.
* @return A suitable chip, or null if no mission is present.
*/
public BufferedImage getMissionChip(Graphics2D g,
Player owner, boolean expert) {
Color background = owner.getNationColor();
String key = "color.foreground.mission."
+ ((expert) ? "expert" : "normal");
Color foreground;
if (ResourceManager.hasColorResource(key)) {
foreground = ResourceManager.getColor(key);
} else {
foreground = (expert) ? Color.BLACK : Color.GRAY;
}
return createChip(g, ResourceManager.getString("cross"),
Color.BLACK, background, foreground);
}
示例6: MyDemoPane
public MyDemoPane() {
XYDataset dataset = createDataset();
JFreeChart chart = createChart(dataset);
this.chartViewer = new ChartViewer(chart);
this.chartViewer.addChartMouseListener(this);
getChildren().add(this.chartViewer);
CrosshairOverlayFX crosshairOverlay = new CrosshairOverlayFX();
this.xCrosshair = new Crosshair(Double.NaN, Color.GRAY,
new BasicStroke(0f));
this.xCrosshair.setStroke(new BasicStroke(1.5f,
BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1,
new float[]{2.0f, 2.0f}, 0));
this.xCrosshair.setLabelVisible(true);
this.yCrosshair = new Crosshair(Double.NaN, Color.GRAY,
new BasicStroke(0f));
this.yCrosshair.setStroke(new BasicStroke(1.5f,
BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1,
new float[] {2.0f, 2.0f}, 0));
this.yCrosshair.setLabelVisible(true);
crosshairOverlay.addDomainCrosshair(xCrosshair);
crosshairOverlay.addRangeCrosshair(yCrosshair);
Platform.runLater(() -> {
this.chartViewer.getCanvas().addOverlay(crosshairOverlay);
});
}
示例7: getPopupBorderColor
public static Color getPopupBorderColor() {
Color shadow = UIManager.getColor("controlShadow"); //NOI18N
return shadow != null ? shadow : Color.GRAY;
}
示例8: makeColor
private static void makeColor() {
/* Primi 9 Colori */
list[0] = Color.RED;
name[0] = "ROSSO";
list[1] = Color.BLUE;
name[1] = "BLU";
list[2] = Color.MAGENTA;
name[2] = "MAGENTA";
list[3] = Color.GREEN;
name[3] = "VERDE";
list[4] = Color.BLACK;
name[4] = "NERO";
list[5] = Color.YELLOW;
name[5] = "GIALLO";
list[6] = Color.PINK;
name[6] = "ROSA";
list[7] = Color.CYAN;
name[7] = "AZZURRO";
list[8] = Color.ORANGE;
name[8] = "ARANCIONE";
list[9] = Color.GRAY;
name[9] = "GRIGIO";
list[10] = new Color(155, 0, 0);
name[10] = "ROSSO SCURO";
list[11] = new Color(94, 0, 2);
name[11] = "MARRONE";
list[12] = new Color(242, 129, 252);
name[12] = "VIOLA CHIARO";
list[13] = new Color(129, 69, 135);
name[13] = "VIOLA SCURO";
list[14] = new Color(141, 141, 254);
name[14] = "BLU CHIARO";
list[15] = new Color(1, 1, 109);
name[15] = "BLU SCURO";
list[16] = new Color(3, 124, 146);
name[16] = "AZZURRO SCURO";
list[17] = new Color(83, 172, 105);
name[17] = "VERDINO";
list[18] = new Color(33, 116, 35);
name[18] = "VERDE SCURO";
list[19] = new Color(128, 206, 49);
name[19] = "VERDACCIO";
list[20] = new Color(170, 162, 55);
name[20] = "ORO";
list[21] = new Color(191, 156, 34);
name[21] = "OCRA";
list[22] = new Color(255, 0, 128);
name[22] = "ROSACCIO";
list[23] = new Color(198, 50, 50);
name[23] = "ROSSO N�2";
list[24] = new Color(99, 55, 137);
name[24] = "VIOLA SCURO N�2";
list[25] = new Color(99, 55, 137).brighter();
name[25] = "ROSSO N�3";
list[26] = new Color(129, 69, 135).brighter();
name[26] = "VIOLA SCURO N�2";
list[27] = new Color(141, 141, 254).darker();
name[27] = "BLU CHIARO N�2";
list[28] = new Color(1, 1, 109).brighter().brighter();
name[28] = "BLU SCURO N�2";
list[29] = new Color(3, 124, 146).brighter();
name[29] = "AZZURRO SCURO N�2";
list[30] = new Color(83, 172, 105).darker();
name[30] = "VERDINO N�2";
list[31] = new Color(33, 116, 35).brighter();
name[31] = "VERDE SCURO N�2";
list[32] = new Color(128, 206, 49).brighter();
name[32] = "VERDACCIO N�2";
list[33] = new Color(170, 162, 55).brighter();
name[33] = "ORO N�2";
list[34] = new Color(191, 156, 34).darker();
name[34] = "OCRA N�2";
list[35] = new Color(255, 0, 128).brighter();
name[35] = "ROSACCIO N�2";
list[36] = new Color(198, 50, 50).darker().darker();
name[36] = "ROSSO N�4";
list[37] = new Color(99, 55, 137).brighter().brighter();
name[37] = "VIOLA SCURO N�3";
}
示例9: createLookAndFeelCustomizationKeysAndValues
@Override
public Object[] createLookAndFeelCustomizationKeysAndValues() {
if (ThemeValue.functioning()) {
return new Object[] {
//XXX once the JDK team has integrated support for standard
//UIManager keys into 1.5 (not there as of b47), these can
//probably be deleted, resulting in a performance improvement:
"control", control,
"controlHighlight", new ThemeValue (Region.PANEL, ThemeValue.LIGHT, Color.LIGHT_GRAY), //NOI18N
"controlShadow", new ThemeValue (Region.PANEL, ThemeValue.DARK, Color.DARK_GRAY), //NOI18N
"controlDkShadow", new ThemeValue (Region.PANEL, ThemeValue.BLACK, Color.BLACK), //NOI18N
"controlLtHighlight", new ThemeValue (Region.PANEL, ThemeValue.WHITE, Color.WHITE), //NOI18N
"textText", new ThemeValue (Region.PANEL, ColorType.TEXT_FOREGROUND, Color.BLACK), //NOI18N
"text", new ThemeValue (Region.PANEL, ColorType.TEXT_BACKGROUND, Color.GRAY), //NOI18N
"tab_unsel_fill", control, //NOI18N
"SplitPane.dividerSize", new Integer (2), //NOI18N
SYSTEMFONT, controlFont, //NOI18N
USERFONT, controlFont, //NOI18N
MENUFONT, controlFont, //NOI18N
LISTFONT, controlFont, //NOI18N
"Label.font", controlFont, //NOI18N
"Panel.font", controlFont, //NOI18N
// workaround: GTKLookAndFeel FileChooser is unusable, cannot
// choose a dir and doesn't look native anyway. We force MetalFileChooserUI
"FileChooserUI", "javax.swing.plaf.metal.MetalFileChooserUI", // NOI18N
"FileView.computerIcon", javax.swing.plaf.metal.MetalIconFactory.getTreeComputerIcon(), // NOI18N
"FileView.hardDriveIcon", javax.swing.plaf.metal.MetalIconFactory.getTreeHardDriveIcon(), // NOI18N
"FileView.floppyDriveIcon", javax.swing.plaf.metal.MetalIconFactory.getTreeFloppyDriveIcon(), // NOI18N
"FileChooser.newFolderIcon", javax.swing.plaf.metal.MetalIconFactory.getFileChooserNewFolderIcon(), // NOI18N
"FileChooser.upFolderIcon", javax.swing.plaf.metal.MetalIconFactory.getFileChooserUpFolderIcon(), // NOI18N
"FileChooser.homeFolderIcon", javax.swing.plaf.metal.MetalIconFactory.getFileChooserHomeFolderIcon(), // NOI18N
"FileChooser.detailsViewIcon", javax.swing.plaf.metal.MetalIconFactory.getFileChooserDetailViewIcon(), // NOI18N
"FileChooser.listViewIcon", javax.swing.plaf.metal.MetalIconFactory.getFileChooserListViewIcon(), // NOI18N
"FileChooser.usesSingleFilePane", Boolean.TRUE, // NOI18N
"FileChooser.ancestorInputMap", // NOI18N
new UIDefaults.LazyInputMap(new Object[] {
"ESCAPE", "cancelSelection", // NOI18N
"F2", "editFileName", // NOI18N
"F5", "refresh", // NOI18N
"BACK_SPACE", "Go Up", // NOI18N
"ENTER", "approveSelection", // NOI18N
"ctrl ENTER", "approveSelection" // NOI18N
}),
// special tree icons - only for property sheet
"Tree.gtk_expandedIcon", new GTKExpandedIcon(),
"Tree.gtk_collapsedIcon", new GTKCollapsedIcon(),
};
} else {
Object[] result = new Object[] {
TOOLBAR_UI, new UIDefaults.ProxyLazyValue("org.netbeans.swing.plaf.gtk.GtkToolbarUI"), //NOI18N
// special tree icons - only for property sheet
"Tree.gtk_expandedIcon", new GTKExpandedIcon(),
"Tree.gtk_collapsedIcon", new GTKCollapsedIcon(),
};
return result;
}
}
示例10: createGuaranteedKeysAndValues
@Override
public Object[] createGuaranteedKeysAndValues() {
return new Object[] {
"InternalFrame.activeTitleBackground",
new GuaranteedValue("InternalFrame.activeTitleBackground",
Color.BLUE),
"InternalFrame.borderShadow",
new GuaranteedValue("InternalFrame.borderShadow", Color.gray),
"InternalFrame.borderHighlight",
new GuaranteedValue("InternalFrame.borderHighlight",
Color.white),
"InternalFrame.borderDarkShadow",
new GuaranteedValue("InternalFrame.borderDarkShadow",
Color.darkGray),
"InternalFrame.borderLight",
new GuaranteedValue("InternalFrame.borderLight",
Color.lightGray),
"TabbedPane.background",
new GuaranteedValue("TabbedPane.background", Color.LIGHT_GRAY),
"TabbedPane.focus",
new GuaranteedValue("TabbedPane.focus", Color.GRAY),
"TabbedPane.highlight",
new GuaranteedValue("TabbedPane.highlight", Color.WHITE) ,
"Button.dashedRectGapX",
new GuaranteedValue("Button.dashedRectGapX", Integer.valueOf(5)),
"Button.dashedRectGapY",
new GuaranteedValue("Button.dashedRectGapY", Integer.valueOf(4)),
"Button.dashedRectGapWidth",
new GuaranteedValue("Button.dashedRectGapWidth", Integer.valueOf(10)),
"Button.dashedRectGapHeight",
new GuaranteedValue("Button.dashedRectGapHeight", Integer.valueOf(8)),
"Tree.expandedIcon", new TreeIcon(false),
"Tree.collapsedIcon", new TreeIcon(true)
};
}
示例11: getPopupBorderColor
static Color getPopupBorderColor () {
Color shadow = UIManager.getColor("controlShadow");
return shadow != null ? shadow : Color.GRAY;
}
示例12: mirrors
private void mirrors() {
boolean boo = true;
byte b = 5;
char c = 'c';
short s = 512;
int i = 10000;
long l = Long.MAX_VALUE;
float f = 12.12f;
double d = 1e150;
int[] iarr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
double[][] darr = new double[][] { { 0.1, 0.2, 0.3 }, { 1.1, 1.2, 1.3 }, { 2.1, 2.2, 2.3 } };
String str = "A String";
Integer integer = new Integer(Integer.MIN_VALUE);
Date date = new Date(1000000000l);
date.toString(); // This is necessary to initialize the Date.cdate field and Gregorian$Date class.
Color color = Color.RED;
Point point = new Point(10, 10);
File file = new File("/tmp/Foo.txt");
URL url = createURL("http://netbeans.org");
URL url2 = createPristineURL();
Color[][] colors = new Color[][] { { Color.WHITE, Color.BLACK }, { Color.YELLOW, Color.GRAY } };
List selfReferencedList = createSelfReferencedList();
EventObject event = createObjectCircle();
System.currentTimeMillis(); // LBREAKPOINT
boolean newValues = (boo == false) && b == (byte) 255 && c == 'Z' &&
s == (short) -1024 && i == -1 && l == 123456789101112l &&
f == 2e-2f && d == -3e250 &&
Arrays.equals(iarr, new int[] { 9, 7, 5, 3, 1 }) &&
Arrays.deepEquals(darr, new double[][] { { 1e100, 2e200 }, { 1.1e100, 2.1e200 }, { 1.2e100, 2.2e200 }, { 1.3e100, 2.3e200 } }) &&
str.equals("An alternate sTRING") &&
integer.equals(-1048576) &&
date.equals(new Date(3333333333l)) &&
color.equals(Color.GREEN) &&
point.equals(new Point(-100, -100)) &&
file.equals(new File("/tmp/Test.java")) &&
url.equals(createURL("http://debugger.netbeans.org")) &&
url2 == null;
System.currentTimeMillis(); // LBREAKPOINT
}
示例13: getPopupBorderColor
static Color getPopupBorderColor () {
Color shadow = UIManager.getColor("controlShadow"); // NOI18N
return shadow != null ? shadow : Color.GRAY;
}
示例14: getColorForValue
@Override
public Color getColorForValue(double value) {
if (Double.isNaN(value)) {
return Color.LIGHT_GRAY;
}
// map value to [0,1]
if (minValue == maxValue) {
value = 0.5;
} else if (value < minValue) {
Color minColor;
if (useGrayForOutliers) {
minColor = Color.GRAY;
} else {
minColor = this.minColor;
}
if (alpha < 255) {
minColor = DataStructureUtils.setColorAlpha(minColor, alpha);
}
return minColor;
} else if (value > maxValue) {
Color maxColor;
if (useGrayForOutliers) {
maxColor = Color.GRAY;
} else {
maxColor = this.maxColor;
}
if (alpha < 255) {
maxColor = DataStructureUtils.setColorAlpha(maxColor, alpha);
}
return maxColor;
} 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 = getMinColor();
Color MAX_LEGEND_COLOR = getMaxColor();
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;
}
示例15: makeColor
private static void makeColor() {
/* Primi 9 Colori */
list[0] = Color.RED;
name[0] = "ROSSO";
list[1] = Color.BLUE;
name[1] = "BLU";
list[2] = Color.MAGENTA;
name[2] = "MAGENTA";
list[3] = Color.GREEN;
name[3] = "VERDE";
list[4] = Color.BLACK;
name[4] = "NERO";
list[5] = Color.YELLOW;
name[5] = "GIALLO";
list[6] = Color.PINK;
name[6] = "ROSA";
list[7] = Color.CYAN;
name[7] = "AZZURRO";
list[8] = Color.ORANGE;
name[8] = "ARANCIONE";
list[9] = Color.GRAY;
name[9] = "GRIGIO";
list[10] = new Color(155, 0, 0);
name[10] = "ROSSO SCURO";
list[11] = new Color(94, 0, 2);
name[11] = "MARRONE";
list[12] = new Color(242, 129, 252);
name[12] = "VIOLA CHIARO";
list[13] = new Color(129, 69, 135);
name[13] = "VIOLA SCURO";
list[14] = new Color(141, 141, 254);
name[14] = "BLU CHIARO";
list[15] = new Color(1, 1, 109);
name[15] = "BLU SCURO";
list[16] = new Color(3, 124, 146);
name[16] = "AZZURRO SCURO";
list[17] = new Color(83, 172, 105);
name[17] = "VERDINO";
list[18] = new Color(33, 116, 35);
name[18] = "VERDE SCURO";
list[19] = new Color(128, 206, 49);
name[19] = "VERDACCIO";
list[20] = new Color(170, 162, 55);
name[20] = "ORO";
list[21] = new Color(191, 156, 34);
name[21] = "OCRA";
list[22] = new Color(255, 0, 128);
name[22] = "ROSACCIO";
list[23] = new Color(198, 50, 50);
name[23] = "ROSSO N°2";
list[24] = new Color(99, 55, 137);
name[24] = "VIOLA SCURO N°2";
list[25] = new Color(99, 55, 137).brighter();
name[25] = "ROSSO N°3";
list[26] = new Color(129, 69, 135).brighter();
name[26] = "VIOLA SCURO N°2";
list[27] = new Color(141, 141, 254).darker();
name[27] = "BLU CHIARO N°2";
list[28] = new Color(1, 1, 109).brighter().brighter();
name[28] = "BLU SCURO N°2";
list[29] = new Color(3, 124, 146).brighter();
name[29] = "AZZURRO SCURO N°2";
list[30] = new Color(83, 172, 105).darker();
name[30] = "VERDINO N°2";
list[31] = new Color(33, 116, 35).brighter();
name[31] = "VERDE SCURO N°2";
list[32] = new Color(128, 206, 49).brighter();
name[32] = "VERDACCIO N°2";
list[33] = new Color(170, 162, 55).brighter();
name[33] = "ORO N°2";
list[34] = new Color(191, 156, 34).darker();
name[34] = "OCRA N°2";
list[35] = new Color(255, 0, 128).brighter();
name[35] = "ROSACCIO N°2";
list[36] = new Color(198, 50, 50).darker().darker();
name[36] = "ROSSO N°4";
list[37] = new Color(99, 55, 137).brighter().brighter();
name[37] = "VIOLA SCURO N°3";
}