本文整理汇总了Java中java.awt.Color.RED属性的典型用法代码示例。如果您正苦于以下问题:Java Color.RED属性的具体用法?Java Color.RED怎么用?Java Color.RED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.Color
的用法示例。
在下文中一共展示了Color.RED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testElasticCollisionsShipsY
@Test
public void testElasticCollisionsShipsY() {
Ship ship1, ship2;
Position ship1Pos = new Position(0, 0, Math.PI / 4);
ship1Pos.setTranslationalVelocity(new Vector2D(0, 20));
ship1 = new Ship("team1", Color.BLUE, ship1Pos);
Position ship2Pos = new Position(0, 10, -Math.PI/4);
ship2Pos.setTranslationalVelocity(new Vector2D(0, -10));
ship2 = new Ship("team2", Color.RED, ship2Pos);
collisionHandler.collide(ship1, ship2, space);
assertEquals(ship1.getPosition().getTranslationalVelocityX(), 0, 0.01);
assertEquals(ship1.getPosition().getTranslationalVelocityY(), -10, 0.01);
assertEquals(ship2.getPosition().getTranslationalVelocityX(), 0, 0.01);
assertEquals(ship2.getPosition().getTranslationalVelocityY(), 20, 0.01);
}
示例2: ColorComboBox
/**
* C'tor
* The combo box is initialized with some basic colors and user can also
* pick a custom color
*/
public ColorComboBox() {
this( new Color[] {
Color.BLACK,
Color.BLUE,
Color.CYAN,
Color.DARK_GRAY,
Color.GRAY,
Color.GREEN,
Color.LIGHT_GRAY,
Color.MAGENTA,
Color.ORANGE,
Color.PINK,
Color.RED,
Color.WHITE,
Color.YELLOW,
}, new String[0], true);
}
示例3: testElasticCollisionsShipsDiagonal
@Test
public void testElasticCollisionsShipsDiagonal() {
Ship ship1, ship2;
Position ship1Pos = new Position(0, 0, Math.PI / 4);
ship1Pos.setTranslationalVelocity(new Vector2D(2, 2));
ship1 = new Ship("team1", Color.BLUE, ship1Pos);
Position ship2Pos = new Position(10, 10, -Math.PI/4);
ship2Pos.setTranslationalVelocity(new Vector2D(-10, -10));
ship2 = new Ship("team2", Color.RED, ship2Pos);
collisionHandler.collide(ship1, ship2, space);
assertEquals(ship1.getPosition().getTranslationalVelocityX(), -10, 0.01);
assertEquals(ship1.getPosition().getTranslationalVelocityY(), -10, 0.01);
assertEquals(ship2.getPosition().getTranslationalVelocityX(), 2, 0.01);
assertEquals(ship2.getPosition().getTranslationalVelocityY(), 2, 0.01);
}
示例4: loadResources
private synchronized void loadResources() {
if (cAlarm != null) return;
cAlarm = (ResourceManager.hasColorResource(cAlarmKey))
? ResourceManager.getColor(cAlarmKey)
: Color.RED;
cWarn = (ResourceManager.hasColorResource(cWarnKey))
? ResourceManager.getColor(cWarnKey)
: Color.MAGENTA;
cPlain = (ResourceManager.hasColorResource(cPlainKey))
? ResourceManager.getColor(cPlainKey)
: Color.DARK_GRAY;
cExport = (ResourceManager.hasColorResource(cExportKey))
? ResourceManager.getColor(cExportKey)
: Color.GREEN;
cGood = (ResourceManager.hasColorResource(cGoodKey))
? ResourceManager.getColor(cGoodKey)
: Color.BLUE;
}
示例5: getColorForRegion
private static Color getColorForRegion(BedrockRegionType bedrockRegionType)
{
if(bedrockRegionType == BedrockRegionType.OCEAN_FLOOR)
return Color.BLUE;
if(bedrockRegionType == BedrockRegionType.BEACH)
return Color.YELLOW;
if(bedrockRegionType == BedrockRegionType.FLATLANDS)
return Color.GREEN;
if(bedrockRegionType == BedrockRegionType.PLATEAU_HILLS)
return Color.RED;
return Color.BLACK;
}
示例6: test_color
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());
Color color = Color.RED;
String text = JSON.toJSONString(color);
System.out.println(text);
Color color2 = JSON.parseObject(text, Color.class);
Assert.assertEquals(color, color2);
}
示例7: transform
@Override
public Paint transform(V input) {
// picked vertices appear yellow
if (picked.isPicked(input))
return Color.YELLOW;
else
return Color.RED;
}
示例8: ExitButton
public ExitButton()
{
super(
Window.this.getWidth() - DEFAULT_WIDTH - DEFAULT_MARGIN_TO_EDGE,
DEFAULT_MARGIN_TO_EDGE,
DEFAULT_WIDTH,DEFAULT_HEIGHT,DEFAULT_TEXT,Color.RED);
}
示例9: getColor
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);
}
}
示例10: getErrorForeground
@NonNull
private static Color getErrorForeground() {
Color result = UIManager.getDefaults().getColor("nb.errorForeground"); //NOI18N
if (result == null) {
result = Color.RED;
}
return result;
}
示例11: getObject
protected TitledBorderUIResource getObject() {
return new TitledBorderUIResource(
new EmptyBorder(1, 2, 3, 4),
"TITLE",
TitledBorder.CENTER,
TitledBorder.ABOVE_TOP,
new Font("Serif", Font.ITALIC, 12),
Color.RED);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java
示例12: transform
@Override
public Paint transform(ViwnNode v) {
if (pi.isPicked(v)) {
return ViwnNodeSynset.vertexBackgroundColorSelected;
} else if (v == root) {
return ViwnNodeSynset.vertexBackgroundColorRoot;
} else if (v.isMarked()) {
return ViwnNodeSynset.vertexBackgroundColorMarked;
}
if (v instanceof ViwnNodeCandExtension) {
ViwnNodeCandExtension ext = (ViwnNodeCandExtension) v;
return ext.getColor();
} else if (v instanceof ViwnNodeCand) {
ViwnNodeCand cand = (ViwnNodeCand) v;
return cand.getColor();
} else if (v instanceof ViwnNodeWord) {
return ((ViwnNodeWord) v).getColor();
} else if (v instanceof ViwnNodeSynset) {
ViwnNodeSynset synset = (ViwnNodeSynset) v;
PartOfSpeech pos = synset.getPos();
if (pos == null || "! S.y.n.s.e.t p.u.s.t.y !".equals(synset.getLabel())) {
return Color.RED;
}
if (ViwnNodeSynset.PosBgColors.containsKey(pos)) {
return ViwnNodeSynset.PosBgColors.get(pos);
} else {
return ViwnNodeSynset.PosBgColors.get(PartOfSpeechManager.getInstance().getById(1l));
}
} else if (v instanceof ViwnNodeSet) {
return ViwnNodeSet.vertexBackgroundColor;
}
return new Color(255, 0, 255);
}
示例13: init
@Override
public void init() {
JButton button = new JButton("Swap models");
button.addActionListener(this);
this.chooser = new JColorChooser(Color.RED);
this.chooser.setSelectionModel(WHITE);
add(BorderLayout.NORTH, button);
add(BorderLayout.CENTER, this.chooser);
}
示例14: adjustErrorColors
/**
* Color the name or role red if it is a duplicate.
*/
private void adjustErrorColors() {
if (metaData.getColumnMetaData(columnIndex).isRemoved()) {
nameLabel.setForeground(COLOR_COLUMN_DISABLED);
roleLabel.setForeground(COLOR_COLUMN_DISABLED);
typeLabel.setForeground(COLOR_COLUMN_DISABLED);
} else {
Color nameColor = validator.isDuplicateNameColumn(columnIndex) ? Color.RED : Color.BLACK;
nameLabel.setForeground(nameColor);
Color roleColor = validator.isDuplicateRoleColumn(columnIndex) ? Color.RED : Color.BLACK;
roleLabel.setForeground(roleColor);
}
}
示例15: getObject
protected BevelBorder getObject() {
return new BevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
}