List of usage examples for java.awt Color Color
public Color(ColorSpace cspace, float[] components, float alpha)
From source file:org.fhcrc.cpl.viewer.mrm.Utils.java
public static Color paleColor(Color origColor) { int origRed = origColor.getRed(); int origGreen = origColor.getGreen(); int origBlue = origColor.getBlue(); int maxColorVal = Math.max(Math.max(origRed, origGreen), origBlue); if (maxColorVal + PALE_CONSTANT > 255) { int adjust = (maxColorVal + PALE_CONSTANT) - 255; origRed = Math.max(0, origRed - adjust); origGreen = Math.max(0, origGreen - adjust); origBlue = Math.max(0, origBlue - adjust); }// w ww.j av a2 s. c o m Color paleColor = new Color(origRed + PALE_CONSTANT, origGreen + PALE_CONSTANT, origBlue + PALE_CONSTANT); return paleColor; }
From source file:grafix.graficos.indices.IndiceADX.java
@Override public void plotar(final XYPlot plot, final JanelaGraficos janela, final int contador) { XYLineAndShapeRenderer r = new XYLineAndShapeRenderer(); r.setSeriesLinesVisible(0, true);/*w w w.j a v a2 s.co m*/ r.setSeriesShapesVisible(0, false); r.setSeriesPaint(0, Color.BLUE); r.setSeriesStroke(0, new BasicStroke(.75f)); r.setSeriesPaint(1, Color.RED); r.setSeriesStroke(1, new BasicStroke(.6f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 3.0f, 4.0f }, 0.0f)); r.setSeriesLinesVisible(1, true); r.setSeriesShapesVisible(1, false); r.setSeriesPaint(2, new Color(0f, .6f, 0f)); r.setSeriesStroke(2, new BasicStroke(.6f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 2.0f, new float[] { 3.0f, 4.0f }, 0.0f)); r.setSeriesLinesVisible(2, true); r.setSeriesShapesVisible(2, false); r.setToolTipGenerator(new IndiceToolTipGenerator(this)); plot.setRenderer(contador, r); plot.setDataset(contador, getDataSet(janela)); }
From source file:view.GerarGrafico.java
private JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Grfico de Transaes", // chart title dataset, // data true, // include legend true, false// w ww . j a v a 2 s . c o m ); PiePlot plot = (PiePlot) chart.getPlot(); plot.setSectionPaint("Provento", new Color(68, 157, 68)); plot.setSectionPaint("Despesa", new Color(217, 83, 79)); plot.setLabelFont(new Font("Segoue UI", Font.PLAIN, 12)); plot.setNoDataMessage("No data available"); plot.setCircular(false); plot.setLabelGap(0.02); return chart; }
From source file:jflowmap.JFlowMapApplet.java
public JFlowMapApplet() { instantiated = true;// ww w.j ava 2 s .c o m if (!JFlowMapMain.IS_OS_MAC) { SwingUtils.initNimbusLF(); UIDefaults defaults = UIManager.getLookAndFeelDefaults(); // defaults.put("Panel.background", new Color(0xf0, 0xf0, 0xf0)); // defaults.put("TabbedPane.background", new Color(0xf0, 0xf0, 0xf0)); defaults.put("background", new Color(0xf0, 0xf0, 0xf0)); defaults.put("defaultFont", new Font("Arial", Font.PLAIN, 14)); } blockingGlassPane = new BlockingGlassPane(); setGlassPane(blockingGlassPane); blockingGlassPane.setVisible(false); }
From source file:net.noday.core.utils.Captcha.java
private static Color randColor(int fc, int bc) { if (fc > 255) fc = 255;//from w ww .j a v a 2 s .c om if (bc > 255) bc = 255; int r = fc + random.nextInt(bc - fc); int g = fc + random.nextInt(bc - fc); int b = fc + random.nextInt(bc - fc); return new Color(r, g, b); }
From source file:ch.unibe.iam.scg.archie.ui.charts.ConsultationNumberChart.java
/** * @see ch.unibe.iam.scg.archie.ui.charts.AbstractChartComposite# * initializeChart()//from w ww. j a v a 2 s . co m */ @Override protected JFreeChart initializeChart() { JFreeChart chart = ChartFactory.createTimeSeriesChart(ConsultationNumberChart.CHART_TITLE, // title "", // x-axis label "Count", // y-axis label (XYDataset) this.creator.getDataset(), // data false, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(new Color(this.parent.getBackground().getRed(), this.parent.getBackground().getGreen(), this.parent.getBackground().getBlue())); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); return chart; }
From source file:org.xwiki.chart.internal.DrawingSupplierFactory.java
/** * @param parameters the user-defined parameters, containing {@link ChartGenerator#COLORS_PARAM} if the user * wants custom colors// w w w. j ava2 s . co m * @return the Drawing Supplier to use */ public DrawingSupplier createDrawingSupplier(Map<String, String> parameters) { DrawingSupplier supplier; String colorParam = parameters.get(ChartGenerator.COLORS_PARAM); if (colorParam != null) { List<Color> colors = new ArrayList<Color>(); for (String colorAsString : colorParam.split(",")) { if (colorAsString.length() == 6) { int red = Integer.parseInt(colorAsString.substring(0, 2), 16); int green = Integer.parseInt(colorAsString.substring(2, 4), 16); int blue = Integer.parseInt(colorAsString.substring(4, 6), 16); colors.add(new Color(red, green, blue)); } } Paint[] paint = new Paint[colors.size()]; int i = 0; for (Color color : colors) { paint[i++] = color; } supplier = new DefaultDrawingSupplier(paint, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); } else { supplier = new DefaultDrawingSupplier(); } return supplier; }
From source file:gui.MainForm.java
private static JFreeChart create_AMS_DATA_Chart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("AMS??", "", "??", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainGridlinesVisible(true); categoryplot.setRangeCrosshairVisible(true); categoryplot.setRangeCrosshairPaint(Color.blue); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setDrawBarOutline(false); GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64)); GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0)); GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0)); barrenderer.setSeriesPaint(0, gradientpaint); barrenderer.setSeriesPaint(1, gradientpaint1); barrenderer.setSeriesPaint(2, gradientpaint2); barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D)); return jfreechart; }
From source file:ColorMenu.java
public ColorMenu(String name) { super(name);// www. j a v a 2 s . c o m _unselectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, getBackground()), new BevelBorder(BevelBorder.LOWERED, Color.WHITE, Color.GRAY)); _selectedBorder = new CompoundBorder(new MatteBorder(2, 2, 2, 2, Color.RED), new MatteBorder(1, 1, 1, 1, getBackground())); _activeBorder = new CompoundBorder(new MatteBorder(2, 2, 2, 2, Color.BLUE), new MatteBorder(1, 1, 1, 1, getBackground())); JPanel p = new JPanel(); p.setBorder(new EmptyBorder(5, 5, 5, 5)); p.setLayout(new GridLayout(8, 8)); _colorPanes = new HashMap(); int values[] = new int[] { 0, 128, 192, 255 }; for (int r = 0; r < values.length; r++) for (int g = 0; g < values.length; g++) for (int b = 0; b < values.length; b++) { Color color = new Color(values[r], values[g], values[b]); ColorPane colorPane = new ColorPane(color); p.add(colorPane); _colorPanes.put(color, colorPane); } add(p); }
From source file:com.etest.view.tq.charts.GraphicalInventoryBarChart.java
public GraphicalInventoryBarChart() { setModal(true);//w w w . jav a2 s.co m VerticalLayout v = new VerticalLayout(); v.setMargin(true); // Panel panel = new Panel(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Curriculum c : cs.getAllCurriculum()) { for (int i = 0; i < 2; i++) { if (i == 0) { dataset.addValue(rs.getTotalCasesBySubject(c.getCurriculumId()), "Cases", c.getSubject()); } else { dataset.addValue(rs.getTotalItemsBySubject(c.getCurriculumId()), "Items", c.getSubject()); } } } JFreeChart chart = ChartFactory.createBarChart("Inventory of Items and Cases", "Subjects", "", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); Color color; for (int i = 0; i < dataset.getRowCount(); i++) { if (i % 2 == 0) { renderer.setSeriesPaint(i, new Color(0, 0, 255)); } else { renderer.setSeriesPaint(i, new Color(255, 0, 0)); } } // JFreeChartWrapper wrapper = new JFreeChartWrapper(chart){ // // @Override // public void attach(){ // super.attach(); // setResource("src", getSource()); // } // // }; v.addComponent(new ReportChartWrapper(chart, null, null)); v.setWidthUndefined(); v.setHeightUndefined(); setContent(v); getContent().setWidthUndefined(); getContent().setHeightUndefined(); center(); }