本文整理汇总了Java中java.awt.Color.orange方法的典型用法代码示例。如果您正苦于以下问题:Java Color.orange方法的具体用法?Java Color.orange怎么用?Java Color.orange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.orange方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintComponent
import java.awt.Color; //导入方法依赖的package包/类
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (lstInfo != null && !lstInfo.isEmpty()) {
int y,w = getWidth();
double lineSize = (double)(getHeight()-48) / (double)totalNbLines;
Color c;
for (Entry<Integer, List<CompileInfo>> e : lstInfo.entrySet()) {
int worst = e.getValue().get(0).kind; /*10;
for (CompileInfo info : e.getValue()) {
if (info.kind < worst) worst = info.kind;
}*/
c = (worst == 0) ? Color.red : (worst == 1) ? Color.orange : Color.blue;
g.setColor(c.brighter().brighter());
y = 16+(int)(lineSize*e.getKey());
g.fillRect(0,y-1,w,3);
g.setColor(this.getBackground());
g.drawRect(0,y-1,w,3);
}
}
}
示例2: setTextColor
import java.awt.Color; //导入方法依赖的package包/类
/**
* Sets the text Color for the activator text.
* The following is a list of supported Color names
* <ul>
* <li>black
* <li>blue
* <li>cyan
* <li>darkGray
* <li>gray
* <li>green
* <li>lightGray
* <li>magenta
* <li>orange
* <li>pink
* <li>red
* <li>white
* <li>yellow
* </ul>
*/
public void setTextColor(String name) {
Color color=null;
if ("black".equals(name)) {
color = Color.black;
} else if ("blue".equals(name)) {
color = Color.blue;
} else if ("cyan".equals(name)) {
color = Color.cyan;
} else if ("darkGray".equals(name)) {
color = Color.darkGray;
} else if ("gray".equals(name)) {
color = Color.gray;
} else if ("green".equals(name)) {
color = Color.green;
} else if ("lightGray".equals(name)) {
color = Color.lightGray;
} else if ("magenta".equals(name)) {
color = Color.magenta;
} else if ("orange".equals(name)) {
color = Color.orange;
} else if ("pink".equals(name)) {
color = Color.pink;
} else if ("red".equals(name)) {
color = Color.red;
} else if ("white".equals(name)) {
color = Color.white;
} else if ("yellow".equals(name)) {
color = Color.yellow;
}
if (color == null) {
return;
}
textAttribs.removeAttribute(StyleConstants.Foreground);
textAttribs.addAttribute(StyleConstants.Foreground, color);
setForeground(color);
}
示例3: LoadColors
import java.awt.Color; //导入方法依赖的package包/类
public void LoadColors()
{
colors[GameResources.colorWhite] = Color.white;
colors[GameResources.colorBlack] = Color.black;
colors[GameResources.colorGreen] = new Color(game.gameOptions.colorGreenChat);
colors[GameResources.colorRed] = new Color(game.gameOptions.colorRedChat);
colors[GameResources.colorBlue] =new Color(game.gameOptions.colorBlueChat);
colors[GameResources.colorYellow] =new Color(game.gameOptions.colorYellowChat);
colors[GameResources.colorGray] = Color.gray;
colors[GameResources.colorMagenta] = Color.magenta;
colors[GameResources.colorDarkGray] = Color.darkGray;
colors[GameResources.colorOrange] = Color.orange;
colors[GameResources.colorCyan] = Color.cyan;
// Weapons
colors[GameResources.colorGreenWeapons] = new Color(game.gameOptions.colorGreenWeapons);
colors[GameResources.colorRedWeapons] = new Color(game.gameOptions.colorRedWeapons);
colors[GameResources.colorBlueWeapons] =new Color(game.gameOptions.colorBlueWeapons);
colors[GameResources.colorYellowWeapons] =new Color(game.gameOptions.colorYellowWeapons);
colors[GameResources.colorHealth] = new Color(255, 0, 0, 150);
colors[GameResources.colorEnergy] = new Color(0, 0, 255, 150);
colors[GameResources.colorBackground] = new Color(0, 0, 0, 130);
colors[GameResources.colorInterfaceShade] = new Color(0, 40, 0, 255);
colors[GameResources.colorPrivateMessage] = new Color(255, 153, 51);
colors[GameResources.colorName] = new Color(222, 170, 0);
colors[GameResources.colorPoints] = new Color(222, 120, 0);
}
示例4: randomColor
import java.awt.Color; //导入方法依赖的package包/类
private Color randomColor() {
Color colors[] = {Color.black, Color.blue, Color.cyan,
Color.gray, Color.darkGray, Color.green,
Color.lightGray, Color.magenta, Color.orange,
Color.pink,Color.red, Color.white, Color.yellow};
return colors[(int)(Math.random() * colors.length)];
}
示例5: HistGCanvas
import java.awt.Color; //导入方法依赖的package包/类
public HistGCanvas(Histogram histg) {
this.histg = histg;
barColors[0] = Color.blue;
barColors[1] = Color.red;
barColors[2] = Color.green;
barColors[3] = Color.yellow;
barColors[4] = Color.gray;
barColors[5] = Color.cyan;
barColors[6] = Color.orange;
barColors[7] = Color.lightGray;
barColors[8] = Color.pink;
barColors[9] = Color.darkGray;
}
示例6: getColor
import java.awt.Color; //导入方法依赖的package包/类
public Color getColor(String color) {
Matcher match = Pattern.compile("(\\d+), (\\d+), (\\d+)").matcher(color);
Matcher matchTwo = Pattern.compile("(\\d+)\\s(\\d+)\\s(\\d+)").matcher(color);
try {
if (match.find() == true) {
return new Color(Integer.parseInt(match.group(1)), Integer.parseInt(match.group(2)), Integer.parseInt(match.group(3)));
} else if (matchTwo.find() == true) {
return new Color(Integer.parseInt(matchTwo.group(1)), Integer.parseInt(matchTwo.group(2)), Integer.parseInt(matchTwo.group(3)));
} else {
switch (color) {
case "black": return Color.black;
case "blue": return Color.blue;
case "cyan": return Color.cyan;
case "gray": return Color.gray;
case "green": return Color.green;
case "magenta": return Color.magenta;
case "orange": return Color.orange;
case "pink": return Color.pink;
case "red": return Color.red;
case "white": return Color.white;
case "yellow": return Color.yellow;
case "dark_green": return Color.green.darker().darker().darker();
case "light_red": return Color.red.brighter();
default: return Color.gray;
}
}
} catch (Exception ex) {
com.gmt2001.Console.err.println("Bad RegEx Sent for getColor: " + ex.getMessage());
return Color.gray;
}
}
示例7: setSelectedNodes
import java.awt.Color; //导入方法依赖的package包/类
public void setSelectedNodes(Set<Integer> nodes) {
this.selectedNodes = nodes;
List<Color> colors = new ArrayList<>();
for (String s : getPositions()) {
colors.add(Color.black);
}
if (nodes.size() >= 1) {
for (Integer id : nodes) {
if (id < 0) {
id = -id;
}
InputNode last = null;
int index = 0;
for (InputGraph g : group.getGraphs()) {
Color curColor = colors.get(index);
InputNode cur = g.getNode(id);
if (cur != null) {
if (last == null) {
curColor = Color.green;
} else {
if (last.equals(cur)) {
if (curColor == Color.black) {
curColor = Color.white;
}
} else {
if (curColor != Color.green) {
curColor = Color.orange;
}
}
}
}
last = cur;
colors.set(index, curColor);
index++;
}
}
}
setColors(colors);
viewChangedEvent.fire();
}
示例8: setSelectedNodes
import java.awt.Color; //导入方法依赖的package包/类
public void setSelectedNodes(Set<Integer> nodes) {
this.selectedNodes = nodes;
List<Color> colors = new ArrayList<>();
for (String s : getPositions()) {
colors.add(Color.black);
}
if (nodes.size() >= 1) {
for (Integer id : nodes) {
if (id < 0) {
id = -id;
}
InputNode last = null;
int index = 0;
for (InputGraph g : graphs) {
Color curColor = colors.get(index);
InputNode cur = g.getNode(id);
if (cur != null) {
if (last == null) {
curColor = Color.green;
} else {
if (last.equals(cur) && last.getProperties().equals(cur.getProperties())) {
if (curColor == Color.black) {
curColor = Color.white;
}
} else {
if (curColor != Color.green) {
curColor = Color.orange;
}
}
}
}
last = cur;
colors.set(index, curColor);
index++;
}
}
}
setColors(colors);
viewChangedEvent.fire();
}
示例9: createDefaultPaintArray
import java.awt.Color; //导入方法依赖的package包/类
/**
* Convenience method to return an array of <code>Paint</code> objects that represent
* the pre-defined colors in the <code>Color<code> and <code>ChartColor</code> objects.
*
* @return an array of objects with the <code>Paint</code> interface.
*/
public static Paint[] createDefaultPaintArray() {
return new Paint[] {
Color.red,
Color.blue,
Color.green,
Color.yellow,
Color.orange,
Color.magenta,
Color.cyan,
Color.pink,
Color.gray,
ChartColor.DARK_RED,
ChartColor.DARK_BLUE,
ChartColor.DARK_GREEN,
ChartColor.DARK_YELLOW,
ChartColor.DARK_MAGENTA,
ChartColor.DARK_CYAN,
Color.darkGray,
ChartColor.LIGHT_RED,
ChartColor.LIGHT_BLUE,
ChartColor.LIGHT_GREEN,
ChartColor.LIGHT_YELLOW,
ChartColor.LIGHT_MAGENTA,
ChartColor.LIGHT_CYAN,
Color.lightGray,
ChartColor.VERY_DARK_RED,
ChartColor.VERY_DARK_BLUE,
ChartColor.VERY_DARK_GREEN,
ChartColor.VERY_DARK_YELLOW,
ChartColor.VERY_DARK_MAGENTA,
ChartColor.VERY_DARK_CYAN,
ChartColor.VERY_LIGHT_RED,
ChartColor.VERY_LIGHT_BLUE,
ChartColor.VERY_LIGHT_GREEN,
ChartColor.VERY_LIGHT_YELLOW,
ChartColor.VERY_LIGHT_MAGENTA,
ChartColor.VERY_LIGHT_CYAN
};
}
示例10: DialDemo1
import java.awt.Color; //导入方法依赖的package包/类
/**
* Creates a new instance.
*
* @param title the frame title.
*/
public DialDemo1(String title) {
super(title);
this.dataset = new DefaultValueDataset(10.0);
// get data for diagrams
DialPlot plot = new DialPlot();
plot.setView(0.0, 0.0, 1.0, 1.0);
plot.setDataset(this.dataset);
SimpleDialFrame dialFrame = new SimpleDialFrame();
dialFrame.setBackgroundPaint(Color.lightGray);
dialFrame.setForegroundPaint(Color.darkGray);
plot.setDialFrame(dialFrame);
GradientPaint gp = new GradientPaint(new Point(),
new Color(255, 255, 255), new Point(),
new Color(170, 170, 220));
DialBackground db = new DialBackground(gp);
db.setGradientPaintTransformer(new StandardGradientPaintTransformer(
GradientPaintTransformType.VERTICAL));
plot.setBackground(db);
DialTextAnnotation annotation1 = new DialTextAnnotation("Temperature");
annotation1.setFont(new Font("Dialog", Font.BOLD, 14));
annotation1.setRadius(0.7);
plot.addLayer(annotation1);
DialValueIndicator dvi = new DialValueIndicator(0, "c");
plot.addLayer(dvi);
StandardDialScale scale = new StandardDialScale(-40, 60, -120, -300);
scale.setTickRadius(0.88);
scale.setTickLabelOffset(0.15);
scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14));
plot.addScale(0, scale);
StandardDialRange range = new StandardDialRange(40.0, 60.0, Color.red);
range.setInnerRadius(0.52);
range.setOuterRadius(0.55);
plot.addLayer(range);
StandardDialRange range2 = new StandardDialRange(10.0, 40.0,
Color.orange);
range2.setInnerRadius(0.52);
range2.setOuterRadius(0.55);
plot.addLayer(range2);
StandardDialRange range3 = new StandardDialRange(-40.0, 10.0,
Color.green);
range3.setInnerRadius(0.52);
range3.setOuterRadius(0.55);
plot.addLayer(range3);
DialPointer needle = new DialPointer.Pointer();
plot.addLayer(needle);
DialCap cap = new DialCap();
cap.setRadius(0.10);
plot.setCap(cap);
JFreeChart chart1 = new JFreeChart(plot);
chart1.setTitle("Demo Dial 1");
ChartPanel cp1 = new ChartPanel(chart1);
cp1.setPreferredSize(new Dimension(400, 400));
this.slider = new JSlider(-40, 60);
this.slider.setMajorTickSpacing(10);
this.slider.setPaintLabels(true);
this.slider.addChangeListener(this);
JPanel content = new JPanel(new BorderLayout());
content.add(cp1);
content.add(this.slider, BorderLayout.SOUTH);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(content);
}