Java Code Examples for java.awt.Color#RED

The following examples show how to use java.awt.Color#RED . 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 File: MapDemo.java    From Tomcat8-Source-Read with 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 File: ColorUtils.java    From frog with 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
Source File: CheckSplitContinuousClosed.java    From javaGeom with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 File: GroupNodeTest.java    From binnavi with 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
Source File: javax_swing_border_TitledBorder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: ConvergencePlotWidget.java    From opt4j with 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 7
Source File: javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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 8
Source File: CCriteriumExecuterTest.java    From binnavi with 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
Source File: PlayerOnlyVideoTrackPauseTest.java    From kurento-java with Apache License 2.0 5 votes vote down vote up
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 10
Source File: ReleaseBoard.java    From ezScrum with GNU General Public License v2.0 5 votes vote down vote up
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 11
Source File: javax_swing_plaf_BorderUIResource_LineBorderUIResource.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected LineBorderUIResource getObject() {
    return new LineBorderUIResource(Color.RED, 2);
}
 
Example 12
Source File: javax_swing_border_LineBorder.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected LineBorder getObject() {
    return new LineBorder(Color.RED, 2, true);
}
 
Example 13
Source File: javax_swing_border_LineBorder.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected LineBorder getObject() {
    return new LineBorder(Color.RED, 2, true);
}
 
Example 14
Source File: javax_swing_border_MatteBorder.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected MatteBorder getObject() {
    return new MatteBorder(1, 2, 3, 4, Color.RED);
}
 
Example 15
Source File: AddDependencyPanel.java    From netbeans with 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 16
Source File: RotationHandle.java    From Pixelitor with GNU General Public License v3.0 4 votes vote down vote up
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 17
Source File: javax_swing_border_LineBorder.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected LineBorder getObject() {
    return new LineBorder(Color.RED, 2, true);
}
 
Example 18
Source File: SxArrow.java    From SikuliX1 with MIT License 4 votes vote down vote up
private void init() {
  colorFront = Color.RED;
  style = STRAIGHT;
  updateComponent();
}
 
Example 19
Source File: javax_swing_plaf_BorderUIResource_LineBorderUIResource.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected LineBorderUIResource getObject() {
    return new LineBorderUIResource(Color.RED, 2);
}
 
Example 20
Source File: EditorScrollPane.java    From nextreports-designer with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}