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:org.adempiere.webui.apps.graph.WPerformanceIndicator.java
/** * Init Graph Display/*from w w w . j a va2 s . co m*/ * Kinamo (pelgrim) */ private void init() { JFreeChart chart = createChart(); chart.setBackgroundPaint(Color.WHITE); chart.setBorderVisible(true); chart.setBorderPaint(Color.LIGHT_GRAY); chart.setAntiAlias(true); BufferedImage bi = chart.createBufferedImage(200, 120, BufferedImage.TRANSLUCENT, null); try { byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true); AImage image = new AImage("", bytes); Image myImage = new Image(); myImage.setContent(image); appendChild(myImage); } catch (Exception e) { // TODO: handle exception } invalidate(); }
From source file:com.itemanalysis.jmetrik.swing.GraphPanel.java
public void setXYPlotRendererWithPoints(XYPlot plot) { XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); int n = plot.getSeriesCount(); int half = (int) (n / 2.0); //assume first half are series for lines and second half are series for points for (int i = 0; i < n; i++) { if (i < half) { //Add lines Stroke stroke = new BasicStroke(lineWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, getLineStyle(i), 0.0f); renderer.setSeriesStroke(i, stroke); renderer.setSeriesPaint(i, getPaintColor(i)); renderer.setSeriesShapesFilled(i, false); renderer.setSeriesShapesVisible(i, showMarkers); renderer.setLegendLine(new Line2D.Double(0, 5, 40, 5)); renderer.setDrawSeriesLineAsPath(true); } else {//from ww w. j a v a 2 s .co m //Add points renderer.setSeriesLinesVisible(i, false); renderer.setSeriesShapesFilled(i, false); renderer.setSeriesShapesVisible(i, true); renderer.setSeriesPaint(i, getPaintColor(i - half)); } } plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRenderer(renderer); }
From source file:org.n52.io.type.quantity.handler.img.ChartIoHandler.java
private XYPlot createPlotArea(JFreeChart chart) { XYPlot plot = chart.getXYPlot();// ww w . ja v a 2 s .c om plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); showCrosshairsOnAxes(plot); configureDomainAxis(plot); showGridlinesOnChart(plot); configureTimeAxis(plot); configureTitle(chart); addNotice(chart); return plot; }
From source file:org.gumtree.vis.awt.PlotFactory.java
public static JFreeChart createXYErrorChart(IXYErrorDataset dataset) { JFreeChart chart;/*from w w w . j ava 2 s . c o m*/ String title = null; String xTitle = null; String yTitle = null; if (dataset != null) { title = ""; if (dataset.getTitle() != null) { title = dataset.getTitle(); } xTitle = ""; if (dataset.getXTitle() != null) { xTitle += dataset.getXTitle(); } if (dataset.getXUnits() != null) { xTitle += " (" + dataset.getXUnits() + ")"; } yTitle = ""; if (dataset.getYTitle() != null) { yTitle += dataset.getYTitle(); } if (dataset.getYUnits() != null) { yTitle += " (" + dataset.getYUnits() + ")"; } } else { dataset = new XYErrorDataset(); } chart = createXYLineChart(title, xTitle, yTitle, dataset, PlotOrientation.VERTICAL, true, false, true); chart.setBackgroundPaint(Color.WHITE); final LegendTitle legend = (LegendTitle) chart.getLegend(); RectangleEdge legendPosition = RectangleEdge.BOTTOM; try { String legendProperty = "RectangleEdge." + System.getProperty("kuranda1D.legendPosition"); if (RectangleEdge.BOTTOM.toString().equals(legendProperty)) legendPosition = RectangleEdge.BOTTOM; else if (RectangleEdge.RIGHT.toString().equals(legendProperty)) legendPosition = RectangleEdge.RIGHT; else if (RectangleEdge.LEFT.toString().equals(legendProperty)) legendPosition = RectangleEdge.LEFT; else if (RectangleEdge.TOP.toString().equals(legendProperty)) legendPosition = RectangleEdge.TOP; } catch (Exception e) { // TODO: handle exception } legend.setPosition(legendPosition); chart.setBorderVisible(true); // ChartUtilities.applyCurrentTheme(chart); // chartTheme.apply(chart); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); // plot.setRangeZeroBaselineVisible(false); // plot.setDomainZeroBaselineVisible(false); ValueAxis rangeAxis = plot.getRangeAxis(); if (rangeAxis instanceof NumberAxis) { ((NumberAxis) rangeAxis).setAutoRangeStickyZero(false); ((NumberAxis) rangeAxis).setAutoRangeIncludesZero(false); } ValueAxis domainAxis = plot.getDomainAxis(); if (domainAxis instanceof NumberAxis) { ((NumberAxis) domainAxis).setAutoRangeStickyZero(false); ((NumberAxis) domainAxis).setAutoRangeIncludesZero(false); } plot.setDomainPannable(true); plot.setRangePannable(true); plot.setDomainGridlinesVisible(true); // plot.setDomainCrosshairLockedOnData(true); // plot.setDomainCrosshairVisible(true); plot.setRangeGridlinesVisible(true); // plot.setRangeCrosshairLockedOnData(true); // plot.setRangeCrosshairVisible(true); // xAxis = plot.getDomainAxis(); // yAxis = plot.getRangeAxis(); plot.setDataset(dataset); XYItemRenderer renderer = chart.getXYPlot().getRenderer(); if (renderer instanceof XYErrorRenderer) { // ((XYLineAndShapeRenderer) renderer).setBaseShapesVisible(true); ((XYErrorRenderer) renderer).setBaseShapesFilled(true); ((XYErrorRenderer) renderer).setDrawXError(false); ((XYErrorRenderer) renderer).setDrawYError(true); } chart.fireChartChanged(); return chart; }
From source file:test.visualization.ClusteringDemo.java
private void setUpView(BufferedReader br) throws IOException { Factory<Number> vertexFactory = new Factory<Number>() { int n = 0; public Number create() { return n++; }/*from ww w . j a v a 2s . c o m*/ }; Factory<Number> edgeFactory = new Factory<Number>() { int n = 0; public Number create() { return n++; } }; PajekNetReader<Graph<Number, Number>, Number, Number> pnr = new PajekNetReader<Graph<Number, Number>, Number, Number>( vertexFactory, edgeFactory); final Graph<Number, Number> graph = new SparseMultigraph<Number, Number>(); pnr.load(br, graph); //Create a simple layout frame //specify the Fruchterman-Rheingold layout algorithm final AggregateLayout<Number, Number> layout = new AggregateLayout<Number, Number>( new FRLayout<Number, Number>(graph)); vv = new VisualizationViewer<Number, Number>(layout); vv.setBackground(Color.white); //Tell the renderer to use our own customized color rendering vv.getRenderContext() .setVertexFillPaintTransformer(MapTransformer.<Number, Paint>getInstance(vertexPaints)); vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Number, Paint>() { public Paint transform(Number v) { if (vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else { return Color.BLACK; } } }); vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints)); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() { protected final Stroke THIN = new BasicStroke(1); protected final Stroke THICK = new BasicStroke(2); public Stroke transform(Number e) { Paint c = edgePaints.get(e); if (c == Color.LIGHT_GRAY) return THIN; else return THICK; } }); //add restart button JButton scramble = new JButton("Restart"); scramble.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Layout layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); vv.setGraphMouse(gm); final JToggleButton groupVertices = new JToggleButton("Group Clusters"); //Create slider to adjust the number of edges to remove when clustering final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL); edgeBetweennessSlider.setBackground(Color.WHITE); edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50)); edgeBetweennessSlider.setPaintTicks(true); edgeBetweennessSlider.setMaximum(graph.getEdgeCount()); edgeBetweennessSlider.setMinimum(0); edgeBetweennessSlider.setValue(0); edgeBetweennessSlider.setMajorTickSpacing(10); edgeBetweennessSlider.setPaintLabels(true); edgeBetweennessSlider.setPaintTicks(true); // edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black)); //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):")); //I also want the slider value to appear final JPanel eastControls = new JPanel(); eastControls.setOpaque(true); eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS)); eastControls.add(Box.createVerticalGlue()); eastControls.add(edgeBetweennessSlider); final String COMMANDSTRING = "Edges removed for clusters: "; final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue(); final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize); eastControls.setBorder(sliderBorder); //eastControls.add(eastSize); eastControls.add(Box.createVerticalGlue()); groupVertices.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors, e.getStateChange() == ItemEvent.SELECTED); vv.repaint(); } }); clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected()); edgeBetweennessSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int numEdgesToRemove = source.getValue(); clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected()); sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue()); eastControls.repaint(); //vv.validate(); //vv.repaint(); } } }); Container content = getContentPane(); content.add(new GraphZoomScrollPane(vv)); JPanel south = new JPanel(); JPanel grid = new JPanel(new GridLayout(2, 1)); grid.add(scramble); grid.add(groupVertices); south.add(grid); south.add(eastControls); JPanel p = new JPanel(); p.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); p.add(gm.getModeComboBox()); south.add(p); content.add(south, BorderLayout.SOUTH); }
From source file:geovista.network.gui.ClusteringDemo.java
private void setUpView() throws IOException { /*/*from w ww . j a v a 2 s. c o m*/ * Factory<Integer> vertexFactory = new Factory<Integer>() { int n = 0; * public Integer create() { return n++; } }; Factory<Number> * edgeFactory = new Factory<Number>() { int n = 0; public Number * create() { return n++; } }; */ /* * PajekNetReader<Graph<Integer, Number>, Integer,Number> pnr = new * PajekNetReader<Graph<Integer, Number>, Integer,Number>(vertexFactory, * edgeFactory); * * final Graph<Integer,Number> graph = new SparseMultigraph<Integer, * Number>(); * * pnr.load(br, graph); */ // Create a simple layout frame // specify the Fruchterman-Rheingold layout algorithm layout = new AggregateLayout<Integer, Number>(new FRLayout<Integer, Number>(g)); vv = new VisualizationViewer<Integer, Number>(layout); vv.setBackground(Color.white); // Tell the renderer to use our own customized color rendering vv.getRenderContext() .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints)); vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() { public Paint transform(Integer v) { if (vv.getPickedVertexState().isPicked(v)) { return Color.blue; } else { return Color.BLACK; } } }); vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints)); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() { protected final Stroke THIN = new BasicStroke(1); protected final Stroke THICK = new BasicStroke(2); public Stroke transform(Number e) { Paint c = edgePaints.get(e); if (c == Color.LIGHT_GRAY) { return THIN; } else { return THICK; } } }); /* * //add restart button JButton scramble = new JButton("Restart"); * scramble.addActionListener(new ActionListener() { public void * actionPerformed(ActionEvent arg0) { Layout layout = * vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = * vv.getModel().getRelaxer(); if(relaxer != null) { relaxer.stop(); * relaxer.prerelax(); relaxer.relax(); } } * * }); * * DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); * vv.setGraphMouse(gm); */ final JToggleButton groupVertices = new JToggleButton("Group Clusters"); // Create slider to adjust the number of edges to remove when clustering final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL); edgeBetweennessSlider.setBackground(Color.WHITE); edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50)); edgeBetweennessSlider.setPaintTicks(true); edgeBetweennessSlider.setMaximum(g.getEdgeCount()); edgeBetweennessSlider.setMinimum(0); edgeBetweennessSlider.setValue(0); edgeBetweennessSlider.setMajorTickSpacing(10); edgeBetweennessSlider.setPaintLabels(true); edgeBetweennessSlider.setPaintTicks(true); // edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black)); // TO DO: edgeBetweennessSlider.add(new // JLabel("Node Size (PageRank With Priors):")); // I also want the slider value to appear final JPanel eastControls = new JPanel(); /* * eastControls.setOpaque(true); eastControls.setLayout(new * BoxLayout(eastControls, BoxLayout.Y_AXIS)); * eastControls.add(Box.createVerticalGlue()); */ // eastControls.add(edgeBetweennessSlider); final Box cluster_panel = Box.createVerticalBox(); cluster_panel.setBorder(BorderFactory.createTitledBorder("Cluster")); cluster_panel.add(edgeBetweennessSlider); final String COMMANDSTRING = "Edges removed for clusters: "; final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue(); final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize); /* * eastControls.setBorder(sliderBorder); //eastControls.add(eastSize); * eastControls.add(Box.createVerticalGlue()); */ groupVertices.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors, e.getStateChange() == ItemEvent.SELECTED); vv.repaint(); } }); clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected()); edgeBetweennessSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int numEdgesToRemove = source.getValue(); clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected()); sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue()); eastControls.repaint(); vv.validate(); vv.repaint(); } } }); cluster_panel.add(groupVertices); Container content = getContentPane(); content.add(new GraphZoomScrollPane(vv)); JPanel south = new JPanel(); JPanel grid = new JPanel(new GridLayout(2, 1)); // grid.add(scramble); grid.add(cluster_panel); // south.add south.add(grid); south.add(eastControls); JPanel p = new JPanel(); // p.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); // p.add(gm.getModeComboBox()); south.add(p); content.add(south, BorderLayout.SOUTH); }
From source file:cimat.tesis.sna.visualization.ClusteringDemo.java
private void setUpView(BufferedReader br) throws IOException { Factory<Number> vertexFactory = new Factory<Number>() { int n = 0; public Number create() { return n++; }//from w w w. j ava 2 s . c o m }; Factory<Number> edgeFactory = new Factory<Number>() { int n = 0; public Number create() { return n++; } }; PajekNetReader<Graph<Number, Number>, Number, Number> pnr = new PajekNetReader<Graph<Number, Number>, Number, Number>( vertexFactory, edgeFactory); final Graph<Number, Number> graph = new SparseMultigraph<Number, Number>(); pnr.load(br, graph); //Create a simple layout frame //specify the Fruchterman-Rheingold layout algorithm final AggregateLayout<Number, Number> layout = new AggregateLayout<Number, Number>( new FRLayout<Number, Number>(graph)); vv = new VisualizationViewer<Number, Number>(layout); vv.setBackground(Color.white); //Tell the renderer to use our own customized color rendering vv.getRenderContext() .setVertexFillPaintTransformer(MapTransformer.<Number, Paint>getInstance(vertexPaints)); vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Number, Paint>() { public Paint transform(Number v) { if (vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else { return Color.BLACK; } } }); vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints)); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() { protected final Stroke THIN = new BasicStroke(1); protected final Stroke THICK = new BasicStroke(2); public Stroke transform(Number e) { Paint c = edgePaints.get(e); if (c == Color.LIGHT_GRAY) return THIN; else return THICK; } }); //add restart button JButton scramble = new JButton("Restart"); scramble.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Layout layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); vv.setGraphMouse(gm); final JToggleButton groupVertices = new JToggleButton("Group Clusters"); //Create slider to adjust the number of edges to remove when clustering final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL); edgeBetweennessSlider.setBackground(Color.WHITE); edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50)); edgeBetweennessSlider.setPaintTicks(true); edgeBetweennessSlider.setMaximum(graph.getEdgeCount()); edgeBetweennessSlider.setMinimum(0); edgeBetweennessSlider.setValue(0); edgeBetweennessSlider.setMajorTickSpacing(10); edgeBetweennessSlider.setPaintLabels(true); edgeBetweennessSlider.setPaintTicks(true); // edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black)); //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):")); //I also want the slider value to appear final JPanel eastControls = new JPanel(); eastControls.setOpaque(true); eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS)); eastControls.add(Box.createVerticalGlue()); eastControls.add(edgeBetweennessSlider); final String COMMANDSTRING = "Edges removed for clusters: "; final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue(); final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize); eastControls.setBorder(sliderBorder); //eastControls.add(eastSize); eastControls.add(Box.createVerticalGlue()); groupVertices.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors, e.getStateChange() == ItemEvent.SELECTED); vv.repaint(); } }); clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected()); edgeBetweennessSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int numEdgesToRemove = source.getValue(); clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected()); sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue()); eastControls.repaint(); vv.validate(); vv.repaint(); } } }); Container content = getContentPane(); content.add(new GraphZoomScrollPane(vv)); JPanel south = new JPanel(); JPanel grid = new JPanel(new GridLayout(2, 1)); grid.add(scramble); grid.add(groupVertices); south.add(grid); south.add(eastControls); JPanel p = new JPanel(); p.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); p.add(gm.getModeComboBox()); south.add(p); content.add(south, BorderLayout.SOUTH); }
From source file:edu.scripps.fl.curves.plot.CurvePlot.java
public void addLineAt(double response) { addLineAt(response, Color.LIGHT_GRAY, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); }
From source file:org.jfree.chart.demo.Main_window.java
void jpanel_int() { panel.setBounds(getX() + (int) (3 / 4) * getWidth(), getY(), (int) (1 / 4) * getWidth(), getHeight()); panel.setBackground(Color.LIGHT_GRAY); panel.setLayout(new BorderLayout()); }
From source file:appInterface.AppFrame.java
/** * *///w w w . j ava2 s . c om private void setWindowsProperty() { setSize(1024, 600); setTitle("Astro Quizz"); setDefaultCloseOperation(EXIT_ON_CLOSE); _container.setBackground(Color.LIGHT_GRAY); _container.setLayout(new BorderLayout()); _top.setBackground(Color.LIGHT_GRAY); _top.setLayout(new BorderLayout()); _top.add(_mainToolBar, "East"); _top.add(_mainToolBar.randomButton, "West"); _container.add(_top, "North"); _container.add(_botToolBar, "South"); _container.add(_questionArea, "Center"); _botToolBar.previousButton.setEnabled(false); setContentPane(_container); }