下面列出了java.awt.Color#CYAN 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Test method for {@link
* com.sldeditor.common.property.PropertyManager#updateValue(java.lang.String, java.awt.Color)}.
*/
@Test
public void testUpdateValueStringColor() {
PropertyManager propertyManager = new PropertyManager();
propertyManager.setPropertyFile(null);
String key = "test colour key";
Color value = Color.CYAN;
propertyManager.updateValue(key, value);
Color defaultValue = Color.MAGENTA;
Color actualResult = propertyManager.getColourValue(key, defaultValue);
assertEquals(value, actualResult);
String newKey = "test colour key 2";
actualResult = propertyManager.getColourValue(newKey, defaultValue);
assertEquals(defaultValue, actualResult);
}
public void paintComponent(Graphics g){
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.BLACK);
curve.draw(g2);
Color[] colors = new Color[]{
Color.RED, Color.GREEN, Color.CYAN, Color.MAGENTA, Color.ORANGE};
int i= 0;
g2.setColor(Color.BLUE);
for(CirculinearContinuousCurve2D cont :
CirculinearCurves2D.splitContinuousCurve(curve)){
g2.setColor(colors[i++]);
cont.draw(g2);
}
}
public static Color color(float i) {
if (i == 0)
return Color.black;
if (i == 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
public static Color color(float i) {
if (i == 0)
return Color.black;
if (i == 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
public Paint color() {
if (en1 != null) {
return Color.BLACK;
} else if (en2 != null) {
return Color.GRAY;
}
if (att1 != null) {
return Color.BLUE;
} else if (att2 != null) {
return Color.CYAN;
}
if (fk1 != null) {
return Color.red;
} else if (fk2 != null) {
return Color.magenta;
} else if (ty != null) {
return Color.white;
}
return Util.anomaly();
}
public Color getSWCcolor() {
switch (swcType) {
case Path.SWC_SOMA:
return Color.BLUE;
case Path.SWC_DENDRITE:
return Color.GREEN;
case Path.SWC_APICAL_DENDRITE:
return Color.CYAN;
case Path.SWC_AXON:
return Color.RED;
case Path.SWC_FORK_POINT:
return Color.ORANGE;
case Path.SWC_END_POINT:
return Color.PINK;
case Path.SWC_CUSTOM:
return Color.YELLOW;
case Path.SWC_UNDEFINED:
default:
return SimpleNeuriteTracer.DEFAULT_DESELECTED_COLOR;
}
}
public static Color color(float i) {
if (i == 0)
return Color.black;
if (i == 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
@ConfigItem(
keyName = "untaggedFishColor",
name = "Untagged fish color",
description = "Color of untagged fish",
position = 5
)
default Color untaggedFishColor()
{
return Color.CYAN;
}
private Color getColor(Object value) {
String val = Objects.toString(value, "").trim();
switch (val) {
case "Execute":
return Color.BLUE;//.darker();
case "App":
return Color.CYAN;//.darker();
case "Browser":
return Color.RED;//.darker();
default:
return new Color(204, 0, 255);
}
}
@Alpha
@ConfigItem(
position = 10,
keyName = "markerColor9",
name = "Group 9 tile color",
description = "Configures the color of the 9th group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "9 || 10 || 11 || 12"
)
default Color markerColor9()
{
return Color.CYAN;
}
@ConfigItem(
position = 2,
keyName = "colorGameObject",
name = "Trail Object Color",
description = "Color for mushrooms, mud, seaweed, etc",
titleSection = "colorsTitle"
)
default Color getObjectColor()
{
return Color.CYAN;
}
@ConfigItem(
position = 2,
keyName = "npcColor",
name = "Highlight Color",
description = "Color of the NPC highlight"
)
default Color getHighlightColor()
{
return Color.CYAN;
}
@ConfigItem(
position = 1,
keyName = "damageNotificationColor",
name = "Damage Notification Color",
description = "Color of damage notification text in chat"
)
default Color damageNotificationColor()
{
return Color.CYAN;
}
public Color getColor(RequestType type) {
Color result;
switch (type) {
case ASSOCIATION:
result = Color.YELLOW;
break;
case XRDS:
result = Color.LIGHT_GRAY;
break;
case HTML:
result = Color.BLUE;
break;
case TOKEN_VALID:
result = Color.green;
break;
case TOKEN_ATTACK:
result = Color.red;
break;
case CHECK_AUTHENTICATION:
result = Color.CYAN;
break;
case ERROR:
result = Color.MAGENTA;
break;
case XXE:
result = Color.PINK;
break;
default:
throw new AssertionError();
}
return result;
}
protected JComponent createColorPicker() {
Color[] colors = {Color.BLACK,
Color.DARK_GRAY,
Color.GRAY,
Color.LIGHT_GRAY,
Color.WHITE,
Color.CYAN,
Color.BLUE,
Color.MAGENTA,
Color.YELLOW,
Color.ORANGE,
Color.RED,
Color.PINK,
Color.GREEN};
JPanel colorsPanel = new JPanel(new GridLayout(-1, 6, 4, 4));
colorsPanel.setOpaque(false);
for (Color color : colors) {
ColorLabel colorLabel = new ColorLabel(color);
colorLabel.setDisplayName(ColorCodes.getName(color));
colorLabel.setHoverEnabled(true);
colorLabel.setMaximumSize(colorLabel.getPreferredSize());
colorLabel.setMinimumSize(colorLabel.getPreferredSize());
colorLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
setSelectedColor(colorLabel.getColor());
}
});
colorsPanel.add(colorLabel);
}
return colorsPanel;
}
public MainPanel() {
setPreferredSize(new Dimension(WIDTH, HEIGHT));
soul = new Soul(WIDTH / 2, HEIGHT / 2, 100, 180, Color.CYAN);
addMouseMotionListener(this);
// �Q�[�����[�v�J�n
Thread gameLoop = new Thread(this);
gameLoop.start();
}
@ConfigItem(
position = 2,
keyName = "colorStart",
name = "Start Color",
description = "Color for rocks that start the trails"
)
default Color getStartColor()
{
return Color.CYAN;
}
public Node(String node_code, String wlan_code, int node_type,
Point position) {
// Items read by CSV
this.node_code = node_code;
this.wlan_code = wlan_code;
this.node_type = node_type;
if (this.node_type == 1) {
color = Color.CYAN;
}
this.position = new Point();
this.shape = new Ellipse2D.Double(0, 0, 0, 0);
}
public static void animateText(SsdOled oled, String text) {
int width = oled.getWidth();
int height = oled.getHeight();
BufferedImage image = new BufferedImage(width, height, oled.getNativeImageType());
Graphics2D g2d = image.createGraphics();
Random random = new Random();
Color[] colours = { Color.WHITE, Color.BLUE, Color.CYAN, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY,
Color.MAGENTA, Color.ORANGE, Color.PINK, Color.RED, Color.YELLOW };
g2d.setBackground(Color.BLACK);
Font f = g2d.getFont();
Logger.info("Font name={}, family={}, size={}, style={}", f.getFontName(), f.getFamily(),
Integer.valueOf(f.getSize()), Integer.valueOf(f.getStyle()));
FontMetrics fm = g2d.getFontMetrics();
int maxwidth = fm.stringWidth(text);
int amplitude = height/4;
int offset = height/2 - 4;
int velocity = -2;
int startpos = width;
int pos = startpos;
int x;
for (int i=0; i<200; i++) {
g2d.clearRect(0, 0, width, height);
x = pos;
for (char c : text.toCharArray()) {
if (x > width) {
break;
}
if (x < -10) {
x += fm.charWidth(c);
continue;
}
// Calculate offset from sine wave.
int y = (int) (offset + Math.floor(amplitude * Math.sin(x / ((float)width) * 2.0 * Math.PI)));
// Draw text.
g2d.setColor(colours[random.nextInt(colours.length)]);
g2d.drawString(String.valueOf(c), x, y);
// Increment x position based on chacacter width.
x += fm.charWidth(c);
}
// Draw the image buffer.
oled.display(image);
// Move position for next frame.
pos += velocity;
// Start over if text has scrolled completely off left side of screen.
if (pos < -maxwidth) {
pos = startpos;
}
// Pause briefly before drawing next frame.
try {
Thread.sleep(50);
} catch (InterruptedException e) {
}
}
}
@Test
public void testGroupColorChangesGroupedVertexColors_AfterPeristence() {
graphFunction("01002cf5");
//
// Group a node
//
FGVertex v1 = vertex("01002d06");
FGVertex v2 = vertex("01002d0f");
GroupedFunctionGraphVertex group = group("A", v1, v2);
//
// Change the group color
//
Color newGroupColor = Color.CYAN;
color(group, newGroupColor);
//
// Trigger persistence
//
Address groupAddress = group.getVertexAddress();
FGData graphData = triggerPersistenceAndReload("01002cf5");
//
// Retrieve the group and make sure its color is restored
//
group = getGroupVertex(graphData.getFunctionGraph(), groupAddress);
verifyColor(group, newGroupColor);
//
// Ungroup
//
ungroup(group);
//
// Test the grouped vertices colors
//
v1 = vertex("01002d06");
v2 = vertex("01002d0f");
verifyColor(v1, newGroupColor);
verifyColor(v2, newGroupColor);
}