List of usage examples for java.awt Color lightGray
Color lightGray
To view the source code for java.awt Color lightGray.
Click Source Link
From source file:st.jigasoft.dbutil.util.ReportTheme.java
public static void crescentTheme(JFreeChart chart, String... lineNames) { XYPlot plot = (XYPlot) chart.getPlot(); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); 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.setStroke(new BasicStroke(3)); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); }/*from ww w.j a v a2 s . c o m*/ DateAxis axis = (DateAxis) plot.getDomainAxis(); /* chart.setBackgroundPaint(new GradientPaint(new Point(0, 0), Color.decode("#121E31"), new Point(400, 200), Color.DARK_GRAY)); plot.setBackgroundPaint(null); //plot.setInteriorGap(0.04); plot.setOutlineVisible(false); int iCount = 0; // use gradients and white borders for the section colours for(Object s : lineNames) { // plot.setDomainGridlinePaint(new PrintColorUIResource(25, Color.CYAN)));//s.toString(), createGradientPaint(new Color(200, 200, 255), colorItems(iCount ++))); if(iCount == MAX_COLUNS_COLOR) iCount = 0; } // // add a subtitle giving the data source TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523", new Font("Courier New", Font.PLAIN, 12)); source.setPaint(Color.WHITE); source.setPosition(RectangleEdge.BOTTOM); source.setHorizontalAlignment(HorizontalAlignment.RIGHT); chart.addSubtitle(source); */ }
From source file:org.mwc.debrief.sensorfusion.views.DataSupport.java
/** * Creates a chart.//from w ww.j av a 2 s. c om * * @param dataset * a dataset. * * @return A chart. */ public static JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Bearing Management", // title "Time", // x-axis label "Bearing", // y-axis label dataset, // data false, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); final XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.setOrientation(PlotOrientation.HORIZONTAL); final XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); } final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("HH:mm.ss")); return chart; }
From source file:org.mwc.cmap.grideditor.chart.ChartBuilder.java
public JFreeChart buildChart() { final ValueAxis xAxis = myManager.createXAxis(); final ValueAxis yAxis = myManager.createYAxis(); final XYDataset data = myManager.getXYDataSet(); final XYLineAndShapeRenderer renderer = new ColorRenderer(); final XYPlot xyplot = new XYPlot(data, xAxis, yAxis, renderer); xyplot.setOrientation(PlotOrientation.HORIZONTAL); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); final JFreeChart result = new JFreeChart(myManager.getChartTitle(), JFreeChart.DEFAULT_TITLE_FONT, xyplot, false);/*w ww.j a v a 2s .c o m*/ ChartUtilities.applyCurrentTheme(result); return result; }
From source file:Clock.java
public void paint(Graphics g) { int xhour, yhour, xminute, yminute, xsecond, ysecond, second, minute, hour; drawStructure(g);//from w ww .ja v a2 s.co m currentDate = new Date(); formatter.applyPattern("s"); second = Integer.parseInt(formatter.format(currentDate)); formatter.applyPattern("m"); minute = Integer.parseInt(formatter.format(currentDate)); formatter.applyPattern("h"); hour = Integer.parseInt(formatter.format(currentDate)); xsecond = (int) (Math.cos(second * 3.14f / 30 - 3.14f / 2) * 45 + xcenter); ysecond = (int) (Math.sin(second * 3.14f / 30 - 3.14f / 2) * 45 + ycenter); xminute = (int) (Math.cos(minute * 3.14f / 30 - 3.14f / 2) * 40 + xcenter); yminute = (int) (Math.sin(minute * 3.14f / 30 - 3.14f / 2) * 40 + ycenter); xhour = (int) (Math.cos((hour * 30 + minute / 2) * 3.14f / 180 - 3.14f / 2) * 30 + xcenter); yhour = (int) (Math.sin((hour * 30 + minute / 2) * 3.14f / 180 - 3.14f / 2) * 30 + ycenter); // Erase if necessary, and redraw g.setColor(Color.lightGray); if (xsecond != lastxs || ysecond != lastys) { g.drawLine(xcenter, ycenter, lastxs, lastys); } if (xminute != lastxm || yminute != lastym) { g.drawLine(xcenter, ycenter - 1, lastxm, lastym); g.drawLine(xcenter - 1, ycenter, lastxm, lastym); } if (xhour != lastxh || yhour != lastyh) { g.drawLine(xcenter, ycenter - 1, lastxh, lastyh); g.drawLine(xcenter - 1, ycenter, lastxh, lastyh); } g.setColor(Color.darkGray); g.drawLine(xcenter, ycenter, xsecond, ysecond); g.setColor(Color.red); g.drawLine(xcenter, ycenter - 1, xminute, yminute); g.drawLine(xcenter - 1, ycenter, xminute, yminute); g.drawLine(xcenter, ycenter - 1, xhour, yhour); g.drawLine(xcenter - 1, ycenter, xhour, yhour); lastxs = xsecond; lastys = ysecond; lastxm = xminute; lastym = yminute; lastxh = xhour; lastyh = yhour; }
From source file:TextLayoutPanel.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; AffineTransform at = AffineTransform.getTranslateInstance(rx, ry); Shape hilight = layout.getLogicalHighlightShape(hit1, hit2); hilight = at.createTransformedShape(hilight); g2.setColor(Color.lightGray); g2.fill(hilight);//from w w w.ja va 2 s.c o m g2.setColor(Color.black); layout.draw(g2, rx, ry); // Draw caret Shape[] caretShapes = layout.getCaretShapes(hit1); Shape caret = at.createTransformedShape(caretShapes[0]); g2.setColor(caretColor); g2.draw(caret); }
From source file:max.hubbard.Factoring.Graphing.java
private static JFreeChart createChart(final XYDataset dataset, String equation) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart(equation, // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );/* ww w . j a v a 2 s . c o m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, true); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(new Range(-50, 50)); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:aka.pirana.jdoc.JChart.java
private JPanel createChartPanel() { NumberAxis numberaxis = new NumberAxis("Date"); numberaxis.setAutoRangeIncludesZero(false); NumberAxis numberaxis1 = new NumberAxis("%"); numberaxis1.setAutoRangeIncludesZero(false); XYSplineRenderer xysplinerenderer = new XYSplineRenderer(); XYPlot xyplot = new XYPlot(SampleGenerator(), numberaxis, numberaxis1, xysplinerenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); JFreeChart jfreechart = new JFreeChart("JDocSplineRenderer", JFreeChart.DEFAULT_TITLE_FONT, xyplot, true); ChartUtilities.applyCurrentTheme(jfreechart); ChartPanel chartpanel = new ChartPanel(jfreechart); return chartpanel; }
From source file:TextLayoutWithMouseClickDrag.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; AffineTransform at = AffineTransform.getTranslateInstance(rx, ry); Shape hilight = layout.getLogicalHighlightShape(hit1, hit2); hilight = at.createTransformedShape(hilight); g2.setColor(Color.lightGray); g2.fill(hilight);//from ww w . ja v a 2 s . com g2.setColor(Color.black); layout.draw(g2, rx, ry); Shape[] caretShapes = layout.getCaretShapes(hit1); Shape caret = at.createTransformedShape(caretShapes[0]); g2.setColor(caretColor); g2.draw(caret); }
From source file:com.etest.view.tq.charts.SubjectTestLineChart.java
public static JFreeChart difficultIndex(int tqCoverageId) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (CellItem ci : CellItemDAO.getItemAnalysisResult(tqCoverageId)) { dataset.setValue((int) (ci.getDifficultIndex() * 100), "Difficulty Index", String.valueOf(ci.getItemNo())); }/*from w ww . java2 s . c o m*/ JFreeChart chart = ChartFactory.createLineChart("Item Analysis Report", "Item No.", "Difficulty Index (%)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // customise the renderer... LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setFillPaint(Color.white); return chart; }
From source file:com.google.code.facebook.graph.sna.applet.VisualizationImageServerDemo.java
/** * //w w w .j ava2s . c o m */ public VisualizationImageServerDemo() { // create a simple graph for the demo graph = new DirectedSparseMultigraph<String, Number>(); String[] v = createVertices(10); createEdges(v); vv = new VisualizationImageServer<String, Number>(new KKLayout<String, Number>(graph), new Dimension(600, 600)); vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<String, Number>(Color.white, Color.red, Color.white, Color.blue, vv.getPickedVertexState(), false)); vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Image im = vv.getImage(new Point2D.Double(300, 300), new Dimension(600, 600)); Icon icon = new ImageIcon(im); JLabel label = new JLabel(icon); content.add(label); frame.pack(); frame.setVisible(true); }