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:ch.epfl.leb.sass.ijplugin.SimulatorStatusFrame.java
/** * Creates a new status frame.//from ww w. java 2 s . c o m * * @param groundTruthYLabel The y-axis label for the ground truth signal. * @param analyzerYLabel The units output by the analyzer. * @param setpointYLabel The units of the controller setpoint. * @param outputYLabel The units output by the controller. */ public SimulatorStatusFrame(String groundTruthYLabel, String analyzerYLabel, String setpointYLabel, String outputYLabel) { String seriesLabel = ""; String yLabel = ""; CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(new NumberAxis("Simulation Outputs")); Font yLabelFont = new Font("Dialog", Font.PLAIN, 10); datasets = new XYSeriesCollection[4]; for (int i = 0; i < SUBPLOT_COUNT; i++) { switch (i) { case 0: seriesLabel = "True density"; yLabel = groundTruthYLabel; break; case 1: seriesLabel = "Analyzer output"; yLabel = analyzerYLabel; break; case 2: seriesLabel = "Setpoint"; yLabel = setpointYLabel; break; case 3: seriesLabel = "Controller output"; yLabel = outputYLabel; break; } XYSeries timeseries = new XYSeries(seriesLabel); datasets[i] = new XYSeriesCollection(timeseries); NumberAxis numberaxis = new NumberAxis(yLabel); numberaxis.setAutoRangeIncludesZero(false); numberaxis.setNumberFormatOverride(new DecimalFormat("###0.00")); XYPlot xyplot = new XYPlot(datasets[i], null, numberaxis, new StandardXYItemRenderer()); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.getRangeAxis().setLabelFont(yLabelFont); combineddomainxyplot.add(xyplot); } JFreeChart jfreechart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, combineddomainxyplot, true); jfreechart.setBorderPaint(Color.black); jfreechart.setBorderVisible(true); jfreechart.setBackgroundPaint(Color.white); combineddomainxyplot.setBackgroundPaint(Color.lightGray); combineddomainxyplot.setDomainGridlinePaint(Color.white); combineddomainxyplot.setRangeGridlinePaint(Color.white); ValueAxis valueaxis = combineddomainxyplot.getDomainAxis(); valueaxis.setAutoRange(true); // Number of frames to display valueaxis.setFixedAutoRange(2000D); ChartPanel chartpanel = new ChartPanel(jfreechart); chartpanel.setPreferredSize(new Dimension(800, 500)); chartpanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chartpanel.setVisible(true); JPanel jPanel = new JPanel(); jPanel.setLayout(new BorderLayout()); jPanel.add(chartpanel, BorderLayout.NORTH); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); add(jPanel); pack(); setVisible(true); }
From source file:edu.ucla.stat.SOCR.chart.SuperNormalDistributionChart.java
/** * Creates a chart./*from w ww . ja v a 2s. co m*/ * * @param dataset the dataset. * * @return a chart. */ protected JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title domainLabel, // x axis label rangeLabel, // y axis label dataset, // data PlotOrientation.VERTICAL, !legendPanelOn, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:max.hubbard.Factoring.Graphing.java
public static void makeGraphingInterface() { Interface.mainInterface();//from www .ja v a2 s . com panel = new JPanel(new BorderLayout(3, 225)); JPanel pan = new JPanel(); JLabel area = new JLabel("Graphing"); area.setBackground(Color.lightGray); area.setFont(new Font("Times New Roman", Font.BOLD, 20)); pan.add(area, BorderLayout.CENTER); panel.add(pan, BorderLayout.NORTH); final JTextField field = new JTextField(); panel.add(field, BorderLayout.CENTER); field.setFont(new Font("Times New Roman", Font.BOLD, 25)); field.setText("x^4-2x^2-8"); JButton start = new JButton("GO!"); start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panel.updateUI(); Main.label.setText(""); graph(field.getText()); } }); panel.add(start, BorderLayout.SOUTH); Main.getFrame().add(panel, BorderLayout.EAST); Main.getFrame().pack(); }
From source file:edu.coeia.charts.LineChartPanel.java
/** * Creates a sample chart.//from w ww . ja v a 2s.c o m * * @param dataset a dataset. * * @return The chart. */ private static JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createLineChart("Frequency of Messages", // chart title "Time of Messages", // domain axis label "Number of Messages", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); // customise the range axis... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); // customise the renderer... final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f)); renderer.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); renderer.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); return chart; }
From source file:org.jfree.chart.demo.DynamicDataDemo2.java
/** * Constructs a new demonstration application. * * @param title the frame title.//w w w .ja v a 2 s . c o m */ public DynamicDataDemo2(final String title) { super(title); this.series1 = new TimeSeries("Random 1", Millisecond.class); this.series2 = new TimeSeries("Random 2", Millisecond.class); final TimeSeriesCollection dataset1 = new TimeSeriesCollection(this.series1); final TimeSeriesCollection dataset2 = new TimeSeriesCollection(this.series2); final JFreeChart chart = ChartFactory.createTimeSeriesChart("Dynamic Data Demo 2", "Time", "Value", dataset1, true, true, false); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4)); final ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(60000.0); // 60 seconds plot.setDataset(1, dataset2); final NumberAxis rangeAxis2 = new NumberAxis("Range Axis 2"); rangeAxis2.setAutoRangeIncludesZero(false); plot.setRenderer(1, new DefaultXYItemRenderer()); plot.setRangeAxis(1, rangeAxis2); plot.mapDatasetToRangeAxis(1, 1); final JPanel content = new JPanel(new BorderLayout()); final ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel); final JButton button1 = new JButton("Add To Series 1"); button1.setActionCommand("ADD_DATA_1"); button1.addActionListener(this); final JButton button2 = new JButton("Add To Series 2"); button2.setActionCommand("ADD_DATA_2"); button2.addActionListener(this); final JButton button3 = new JButton("Add To Both"); button3.setActionCommand("ADD_BOTH"); button3.addActionListener(this); final JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(button1); buttonPanel.add(button2); buttonPanel.add(button3); content.add(buttonPanel, BorderLayout.SOUTH); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(content); }
From source file:com.ace.capitalflows.ui.frame.chart.NianYdChart.java
/** * Creates a chart./*w w w. j a v a 2s .c om*/ * * @param dataset a dataset. * * @return A chart. */ private static JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("ZhongGuoGuoJiShouZhiPingHeBiao(NianDuCeSuan)", // title "NianYd", // x-axis label "YiMeiYuan", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); final XYPlot plot = (XYPlot) chart.getPlot(); 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); final XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM")); return chart; }
From source file:imc.graficaIMC.java
public graficaIMC() { TimeSeries s1 = new TimeSeries("REGISTRO DE IMC "); datos.removeAllSeries();//ww w . j a v a2 s. c o m //sxy.add(x[0], y[0]); pesos = new double[imc.imc.length]; fecha = new String[imc.fecha.length]; pesos = imc.imc; fecha = imc.fecha; ///////////////77 Date fechaDate = null; int n = pesos.length; Calendar calendar = Calendar.getInstance(); for (int i = 0; i < n; i++) { // JOptionPane.showMessageDialog(null, "fecha tio:"+fecha[i]); try { fechaDate = formato.parse(fecha[i]); calendar.setTime(fechaDate); } catch (ParseException ex) { } // JOptionPane.showMessageDialog(null, calendar.get(Calendar.DAY_OF_MONTH)+" "+calendar.get(Calendar.MONTH)+1+" "+ calendar.get(Calendar.YEAR)); s1.add(new Day(calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.YEAR)), pesos[i]); // System.out.print(x[i]+"-"+i+" "); } datos.addSeries(s1); grafica = ChartFactory.createTimeSeriesChart("Progreso de MCM", "Fecha", "IMC", datos, true, true, false); /// grafica.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) grafica.getPlot(); 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.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); }
From source file:com.ace.capitalflows.ui.frame.chart.NianJdChart.java
/** * Creates a chart./*from ww w .ja v a2s . co m*/ * * @param dataset a dataset. * * @return A chart. */ private static JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("ZhongGuoGuoJiShouZhiPingHeBiao(NianDuCeSuan)", // title "NianJd", // x-axis label "YiMeiYuan", // y-axis label dataset, // data true, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(Color.white); final XYPlot plot = (XYPlot) chart.getPlot(); 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); final XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM")); return chart; }
From source file:edu.uci.ics.jung.samples.AnimatingAddNodeDemo.java
@Override public void init() { //create a graph Graph<Number, Number> ig = Graphs .<Number, Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number, Number>()); ObservableGraph<Number, Number> og = new ObservableGraph<Number, Number>(ig); og.addGraphEventListener(new GraphEventListener<Number, Number>() { public void handleGraphEvent(GraphEvent<Number, Number> evt) { System.err.println("got " + evt); }/*from ww w . ja va 2 s. com*/ }); this.g = og; //create a graphdraw layout = new FRLayout<Number, Number>(g); layout.setSize(new Dimension(600, 600)); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); Layout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout); vv = new VisualizationViewer<Number, Number>(staticLayout, new Dimension(600, 600)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 12)); vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>()); vv.setForeground(Color.white); vv.addComponentListener(new ComponentAdapter() { /** * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent) */ @Override public void componentResized(ComponentEvent arg0) { super.componentResized(arg0); System.err.println("resized"); layout.setSize(arg0.getComponent().getSize()); } }); getContentPane().add(vv); switchLayout = new JButton("Switch to SpringLayout"); switchLayout.addActionListener(new ActionListener() { @SuppressWarnings({ "unchecked", "rawtypes" }) public void actionPerformed(ActionEvent ae) { Dimension d = vv.getSize();//new Dimension(600,600); if (switchLayout.getText().indexOf("Spring") > 0) { switchLayout.setText("Switch to FRLayout"); layout = new SpringLayout<Number, Number>(g, new ConstantTransformer(EDGE_LENGTH)); layout.setSize(d); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); StaticLayout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout); LayoutTransition<Number, Number> lt = new LayoutTransition<Number, Number>(vv, vv.getGraphLayout(), staticLayout); Animator animator = new Animator(lt); animator.start(); // vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } else { switchLayout.setText("Switch to SpringLayout"); layout = new FRLayout<Number, Number>(g, d); layout.setSize(d); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); StaticLayout<Number, Number> staticLayout = new StaticLayout<Number, Number>(g, layout); LayoutTransition<Number, Number> lt = new LayoutTransition<Number, Number>(vv, vv.getGraphLayout(), staticLayout); Animator animator = new Animator(lt); animator.start(); // vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } } }); getContentPane().add(switchLayout, BorderLayout.SOUTH); timer = new Timer(); }
From source file:org.jfree.chart.demo.DynamicDataDemo3.java
/** * Constructs a new demonstration application. * * @param title the frame title./*from w w w .ja va2s. c o m*/ */ public DynamicDataDemo3(final String title) { super(title); final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.datasets = new TimeSeriesCollection[SUBPLOT_COUNT]; for (int i = 0; i < SUBPLOT_COUNT; i++) { this.lastValue[i] = 100.0; final TimeSeries series = new TimeSeries("Random " + i, Millisecond.class); this.datasets[i] = new TimeSeriesCollection(series); final NumberAxis rangeAxis = new NumberAxis("Y" + i); rangeAxis.setAutoRangeIncludesZero(false); final XYPlot subplot = new XYPlot(this.datasets[i], null, rangeAxis, new StandardXYItemRenderer()); subplot.setBackgroundPaint(Color.lightGray); subplot.setDomainGridlinePaint(Color.white); subplot.setRangeGridlinePaint(Color.white); plot.add(subplot); } final JFreeChart chart = new JFreeChart("Dynamic Data Demo 3", plot); // chart.getLegend().setAnchor(Legend.EAST); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4)); final ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(60000.0); // 60 seconds final JPanel content = new JPanel(new BorderLayout()); final ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel); final JPanel buttonPanel = new JPanel(new FlowLayout()); for (int i = 0; i < SUBPLOT_COUNT; i++) { final JButton button = new JButton("Series " + i); button.setActionCommand("ADD_DATA_" + i); button.addActionListener(this); buttonPanel.add(button); } final JButton buttonAll = new JButton("ALL"); buttonAll.setActionCommand("ADD_ALL"); buttonAll.addActionListener(this); buttonPanel.add(buttonAll); content.add(buttonPanel, BorderLayout.SOUTH); chartPanel.setPreferredSize(new java.awt.Dimension(500, 470)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setContentPane(content); }