List of usage examples for java.awt Color YELLOW
Color YELLOW
To view the source code for java.awt Color YELLOW.
Click Source Link
From source file:WeatherWizard.java
void setupText(String s1, String s2) { if (temperature <= 32) { textColor = Color.blue;//w w w .j av a 2 s. c om feels = "Freezing"; } else if (temperature <= 50) { textColor = Color.green; feels = "Cold"; } else if (temperature <= 65) { textColor = Color.yellow; feels = "Cool"; } else if (temperature <= 75) { textColor = Color.orange; feels = "Warm"; } else { textColor = Color.red; feels = "Hot"; } condStr = s1; if (s2 != null) { condStr += "/" + s2; } }
From source file:umontreal.ssj.charts.SSJCategorySeriesCollection.java
/** * Converts a java Color object into a friendly and readable LaTeX/xcolor string. * * @param color in color./*from w ww. j a va 2 s . c o m*/ * @return friendly color with string format as possible, null otherwise. */ protected static String detectXColorClassic(Color color) { String retour = null; int red = color.getRed(); int green = color.getGreen(); int blue = color.getBlue(); // On utilise pas la method Color.equals(Color ) car on ne veut pas tester le parametre de transparence : Alpha if (red == Color.GREEN.getRed() && blue == Color.GREEN.getBlue() && green == Color.GREEN.getGreen()) return "green"; else if (red == Color.RED.getRed() && blue == Color.RED.getBlue() && green == Color.RED.getGreen()) return "red"; else if (red == Color.WHITE.getRed() && blue == Color.WHITE.getBlue() && green == Color.WHITE.getGreen()) return "white"; else if (red == Color.GRAY.getRed() && blue == Color.GRAY.getBlue() && green == Color.GRAY.getGreen()) return "gray"; else if (red == Color.BLACK.getRed() && blue == Color.BLACK.getBlue() && green == Color.BLACK.getGreen()) return "black"; else if (red == Color.YELLOW.getRed() && blue == Color.YELLOW.getBlue() && green == Color.YELLOW.getGreen()) return "yellow"; else if (red == Color.MAGENTA.getRed() && blue == Color.MAGENTA.getBlue() && green == Color.MAGENTA.getGreen()) return "magenta"; else if (red == Color.CYAN.getRed() && blue == Color.CYAN.getBlue() && green == Color.CYAN.getGreen()) return "cyan"; else if (red == Color.BLUE.getRed() && blue == Color.BLUE.getBlue() && green == Color.BLUE.getGreen()) return "blue"; else if (red == Color.DARK_GRAY.getRed() && blue == Color.DARK_GRAY.getBlue() && green == Color.DARK_GRAY.getGreen()) return "darkgray"; else if (red == Color.LIGHT_GRAY.getRed() && blue == Color.LIGHT_GRAY.getBlue() && green == Color.LIGHT_GRAY.getGreen()) return "lightgray"; else if (red == Color.ORANGE.getRed() && blue == Color.ORANGE.getBlue() && green == Color.ORANGE.getGreen()) return "orange"; else if (red == Color.PINK.getRed() && blue == Color.PINK.getBlue() && green == Color.PINK.getGreen()) return "pink"; if (red == 192 && blue == 128 && green == 64) return "brown"; else if (red == 128 && blue == 128 && green == 0) return "olive"; else if (red == 128 && blue == 0 && green == 128) return "violet"; else if (red == 192 && blue == 0 && green == 64) return "purple"; else return null; }
From source file:org.openmrs.module.vcttrac.web.view.chart.VCTCreateBarChartView.java
/** * Returns an array of paint objects that will be used for the bar colors. * /* w w w . j a v a2 s . c o m*/ * @return An array of paint objects. */ private static Paint[] createPaint() { Paint[] colors = new Paint[5]; colors[0] = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); colors[1] = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); colors[2] = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); colors[3] = new GradientPaint(0f, 0f, Color.orange, 0.0f, 0.0f, new Color(250, 128, 114)); colors[4] = new GradientPaint(0f, 0f, Color.yellow, 0.0f, 0.0f, new Color(255, 215, 0)); return colors; }
From source file:userInterface.MonitoringTeamRole.AnalysisJPanel.java
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked // TODO add your handling code here: JFreeChart chart = createChart(createDataset()); chart.setBackgroundPaint(Color.YELLOW); chart.getTitle().setPaint(Color.red); ChartFrame frame = new ChartFrame("XYChart", chart); frame.setVisible(true);//from www . j a va 2 s . c o m frame.setSize(450, 500); }
From source file:j2se.jfreechart.barchart.BarChartDemo3.java
/** * Creates a sample chart./* w w w . j a v a 2s . c o m*/ * * @param dataset the dataset. * * @return a sample chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 3", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation false, // include legend true, false); chart.setBackgroundPaint(Color.lightGray); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setNoDataMessage("NO DATA!"); final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue }); // renderer.setLabelGenerator(new StandardCategoryLabelGenerator()); renderer.setItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0); renderer.setPositiveItemLabelPosition(p); plot.setRenderer(renderer); // change the margin at the top of the range axis... final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); return chart; }
From source file:com.att.aro.ui.view.diagnostictab.plot.NetworkTypePlot.java
private void setRenderingColorForDataSeries(XYItemRenderer renderer, final XYIntervalSeriesCollection dataSeries) { renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.none), Color.WHITE); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.LTE), Color.RED); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.WIFI), Color.BLUE); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.UMTS), Color.PINK); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.ETHERNET), Color.BLACK); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSDPA), Color.YELLOW); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSPA), Color.ORANGE); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSPAP), Color.MAGENTA); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.HSUPA), Color.CYAN); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.GPRS), Color.GRAY); renderer.setSeriesPaint(dataSeries.indexOf(NetworkType.EDGE), Color.LIGHT_GRAY); }
From source file:com.greenpepper.confluence.macros.historic.AggregationExecutionChartBuilder.java
private void customizeChart(JFreeChart chart) throws IOException { chart.setBackgroundPaint(Color.white); chart.setBorderVisible(settings.isBorder()); TextTitle chartTitle = chart.getTitle(); customizeTitle(chartTitle, DEFAULT_TITLE_FONT); addSubTitle(chart, settings.getSubTitle(), DEFAULT_SUBTITLE_FONT); addSubTitle(chart, settings.getSubTitle2(), DEFAULT_SUBTITLE2_FONT); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(gpUtil.getText("greenpepper.historic.nodata")); StackedBarRenderer renderer = new StackedBarRenderer(true); plot.setRenderer(renderer);//from w w w . j av a2 s .com int index = 0; renderer.setSeriesPaint(index++, GREEN_COLOR); if (settings.isShowIgnored()) renderer.setSeriesPaint(index++, Color.yellow); renderer.setSeriesPaint(index, Color.red); renderer.setToolTipGenerator(new DefaultTooltipGenerator()); renderer.setItemURLGenerator(new CategoryURLGenerator() { public String generateURL(CategoryDataset data, int series, int category) { Comparable valueKey = data.getColumnKey(category); ChartLongValue value = (ChartLongValue) valueKey; return "javascript:" + settings.getExecutionUID() + "_showHistoricChart('" + value.getId() + "');"; } }); CategoryAxis domainAxis = plot.getDomainAxis(); customizeAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); domainAxis.setCategoryMargin(0.01); ValueAxis rangeAxis = plot.getRangeAxis(); customizeAxis(rangeAxis); rangeAxis.setLowerBound(0); rangeAxis.setUpperBound(1.0); if (rangeAxis instanceof NumberAxis) { NumberAxis numberAxis = (NumberAxis) rangeAxis; numberAxis.setTickUnit(new NumberTickUnit(.10)); numberAxis.setNumberFormatOverride(PERCENT_FORMATTER); } plot.setForegroundAlpha(0.8f); }
From source file:org.cytoscape.graph.render.immed.GraphGraphicsTest.java
private long drawCurrentFull(Random rand) { final float nodeSizeFactor = 50f; float size = (float) canvasSize; long begin = System.nanoTime(); for (int i = 0; i < numNodes; i++) { float x = rand.nextFloat() * (rand.nextBoolean() ? size : -size); float y = rand.nextFloat() * (rand.nextBoolean() ? size : -size); currentGraphGraphics.drawNodeFull((byte) (i % (int) GraphGraphics.s_last_shape), x, y, (x + (rand.nextFloat() * nodeSizeFactor)), (y + (rand.nextFloat() * nodeSizeFactor)), Color.blue, 1.0f + (i % 10), null, Color.yellow); }// w w w. ja va2 s .com long end = System.nanoTime(); long nodeDur = end - begin; BasicStroke edgeStroke = new BasicStroke(1f); begin = System.nanoTime(); for (int i = 0; i < numEdges; i++) { currentGraphGraphics.drawEdgeFull((byte) ((i % 7) - 8), rand.nextFloat() * (20f), Color.red, (byte) ((i % 7) - 8), rand.nextFloat() * (20f), Color.orange, rand.nextFloat() * (rand.nextBoolean() ? size : -size), rand.nextFloat() * (rand.nextBoolean() ? size : -size), currentGraphGraphics.m_noAnchors, rand.nextFloat() * (rand.nextBoolean() ? size : -size), rand.nextFloat() * (rand.nextBoolean() ? size : -size), 1f, edgeStroke, Color.green); } end = System.nanoTime(); long duration = (end - begin) + nodeDur; // try { // ImageIO.write(image,"PNG",new File("/tmp/homer-current-" + rand.nextInt(100) + ".png")); // } catch (IOException ioe) { ioe.printStackTrace(); } return duration; }
From source file:net.sf.profiler4j.console.ClassListPanel.java
/** * This method initializes classesTable/* w w w .j a v a 2s.c om*/ * * @return javax.swing.JTable */ private JTable getClassesTable() { if (classesTable == null) { classesTable = new JTable(); classesTable.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); classesTable.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 12)); classesTable.setModel(getClassListTableModel()); classesTable.setRowHeight(20); classesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (classesTable.getSelectedRowCount() > 0) { addAsRuleButton.setEnabled(true); } else { addAsRuleButton.setEnabled(false); } } }); TableColumn c = classesTable.getColumnModel().getColumn(0); c.setMinWidth(50); c.setMaxWidth(50); c = classesTable.getColumnModel().getColumn(1); c.setMinWidth(300); c.setCellRenderer(new DefaultTableCellRenderer() { Font f1 = new Font("Tahoma", java.awt.Font.PLAIN, 12); Font f2 = new Font("Tahoma", java.awt.Font.BOLD, 12); @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (isSelected) { setFont(f2); } else { setFont(f1); } if (classListTableModel.getRow(row).info.isInstrumented()) { if (isSelected) { setForeground(Color.YELLOW); setBackground(Color.BLUE); } else { setBackground(Color.decode("#bbffbb")); setForeground(Color.BLACK); } } else { if (isSelected) { setForeground(Color.WHITE); setBackground(Color.BLUE); } else { setBackground(Color.WHITE); setForeground(Color.BLACK); } } setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); return this; } }); } return classesTable; }
From source file:com.google.code.facebook.graph.sna.applet.RadialTreeLensDemo.java
/** * create an instance of a simple graph with controls to * demo the zoomand hyperbolic features. * //ww w.jav a 2 s. c om */ public RadialTreeLensDemo() { // create a simple graph for the demo // create a simple graph for the demo graph = new DelegateForest<String, Integer>(); createTree(); layout = new TreeLayout<String, Integer>(graph); radialLayout = new RadialTreeLayout<String, Integer>(graph); radialLayout.setSize(new Dimension(600, 600)); Dimension preferredSize = new Dimension(600, 600); final VisualizationModel<String, Integer> visualizationModel = new DefaultVisualizationModel<String, Integer>( radialLayout, preferredSize); vv = new VisualizationViewer<String, Integer>(visualizationModel, preferredSize); PickedState<String> ps = vv.getPickedVertexState(); PickedState<Integer> pes = vv.getPickedEdgeState(); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<String>(ps, Color.red, Color.yellow)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Integer>(pes, Color.black, Color.cyan)); vv.setBackground(Color.white); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>()); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<String>()); Container content = getContentPane(); GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv); content.add(gzsp); /** * the regular graph mouse for the normal view */ final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); rings = new Rings(); vv.addPreRenderPaintable(rings); hyperbolicViewSupport = new ViewLensSupport<String, Integer>(vv, new HyperbolicShapeTransformer(vv, vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)), new ModalLensGraphMouse()); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); final JRadioButton hyperView = new JRadioButton("Hyperbolic View"); hyperView.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { hyperbolicViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED); } }); graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener()); JMenuBar menubar = new JMenuBar(); menubar.add(graphMouse.getModeMenu()); gzsp.setCorner(menubar); JPanel controls = new JPanel(); JPanel zoomControls = new JPanel(new GridLayout(2, 1)); zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel hyperControls = new JPanel(new GridLayout(3, 2)); hyperControls.setBorder(BorderFactory.createTitledBorder("Examiner Lens")); zoomControls.add(plus); zoomControls.add(minus); JPanel modeControls = new JPanel(new BorderLayout()); modeControls.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modeControls.add(graphMouse.getModeComboBox()); hyperControls.add(hyperView); controls.add(zoomControls); controls.add(hyperControls); controls.add(modeControls); content.add(controls, BorderLayout.SOUTH); }