當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。