List of usage examples for java.awt Color DARK_GRAY
Color DARK_GRAY
To view the source code for java.awt Color DARK_GRAY.
Click Source Link
From source file:org.polymap.core.style.geotools.DefaultStyles.java
/** * Create a Style to draw line features as thin blue lines *///from www.jav a 2s . co m private Style createLineStyle(Style style) { Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.DARK_GRAY), filterFactory.literal(0.5)); /* * Setting the geometryPropertyName arg to null signals that we want to * draw the default geometry of features */ LineSymbolizer sym = styleFactory.createLineSymbolizer(stroke, null); Rule rule = styleFactory.createRule(); rule.symbolizers().add(sym); rule.setName("Rule for LineSymbolizer"); style.featureTypeStyles().get(0).rules().add(rule); return style; }
From source file:uk.ac.leeds.ccg.andyt.generic.visualisation.charts.Generic_ScatterPlotAndLinearRegression.java
@Override public void drawData() { double[][] dataAsDoubleArray = getDataAsDoubleArray((ArrayList<Generic_XYNumericalData>) getData()[0]); drawYEqualsXLineData(dataAsDoubleArray); /*/*from w w w . java 2s .c o m*/ * regressionParameters[0] is the y axis intercept; * regressionParameters[1] is the change in y relative to x (gradient or * slope); regressionParameters[2] is the rank correlation coefficient * (RSquare); regressionParameters[3] is data[0].length. */ double[] regressionParameters = getSimpleRegressionParameters(dataAsDoubleArray); drawRegressionLine(regressionParameters, dataAsDoubleArray); drawPoints(Color.DARK_GRAY, getData()); //if (addLegend) { drawLegend(regressionParameters); //} }
From source file:net.sf.maltcms.chromaui.annotations.PeakAnnotationRenderer.java
public void draw(Graphics2D g2, ChartPanel chartPanel, XYPlot plot, Color fillColor, Collection<? extends VisualPeakAnnotation> shapes, Collection<? extends VisualPeakAnnotation> selectedShapes) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Shape savedClip = g2.getClip(); Rectangle2D dataArea = chartPanel.getScreenDataArea(); g2.clip(dataArea);// w w w .j a v a2s . com ValueAxis xAxis = plot.getDomainAxis(); RectangleEdge xAxisEdge = plot.getDomainAxisEdge(); ValueAxis yAxis = plot.getRangeAxis(); RectangleEdge yAxisEdge = plot.getRangeAxisEdge(); Color c = g2.getColor(); // Color fillColor = peakAnnotations.getColor(); // if (fillColor == null || fillColor.equals(Color.WHITE) || fillColor.equals(new Color(255, 255, 255, 0))) { //// System.out.println("Peak annotation color was null or white, using color from treatment group!"); // fillColor = peakAnnotations.getChromatogram().getTreatmentGroup().getColor(); // } for (VisualPeakAnnotation x : shapes) { Shape s = toViewXY(x, chartPanel, x.getCenter()); switch (x.getPeakAnnotationType()) { case LINE: drawEntity(s, g2, fillColor, null, chartPanel, false, 0.1f); break; case OUTLINE: // plot.addAnnotation(new XYShapeAnnotation(x, new BasicStroke(1.0f), new Color(fillColor.getRed(), fillColor.getGreen(), fillColor.getBlue(), 64), new Color(254, 254, 254, 254)), false); drawOutline(s, g2, fillColor, Color.DARK_GRAY, chartPanel, false, 0.25f); break; case POINTER: drawEntity(s, g2, fillColor, Color.DARK_GRAY, chartPanel, false, 0.25f); break; default: drawEntity(s, g2, fillColor, null, chartPanel, false, 0.1f); } } for (VisualPeakAnnotation x : selectedShapes) { Shape s = toViewXY(x, chartPanel, x.getCenter()); switch (x.getPeakAnnotationType()) { case LINE: drawEntity(s, g2, fillColor, Color.BLACK, chartPanel, false, 1f); break; case OUTLINE: // plot.addAnnotation(new XYShapeAnnotation(x, new BasicStroke(1.0f), new Color(fillColor.getRed(),fillColor.getGreen(),fillColor.getBlue(),64), new Color(254,254,254,254)), false); drawOutline(s, g2, fillColor, Color.BLACK, chartPanel, false, 1f); break; case POINTER: drawEntity(s, g2, fillColor, Color.BLACK, chartPanel, false, 1f); break; default: drawEntity(s, g2, fillColor, Color.BLACK, chartPanel, false, 1f); } } g2.setColor(c); g2.setClip(savedClip); // chartPanel.repaint(); }
From source file:ui.Graph.java
/** * Creates a chart.//from www. j av a2s .c om * * @param dataset * the data for the chart. * * @return a chart. */ private JFreeChart createChart(ArrayList<Setpoint> setpoints, ArrayList<Setpoint> traj) { trajectory = traj; XYSeries posSeries = new XYSeries("Position"); XYSeries trajSeries = new XYSeries("Trajectory"); XYSeries velSeries = new XYSeries("Velocity"); for (int i = 0; i < setpoints.size(); i++) { Setpoint p = setpoints.get(i); posSeries.add(p.time, p.position); velSeries.add(p.time, p.velocity); } for (int i = 0; i < trajectory.size(); i++) { Setpoint p = trajectory.get(i); trajSeries.add(p.time, p.position); } XYSeriesCollection posDataset = new XYSeriesCollection(); XYSeriesCollection trajDataset = new XYSeriesCollection(); XYSeriesCollection velDataset = new XYSeriesCollection(); posDataset.addSeries(posSeries); velDataset.addSeries(velSeries); trajDataset.addSeries(trajSeries); // create the chart... final JFreeChart chart = ChartFactory.createScatterPlot("System output", // chart title "X", // x axis label "Y", // y axis label posDataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // 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.setDataset(0, posDataset); plot.setDataset(1, trajDataset); plot.setDataset(2, velDataset); plot.setBackgroundPaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer posRenderer = new XYLineAndShapeRenderer(); // renderer.setSeriesShape(0, new Ellipse2D.Float(1.0f, 1.0f, 1.0f, // 1.0f)); posRenderer.setSeriesPaint(0, Color.BLUE); posRenderer.setSeriesLinesVisible(0, true); posRenderer.setSeriesShapesVisible(0, false); XYStepRenderer trajRenderer = new XYStepRenderer(); trajRenderer.setSeriesPaint(1, Color.RED); trajRenderer.setSeriesStroke(1, new BasicStroke(10)); trajRenderer.setSeriesLinesVisible(1, true); trajRenderer.setSeriesShapesVisible(1, false); XYLineAndShapeRenderer velRenderer = new XYLineAndShapeRenderer(); velRenderer.setSeriesPaint(0, Color.MAGENTA); velRenderer.setSeriesLinesVisible(0, true); velRenderer.setSeriesShapesVisible(0, false); // renderer.setSeriesStroke(1, new BasicStroke(0.01f)); plot.setRenderer(0, posRenderer); plot.setRenderer(1, trajRenderer); plot.setRenderer(2, velRenderer); for (Setpoint s : trajectory) { Marker marker = new ValueMarker(s.time); marker.setPaint(Color.DARK_GRAY); marker.setLabel(Float.toString((float) s.position)); marker.setLabelAnchor(RectangleAnchor.TOP_LEFT); marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT); plot.addDomainMarker(marker); } XYTextAnnotation p = new XYTextAnnotation("kP = " + gains.kP, plot.getDomainAxis().getUpperBound() * 0.125, plot.getRangeAxis().getUpperBound() * .75); p.setFont(new Font("Dialog", Font.PLAIN, 12)); plot.addAnnotation(p); XYTextAnnotation i = new XYTextAnnotation("kI = " + gains.kI, plot.getDomainAxis().getUpperBound() * 0.125, plot.getRangeAxis().getUpperBound() * .7); i.setFont(new Font("Dialog", Font.PLAIN, 12)); plot.addAnnotation(i); XYTextAnnotation d = new XYTextAnnotation("kD = " + gains.kD, plot.getDomainAxis().getUpperBound() * 0.125, plot.getRangeAxis().getUpperBound() * .65); d.setFont(new Font("Dialog", Font.PLAIN, 12)); plot.addAnnotation(d); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRange(true); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:uk.ac.leeds.ccg.andyt.generic.visualisation.charts.Generic_ScatterPlotAndLinearRegression.java
@Override public Dimension draw() { drawOutline();/*from w w w. j a v a2 s.c o m*/ drawTitle(getTitle()); //System.out.println("dataStartCol " + dataStartCol); drawAxes(0, 0); drawPoints(Color.DARK_GRAY, getData()); Object[] data = getData(); if (data == null) { data = getDefaultData(); } double[][] dataAsDoubleArray = getDataAsDoubleArray((ArrayList<Generic_XYNumericalData>) data[0]); drawYEqualsXLineData(dataAsDoubleArray); /* * regressionParameters[0] is the y axis intercept; * regressionParameters[1] is the change in y relative to x (gradient or * slope); regressionParameters[2] is the rank correlation coefficient * (RSquare); regressionParameters[3] is data[0].length. */ double[] regressionParameters = getSimpleRegressionParameters(dataAsDoubleArray); drawRegressionLine(regressionParameters, dataAsDoubleArray); //if (addLegend) { drawLegend(regressionParameters); Dimension newDim = new Dimension(getImageWidth(), getImageHeight()); return newDim; }
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 ww. ja va 2 s . co 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; }
From source file:SampleTableModel.java
@Override public void init() { tableModel = new SampleTableModel(); // create javafx panel for charts chartFxPanel = new JFXPanel(); chartFxPanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, PANEL_HEIGHT_INT)); //JTable/*from w w w . j ava 2 s . co m*/ JTable table = new JTable(tableModel); table.setAutoCreateRowSorter(true); table.setGridColor(Color.DARK_GRAY); SwingInterop.DecimalFormatRenderer renderer = new SwingInterop.DecimalFormatRenderer(); renderer.setHorizontalAlignment(JLabel.RIGHT); for (int i = 0; i < table.getColumnCount(); i++) { table.getColumnModel().getColumn(i).setCellRenderer(renderer); } JScrollPane tablePanel = new JScrollPane(table); tablePanel.setPreferredSize(new Dimension(PANEL_WIDTH_INT, TABLE_PANEL_HEIGHT_INT)); JPanel chartTablePanel = new JPanel(); chartTablePanel.setLayout(new BorderLayout()); //Split pane that holds both chart and table JSplitPane jsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); jsplitPane.setTopComponent(chartTablePanel); jsplitPane.setBottomComponent(tablePanel); jsplitPane.setDividerLocation(410); chartTablePanel.add(chartFxPanel, BorderLayout.CENTER); // add(tablePanel, BorderLayout.CENTER); add(jsplitPane, BorderLayout.CENTER); // create JavaFX scene Platform.runLater(new Runnable() { @Override public void run() { createScene(); } }); }
From source file:com.xilinx.kintex7.PowerDial.java
public void createDial() { plot = new MeterPlot(); dset = new DefaultValueDataset(0); plot.setUnits("Watts"); plot.setRange(new Range(1, 10)); plot.addInterval(new MeterInterval("Acceptable", new Range(1.0, 6.0), Color.lightGray, new BasicStroke(2.0f), Color.GREEN)); plot.addInterval(new MeterInterval("Warning", new Range(6.0, 8.0), Color.lightGray, new BasicStroke(2.0f), Color.YELLOW));//from w w w . ja va 2s .c o m plot.addInterval(new MeterInterval("Dangerous", new Range(8.0, 10.0), Color.lightGray, new BasicStroke(2.0f), Color.RED)); //sets different marks for (int i = 0; i < 10; i += 1) { if (i == 0) plot.addInterval( new MeterInterval("", new Range(1, 1), Color.lightGray, new BasicStroke(2.0f), null)); else plot.addInterval( new MeterInterval("", new Range(i, i), Color.lightGray, new BasicStroke(2.0f), null)); } plot.setNeedlePaint(Color.darkGray); plot.setDialBackgroundPaint(Color.white); plot.setDialOutlinePaint(Color.gray); plot.setDialShape(DialShape.PIE); plot.setMeterAngle(180); plot.setTickLabelsVisible(true); plot.setTickLabelFont(new Font("Dialog", Font.BOLD, 10)); plot.setTickLabelPaint(Color.DARK_GRAY); plot.setTickSize(10.0); plot.setTickPaint(Color.lightGray); plot.setValuePaint(Color.BLACK); plot.setDataset(dset); LegendItemCollection legendItemsOld = plot.getLegendItems(); final LegendItemCollection legendItemsNew = new LegendItemCollection(); for (int i = 0; i < 3; i++) { LegendItem item = legendItemsOld.get(i); item.setLabelPaint(Color.WHITE); legendItemsNew.add(item); } LegendItemSource source = new LegendItemSource() { LegendItemCollection lic = new LegendItemCollection(); { lic.addAll(legendItemsNew); } @Override public LegendItemCollection getLegendItems() { return lic; } }; chart = new JFreeChart(plot); chart.addLegend(new LegendTitle(source)); chart.removeLegend(); chart.setTitle(""); //chart.setBackgroundPaint(new GradientPaint(0,0,new Color(139,137,137),0,height,Color.BLUE )); // chart.getTitle().setPaint(Color.white); plot.setValueFont(new Font("Dialog", Font.BOLD, 14)); //chartpanel = new ChartPanel(chart); }
From source file:org.spoutcraft.launcher.skin.ConsoleFrame.java
/** * Construct the frame.//from w w w. j a va 2s . c o m * * @param numLines number of lines to show at a time * @param colorEnabled true to enable a colored console * @param trackProc process to track * @param killProcess true to kill the process on console close */ public ConsoleFrame(int numLines, boolean colorEnabled, final Process trackProc, final boolean killProcess) { super("Console"); this.numLines = numLines; this.colorEnabled = colorEnabled; this.trackProc = trackProc; this.highlightedAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(highlightedAttributes, Color.BLACK); StyleConstants.setBackground(highlightedAttributes, Color.YELLOW); this.errorAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(errorAttributes, new Color(200, 0, 0)); this.infoAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(infoAttributes, new Color(200, 0, 0)); this.debugAttributes = new SimpleAttributeSet(); StyleConstants.setForeground(debugAttributes, Color.DARK_GRAY); setSize(new Dimension(650, 400)); buildUI(); Compatibility.setIconImage(this, Toolkit.getDefaultToolkit().getImage(LoginFrame.spoutcraftIcon)); if (trackProc != null) { track(trackProc); } addMouseListener(this); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent event) { if (trackProc != null && killProcess) { trackProc.destroy(); if (loggerHandler != null) { rootLogger.removeHandler(loggerHandler); } event.getWindow().dispose(); } } }); }
From source file:umontreal.iro.lecuyer.charts.SSJCategorySeriesCollection.java
protected static String detectXColorClassic(Color color) { String retour = null;/* w w w. jav a 2 s .co m*/ 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; }