当前位置: 首页>>代码示例>>Java>>正文


Java Color.RED属性代码示例

本文整理汇总了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);
	
}
 
开发者ID:amymcgovern,项目名称:spacesettlers,代码行数:20,代码来源:TestCollisionHandler.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ColorComboBox.java

示例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);
	
}
 
开发者ID:CatherineHa,项目名称:Proj4,代码行数:20,代码来源:TestCollisionHandler.java

示例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;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:19,代码来源:ReportCompactColonyPanel.java

示例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;
}
 
开发者ID:domisum,项目名称:ExZiff,代码行数:16,代码来源:TestLauncher.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:ColorTest.java

示例7: transform

@Override
public Paint transform(V input) {
	// picked vertices appear yellow
	if (picked.isPicked(input))
		return Color.YELLOW;
	else
		return Color.RED;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:8,代码来源:NodeFillPaintTransformer.java

示例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);
}
 
开发者ID:AutonomousCarProject,项目名称:AutonomousCar,代码行数:7,代码来源:Window.java

示例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);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:13,代码来源:ReferenceRenderer.java

示例10: getErrorForeground

@NonNull
private static Color getErrorForeground() {
    Color result = UIManager.getDefaults().getColor("nb.errorForeground");  //NOI18N
    if (result == null) {
        result = Color.RED;
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:FixPlatform.java

示例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);
}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:37,代码来源:ViwnVertexFillColor.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Test6348456.java

示例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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:ConfigureDataTableHeader.java

示例15: getObject

protected BevelBorder getObject() {
    return new BevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:3,代码来源:javax_swing_border_BevelBorder.java


注:本文中的java.awt.Color.RED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。