Java Code Examples for java.awt.Color#RED

The following examples show how to use java.awt.Color#RED . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Tomcat8-Source-Read   File: MapDemo.java    License: MIT License 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent
    (JTable table, Object value, boolean isSelected,
     boolean hasFocus, int row, int column) {
    Component cell = super.getTableCellRendererComponent
                     (table, value, isSelected, hasFocus, row, column);
    cell.setBackground(Color.WHITE);
    if ( row > 0 ) {
        Color color = null;
        boolean primary = ( (Boolean) table.getValueAt(row, 5)).booleanValue();
        boolean proxy = ( (Boolean) table.getValueAt(row, 6)).booleanValue();
        boolean backup = ( (Boolean) table.getValueAt(row, 7)).booleanValue();
        if (primary) color = Color.GREEN;
        else if (proxy) color = Color.RED;
        else if (backup) color = Color.BLUE;
        if ( color != null ) cell.setBackground(color);
    }
    return cell;
}
 
Example 2
Source Project: frog   File: ColorUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static Color rainbowColor(float i) { // 根据数值大小范围,在8种彩虹色中取值
	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;
}
 
Example 3
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);
	}
}
 
Example 4
Source Project: binnavi   File: GroupNodeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testConstructor() {
  final Database database = new Database(new MockDatabase());

  final MockModule mockModule = new MockModule();

  final TagManager nodeTagManager =
      new TagManager(new MockTagManager(
          com.google.security.zynamics.binnavi.Tagging.TagType.NODE_TAG));
  final TagManager viewTagManager =
      new TagManager(new MockTagManager(
          com.google.security.zynamics.binnavi.Tagging.TagType.VIEW_TAG));

  final Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);

  final MockView mockView = new MockView();

  final View view = new View(module, mockView, nodeTagManager, viewTagManager);

  final INaviGroupNode internalGroupNode =
      new CGroupNode(0, 0, 0, 0, 0, Color.RED, false, false, new HashSet<CTag>(),
          new ArrayList<IComment>(), false, new MockSqlProvider());

  final GroupNode node = new GroupNode(view, internalGroupNode, viewTagManager);

  assertEquals("Group Node [0 elements]", node.toString());
}
 
Example 5
protected TitledBorder getObject() {
    return new TitledBorder(
            new EmptyBorder(1, 2, 3, 4),
            "TITLE",
            TitledBorder.CENTER,
            TitledBorder.ABOVE_TOP,
            new Font("Arial", Font.ITALIC, 12),
            Color.RED);
}
 
Example 6
private void initTest(Protocol protocol, String nameMedia) throws Exception {
  int pauseTimeSeconds = 10;
  final Color[] expectedColors = { Color.RED, Color.GREEN, Color.BLUE };

  String mediaUrl = getMediaUrl(protocol, nameMedia);

  testPlayerPause(mediaUrl, WebRtcChannel.VIDEO_ONLY, pauseTimeSeconds, expectedColors);
}
 
Example 7
private synchronized void drawGraph(String type, String chartPath) {
	// 設定圖表內容
	Date startDate = DateUtil.dayFilter(mRelease.getStartDateString());
	Date dueDate = DateUtil.dayFilter(mRelease.getDueDateString());
	ChartUtil chartUtil = new ChartUtil(
			"Stories Burndown Chart in Release Plan #"
					+ mRelease.getId(),
					startDate, new Date(dueDate.getTime() + 24 * 3600 * 1000));

	chartUtil.setChartType(ChartUtil.LINECHART);

	// TODO:要新增的data set
	chartUtil.addDataSet("current", mStoryRealMap);
	chartUtil.addDataSet("ideal", mStoryIdealMap);
	chartUtil.setInterval(1);
	chartUtil.setValueAxisLabel("Stories");
	// 依照輸入的順序來呈現顏色
	Color[] colors = { Color.RED, Color.GRAY };
	chartUtil.setColor(colors);

	float[] dashes = { 8f };
	BasicStroke[] strokes = {
			new BasicStroke(1.5f),
			new BasicStroke(1.5f, BasicStroke.CAP_ROUND,
					BasicStroke.JOIN_ROUND, 16f, dashes, 0.f) };
	chartUtil.setStrokes(strokes);

	// 產生圖表
	chartUtil.createChart(chartPath);
}
 
Example 8
Source Project: binnavi   File: CCriteriumExecuterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalStateException.class)
public void testInvalidOrCriterion2() {
  final CCachedOrCriterium criterium = new CCachedOrCriterium();
  final CCachedExpressionTreeNode node = new CCachedExpressionTreeNode(criterium);
  CCachedExpressionTreeNode.append(m_tree.getRoot(), node);

  final CCachedColorCriterium criterium3 = new CCachedColorCriterium(Color.RED);
  final CCachedExpressionTreeNode node3 = new CCachedExpressionTreeNode(criterium3);
  CCachedExpressionTreeNode.append(node, node3);

  CCriteriumExecuter.execute(m_tree, m_graph);
}
 
Example 9
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);
}
 
Example 10
Source Project: opt4j   File: ConvergencePlotWidget.java    License: MIT License 5 votes vote down vote up
/**
 * Constructs a {@link ConvergencePlotWidget}.
 * 
 * @param optimizer
 *            the optimizer
 * @param data
 *            the data
 * @param objectivesMonitor
 *            the objective monitor that determine the objective of the
 *            optimization problem
 */
@Inject
public ConvergencePlotWidget(Optimizer optimizer, ConvergencePlotData data, ObjectivesMonitor objectivesMonitor,
		AutoZoomButton autoZoom) {
	super();
	this.data = data;
	selection = new Selection();

	panel = new JPanel();
	panel.setLayout(new BorderLayout());

	plot = new Plot();
	plot.addLegend(0, "Max");
	plot.addLegend(1, "Mean");
	plot.addLegend(2, "Min");
	Color[] colors = new Color[3];
	colors[0] = Color.RED;
	colors[1] = Color.LIGHT_GRAY;
	colors[2] = Color.BLUE;
	plot.setColors(colors);

	panel.add(plot);

	JToolBar menu = new JToolBar();
	menu.setFloatable(false);
	menu.add(selection);
	menu.addSeparator();
	autoZoom.setPlotBox(plot);
	menu.add(autoZoom);

	Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, menu.getBackground().darker());
	menu.setBorder(border);

	panel.add(menu, BorderLayout.NORTH);

	optimizer.addOptimizerIterationListener(this);

	objectivesMonitor.addListener(this);
	doPaint();
}
 
Example 11
Source Project: netbeans   File: AddDependencyPanel.java    License: Apache License 2.0 4 votes vote down vote up
@Messages ({"MSG_Defined=Dependency with given groupId and artifactId is already defined in project."})
private void checkValidState() {
    String gId = txtGroupId.getText().trim();
    if (gId.length() <= 0) {
        gId = null;
    }
    String aId = txtArtifactId.getText().trim();
    if (aId.length() <= 0) {
        aId = null;
    }
    String version = txtVersion.getText().trim();
    if (version.length() <= 0) {
        version = null;
    }

    String warn = null;
    boolean dmDefined = tabPane.isEnabledAt(2);
    if (artifactList != null) {
        Color c = defaultVersionC;
        if (dmDefined) {
            if (findConflict(artifactList.getDMDeps(), gId, aId, version, null) == 1) {
                c = Color.RED;
                warn = NbBundle.getMessage(AddDependencyPanel.class, "MSG_VersionConflict");
            }
        }
        txtVersion.setForeground(c);
    }
    
    if (project.getDependencies() != null && gId != null && aId != null) {
        //poor mans expression evaluator, it's unlikely that some other expressions would be frequent
        String resolvedGroupId = gId.contains("${project.groupId}") ? gId.replace("${project.groupId}", project.getGroupId()) : gId;
        String resolvedArtifactId = aId.contains("${project.artifactId}") ? aId.replace("${project.artifactId}", project.getArtifactId()) : aId;
        
        for (Dependency dep : project.getDependencies()) {
            if (resolvedGroupId.equals(dep.getGroupId()) && resolvedArtifactId.equals(dep.getArtifactId())) {
                warn = Bundle.MSG_Defined();
            }
                
        }
    }
    
    if (nls != null) {
        if (warn != null) {
            nls.setWarningMessage(warn);
        } else {
            nls.clearMessages();
        }
    }

    if (gId == null) {
        okButton.setEnabled(false);
        return;
    }
    if (aId == null) {
        okButton.setEnabled(false);
        return;
    }
    if (version == null && !dmDefined) {
        okButton.setEnabled(false);
        return;
    }

    okButton.setEnabled(true);
}
 
Example 12
protected LineBorderUIResource getObject() {
    return new LineBorderUIResource(Color.RED, 2);
}
 
Example 13
Source Project: SikuliX1   File: SxArrow.java    License: MIT License 4 votes vote down vote up
private void init() {
  colorFront = Color.RED;
  style = STRAIGHT;
  updateComponent();
}
 
Example 14
protected LineBorder getObject() {
    return new LineBorder(Color.RED, 2, true);
}
 
Example 15
public RotationHandle(String name, TransformBox box, Point2D pos, View view) {
    super(name, pos.getX(), pos.getY(), view, Color.WHITE, Color.RED);
    this.box = box;
    cursor = Cursors.DEFAULT;
}
 
Example 16
protected LineBorderUIResource getObject() {
    return new LineBorderUIResource(Color.RED, 2);
}
 
Example 17
protected MatteBorder getObject() {
    return new MatteBorder(1, 2, 3, 4, Color.RED);
}
 
Example 18
protected LineBorder getObject() {
    return new LineBorder(Color.RED, 2, true);
}
 
Example 19
protected LineBorder getObject() {
    return new LineBorder(Color.RED, 2, true);
}
 
Example 20
/**
 * Creates a scroll pane with preferred size (width, height).  A default
 * value will be used for line number color (gray), and the current
 * line's line number will be highlighted.
 *
 * @param width The preferred width of <code>area</code>.
 * @param height The preferred height of <code>area</code>.
 * @param area The text area this scroll pane will contain.
 * @param lineNumbersEnabled Whether line numbers are initially enabled.
 */
public EditorScrollPane(int width, int height, JEditorPane area,
		boolean lineNumbersEnabled) {
	this(width, height, area, lineNumbersEnabled, Color.RED);
}