List of usage examples for java.awt Color LIGHT_GRAY
Color LIGHT_GRAY
To view the source code for java.awt Color LIGHT_GRAY.
Click Source Link
From source file:net.sf.dynamicreports.jasper.builder.JasperConcatenatedReportBuilder.java
public JasperConcatenatedReportBuilder toPng(OutputStream outputStream, float zoom) throws DRException { Validate.notNull(outputStream, "outputStream must not be null"); Validate.isTrue(zoom > 0, "zoom must be > 0"); int maxWidth = 0; int maxHeight = 0; for (JasperPrint jasperPrint : jasperReportHandler.getPrintList()) { int pages = jasperPrint.getPages().size(); int pageWidth = (int) (jasperPrint.getPageWidth() * zoom); maxWidth += pageWidth * pages + (pages - 1) + 2; int height = (int) (jasperPrint.getPageHeight() * zoom) + 2; if (height > maxHeight) { maxHeight = height;// w w w . j a v a 2 s .c o m } } Image pageImage = new BufferedImage(maxWidth, maxHeight, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = (Graphics2D) pageImage.getGraphics(); g2d.setColor(Color.LIGHT_GRAY); g2d.fill(new Rectangle2D.Float(1, 1, maxWidth - 1, maxHeight - 1)); int offset = 1; for (JasperPrint jasperPrint : jasperReportHandler.getPrintList()) { int pageWidth = (int) (jasperPrint.getPageWidth() * zoom); for (int i = 0; i < jasperPrint.getPages().size(); i++) { try { JRGraphics2DExporter exporter = new JRGraphics2DExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics()); exporter.setParameter(JRGraphics2DExporterParameter.OFFSET_X, offset); exporter.setParameter(JRGraphics2DExporterParameter.OFFSET_Y, 1); exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(i)); exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoom)); exporter.exportReport(); offset += pageWidth + 1; } catch (JRException e) { throw new DRException(e); } } } try { ImageIO.write((RenderedImage) pageImage, "png", outputStream); } catch (IOException e) { throw new DRException(e); } return this; }
From source file:at.tuwien.ifs.somtoolbox.visualization.ClusterConnectionsVisualizer.java
/** Gets the colour representing a certain distance value. */ private Color getColor(double distance) { if (distance <= t1) { return Color.BLACK; } else if (distance > t1 && distance <= t2) { return Color.GRAY; } else if (distance > t2 && distance <= t3) { return Color.LIGHT_GRAY; } else if (distance > t3) { return Color.WHITE; } else {// ww w . j a v a 2s . co m throw new IllegalStateException("This can't happen."); } }
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:net.sf.dynamicreports.test.jasper.chart.GanttChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*www . jav a2 s.co m*/ JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", GanttRenderer.class, categoryPlot.getRenderer().getClass()); Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible()); Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible()); Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible()); ganttChartDataTest(chart, "label", new String[] { "task1", "task2", "task3" }, new Object[][] { { toDate(2011, 1, 1), toDate(2011, 1, 8), 1d }, { toDate(2011, 1, 10), toDate(2011, 1, 15), 0.5d }, { toDate(2011, 1, 15), toDate(2011, 1, 25), 0.8d } }); ganttChartDataTest(chart, "serie1", new String[] { "task1", "task2", "task3" }, new Object[][] { { toDate(2011, 1, 2), toDate(2011, 1, 9), null }, { toDate(2011, 1, 8), toDate(2011, 1, 14), null }, { toDate(2011, 1, 16), toDate(2011, 1, 20), null } }); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); Assert.assertEquals("task label", "task", axis.getLabel()); Assert.assertEquals("task label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("task label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions() .getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("time label", "time", axis.getLabel()); Assert.assertEquals("time label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("time label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); }
From source file:Main_Window.java
public Main_Window() { super("Google Places Application"); //First call Constructor of JFrame this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //We do not want our application to terminate when a JFrame is closed this.addWindowListener(new java.awt.event.WindowAdapter() { @Override/* ww w . ja v a 2 s. c om*/ public void windowClosing(java.awt.event.WindowEvent windowEvent) { int Answer = JOptionPane.showConfirmDialog(null, "Exit Application ? ", "Exit ? ", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (Answer == JOptionPane.YES_OPTION) { if (POI_List.isEmpty()) { POI_List.clear(); } if (Distances_List.isEmpty()) { Distances_List.clear(); } if (Temp_List.isEmpty()) { Temp_List.clear(); } if (Distances_List_2.isEmpty()) { Distances_List_2.clear(); } System.exit(1); } else { setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); } } }); //The listener object created from that class is then registered with a Window using the window's addWindowListener method. // this.setSize(1100, 700); // Size of Window this.setLocationRelativeTo(null); // Display Window in center of Screen this.setVisible(true); this.getContentPane().setBackground(Color.LIGHT_GRAY); // //Initialization of J Components POIS_Label = new JLabel("Points of Interest:"); POIS_Label.setForeground(Color.black); POIS_Label.setFont(new Font("Courier New", Font.BOLD, 25)); POIS_Label.setBounds(600, 30, 350, 150); Retrieve_POIs_Button = new JButton("Retrieve POIs"); Retrieve_POIs_Button.setForeground(Color.black); Retrieve_POIs_Button.setFont(new Font("Courier New", Font.BOLD, 35)); Retrieve_POIs_Button.setBounds(25, 450, 350, 150); Open_Status = new JRadioButton(" Open Now?"); Open_Status.setForeground(Color.black); Open_Status.setBackground(Color.LIGHT_GRAY); Open_Status.setBounds(20, 380, 100, 30); Welcome_Label = new JLabel("Welcome to Google Places"); Welcome_Label.setForeground(Color.BLUE); Welcome_Label.setFont(new Font("Courier New", Font.BOLD, 35)); Welcome_Label.setBounds(240, 20, 600, 60); Latitude_Label = new JLabel("Latitude:"); Latitude_Label.setForeground(Color.BLACK); Latitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Latitude_Label.setBounds(15, 80, 200, 100); Longitude_Label = new JLabel("Longitude:"); Longitude_Label.setForeground(Color.BLACK); Longitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Longitude_Label.setBounds(15, 130, 250, 100); Radius_Label = new JLabel("Radius:"); Radius_Label.setForeground(Color.BLACK); Radius_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Radius_Label.setBounds(15, 180, 250, 100); Category_Label = new JLabel("Category:"); Category_Label.setForeground(Color.BLACK); Category_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Category_Label.setBounds(15, 250, 250, 100); Latitude_TextField = new JTextField(7); Latitude_TextField.setForeground(Color.BLACK); Latitude_TextField.setBounds(165, 116, 180, 30); Longitude_TextField = new JTextField(7); Longitude_TextField.setForeground(Color.BLACK); Longitude_TextField.setBounds(170, 168, 180, 30); Radius_TextField = new JTextField(7); Radius_TextField.setForeground(Color.BLACK); Radius_TextField.setBounds(125, 215, 180, 30); Categories = new JComboBox(Categories_Names); Categories.setForeground(Color.BLACK); Categories.setBackground(Color.white); Categories.setBounds(15, 320, 180, 30); POI_List = new ArrayList(); pane = getContentPane(); //Manager pane.setLayout(null); // Deactivate Manager Layout //JPANEL P = new JPanel(); P.setBackground(Color.GRAY); P.setBounds(600, 120, 450, 180); P.setBackground(Color.GRAY); pane.add(P); pane.add(POIS_Label); pane.add(Retrieve_POIs_Button); pane.add(Welcome_Label); pane.add(Longitude_Label); pane.add(Latitude_Label); pane.add(Radius_Label); pane.add(Category_Label); pane.add(Latitude_TextField); pane.add(Longitude_TextField); pane.add(Radius_TextField); pane.add(Categories); pane.add(Open_Status); Retrieve_POIs_Button.addActionListener(this); setContentPane(pane); }
From source file:net.sf.dynamicreports.test.jasper.chart.DifferenceChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*w ww . j av a 2 s. c o m*/ JFreeChart chart = getChart("summary.chart1", 0); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); Assert.assertEquals("renderer", XYDifferenceRenderer.class, renderer.getClass()); Assert.assertFalse("show shapes", ((XYDifferenceRenderer) renderer).getShapesVisible()); Assert.assertEquals("positive paint", Color.BLUE, ((XYDifferenceRenderer) renderer).getPositivePaint()); Assert.assertEquals("negative paint", Color.MAGENTA, ((XYDifferenceRenderer) renderer).getNegativePaint()); chart = getChart("summary.chart2", 0); Axis axis = chart.getXYPlot().getDomainAxis(); Assert.assertEquals("category label", "time", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); chart = getChart("summary.chart3", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); }
From source file:net.sf.smbt.ui.btc.views.AbstractBlockchainView.java
public void addCharts(Composite folder) { chart = ChartFactory.createXYStepChart(getChartTitle(), getXAxisLabel(), getYAxisLabel(), null, PlotOrientation.VERTICAL, true, // legend true, // tooltips false // urls );/*from w ww .j a va 2s . c o m*/ // then customise it a little... final XYPlot plot = chart.getXYPlot(); chart.getTitle().setPaint(Color.LIGHT_GRAY); chart.setBackgroundPaint(new java.awt.Color(66, 66, 66)); plot.setBackgroundPaint(new java.awt.Color(66, 66, 66)); plot.getRenderer().setSeriesVisibleInLegend(false); plot.getRangeAxis().setTickLabelPaint(Color.LIGHT_GRAY); plot.getRangeAxis().setLabelPaint(Color.LIGHT_GRAY); plot.getDomainAxis().setTickLabelPaint(Color.LIGHT_GRAY); plot.getDomainAxis().setLabelPaint(Color.LIGHT_GRAY); plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f)); // and present it in a frame... new ChartComposite(folder, SWT.NONE, chart, true); }
From source file:net.sf.dynamicreports.test.jasper.chart.CandlestickChartTest.java
@Override public void test() { super.test(); numberOfPagesTest(1);/*from ww w .j ava 2 s . c om*/ JFreeChart chart = getChart("summary.chart1", 0); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); Assert.assertEquals("renderer", CandlestickRenderer.class, renderer.getClass()); Assert.assertEquals("show volume", false, ((CandlestickRenderer) renderer).getDrawVolume()); highLowChartDataTest(chart, 0, new Object[][] { { "serie", date1, 50d, 35d, 40d, 47d, 70d }, { "serie", date2, 55d, 40d, 50d, 45d, 120d }, { "serie", date3, 48d, 41d, 42d, 47d, 90d } }); chart = getChart("summary.chart2", 0); Axis axis = chart.getXYPlot().getDomainAxis(); Assert.assertEquals("category label", "time", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); chart = getChart("summary.chart3", 0); axis = chart.getXYPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels()); }
From source file:com.rapidminer.gui.plotter.charts.SeriesChartPlotter.java
private JFreeChart createChart(XYDataset dataset, boolean createLegend) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, createLegend, // include legend true, // tooltips false // urls );//from ww w . jav a 2 s . c o m chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customization... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); DeviationRenderer renderer = new DeviationRenderer(true, false); // colors if (dataset.getSeriesCount() == 1) { renderer.setSeriesStroke(0, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); renderer.setSeriesPaint(0, getColorProvider().getPointColor(1.0d)); } else { // special case needed for avoiding devision by zero for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); renderer.setSeriesPaint(i, getColorProvider().getPointColor(1.0d - i / (double) (dataset.getSeriesCount() - 1))); } } // background for bounds if (plotBounds) { float[] dashArray = new float[] { 7, 14 }; renderer.setSeriesStroke(boundsSeriesIndex, new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, dashArray, 0)); renderer.setSeriesPaint(boundsSeriesIndex, Color.GRAY.brighter()); renderer.setSeriesFillPaint(boundsSeriesIndex, Color.GRAY); } // alpha renderer.setAlpha(0.25f); plot.setRenderer(renderer); NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); if (axis[INDEX] < 0) { xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits(Locale.US)); xAxis.setLabel(SERIESINDEX_LABEL); Range range = getRangeForName(SERIESINDEX_LABEL); if (range == null) { xAxis.setAutoRange(true); xAxis.setAutoRangeStickyZero(false); xAxis.setAutoRangeIncludesZero(false); } else { xAxis.setRange(range, true, false); } } else { xAxis.setLabel(dataTable.getColumnName(axis[INDEX])); Range range = getRangeForDimension(axis[INDEX]); if (range == null) { xAxis.setAutoRange(true); xAxis.setAutoRangeStickyZero(false); xAxis.setAutoRangeIncludesZero(false); } else { xAxis.setRange(range, true, false); } } xAxis.setLabelFont(LABEL_FONT_BOLD); xAxis.setTickLabelFont(LABEL_FONT); xAxis.setVerticalTickLabels(isLabelRotating()); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setLabel(VALUEAXIS_LABEL); yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US)); setYAxisRange(yAxis); yAxis.setLabelFont(LABEL_FONT_BOLD); yAxis.setTickLabelFont(LABEL_FONT); return chart; }
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.//w w w.jav a 2s .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; }