List of usage examples for java.awt Color blue
Color blue
To view the source code for java.awt Color blue.
Click Source Link
From source file:org.gvsig.gui.beans.graphic.GraphicChartPanel.java
/** * Creates a chart.//from ww w . j ava2 s . c o m * @param dataset the dataset. * @return A chart. */ private void createChart() { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, false, true, true); // Definir la lista de colores XYPlot plot = chart.getXYPlot(); plot.getRenderer().setSeriesPaint(0, Color.red); plot.getRenderer().setSeriesPaint(1, Color.green); plot.getRenderer().setSeriesPaint(2, Color.blue); plot.getRenderer().setSeriesPaint(3, Color.cyan); plot.getRenderer().setSeriesPaint(4, Color.black); plot.getRenderer().setSeriesPaint(5, Color.darkGray); plot.getRenderer().setSeriesPaint(6, Color.gray); plot.getRenderer().setSeriesPaint(7, Color.magenta); plot.getRenderer().setSeriesPaint(8, Color.yellow); plot.getRenderer().setSeriesPaint(9, Color.orange); Image img = new ImageIcon(getClass().getResource("images/splash.png")).getImage(); plot.setBackgroundPaint(null); plot.setBackgroundImageAlpha(0.18f); plot.setBackgroundImage(img); }
From source file:historyView.HistoryJFrame.java
/** * Creates new form HistoryJFrame//from w w w . j a v a 2 s.c o m */ public HistoryJFrame() { initComponents(); //set window in the center of the screen //Get the size of the screen Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); //Determine the new location of the window int w = this.getSize().width; int h = this.getSize().height; int x = (dim.width - w) / 2; int y = (dim.height - h) / 2; //Move the window this.setLocation(x, y); XYSeries breathingSeries = new XYSeries("Breathing Rate"); XYSeries oxygenSeries = new XYSeries("Oxygen"); XYSeries temperatureSeries = new XYSeries("Temperature"); XYSeries bloodPressureSeries = new XYSeries("Blood Pressure"); XYSeries heartRateSeries = new XYSeries("Heart Rate"); // add date to all the series for (Map.Entry<String, PatientData> entry : model.getSelectedPatient().data.entrySet()) { breathingSeries.add(Double.parseDouble(entry.getKey()), entry.getValue().getBreathing()); oxygenSeries.add(Double.parseDouble(entry.getKey()), entry.getValue().getOxygen()); temperatureSeries.add(Double.parseDouble(entry.getKey()), entry.getValue().getTemperature()); bloodPressureSeries.add(Double.parseDouble(entry.getKey()), entry.getValue().getBloodPressure()); heartRateSeries.add(Double.parseDouble(entry.getKey()), entry.getValue().getHeartRate()); } // Add the series to your data set XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(breathingSeries); dataset.addSeries(oxygenSeries); dataset.addSeries(temperatureSeries); dataset.addSeries(bloodPressureSeries); dataset.addSeries(heartRateSeries); // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart("XY Chart", // Title "time(s)", // x-axis Label "Rate", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); this.setLayout(new java.awt.BorderLayout()); ChartPanel CP = new ChartPanel(chart); chart.getPlot().setBackgroundAlpha(1); chart.getPlot().setBackgroundPaint(Color.BLUE); HistoryButtonsJPanel buttonPanel = new HistoryButtonsJPanel(); ChartUtilities.applyCurrentTheme(chart); this.add(CP, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.PAGE_END); this.validate(); }
From source file:org.jfree.graphics2d.demo.SVGBarChartDemo1.java
/** * Creates a sample chart./*from w w w.j a v a 2 s .c o m*/ * * @param dataset a dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value", dataset); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(false); // customise the renderer... StatisticalBarRenderer renderer = new StatisticalBarRenderer(); renderer.setDrawBarOutline(false); renderer.setErrorIndicatorPaint(Color.black); renderer.setIncludeBaseInRange(false); plot.setRenderer(renderer); // ensure the current theme is applied to the renderer just added ChartUtilities.applyCurrentTheme(chart); renderer.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setDefaultItemLabelsVisible(true); renderer.setDefaultItemLabelPaint(Color.yellow); renderer.setDefaultPositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER)); // set up gradient paints for series... GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); return chart; }
From source file:UserInterface.AppUsersProfile.DetailAnalysis.DetailAnalysisJPanel.java
public ChartPanel getChartPanel(String vitalSignType) { int count = 1; DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (VitalSign vitalSign : userAccount.getPatient().getVitalSignHistory().getVitalSignList()) { String str = String.valueOf(count); if (vitalSignType.equalsIgnoreCase("Blood Pressure")) { vitalSignType = "Blood Pressure"; dataSet.addValue(vitalSign.getBloodPressure(), "Blood Pressure", str); } else if (vitalSignType.equalsIgnoreCase("Pulse Rate")) { vitalSignType = "Pulse Rate"; dataSet.addValue(vitalSign.getHeartRate(), "Pulse Rate", str); } else if (vitalSignType.equalsIgnoreCase("Respiratory Rate")) { vitalSignType = "Respiratory Rate"; dataSet.addValue(vitalSign.getRespiratoryRate(), "Respiratory Rate", str); } else if (vitalSignType.equalsIgnoreCase("Temperature")) { vitalSignType = "Temperature"; dataSet.addValue(vitalSign.getTemperature(), "Temperature", str); }//from w ww . ja v a 2 s. c o m count++; } JFreeChart chartFactory = ChartFactory.createLineChart(vitalSignType + " Chart", "Timestamp", vitalSignType, dataSet); CategoryPlot plot = chartFactory.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chartFactory); return chartPanel; }
From source file:Demo.LineGraph.java
private void InitChart() { JFreeChart chart = ChartFactory.createLineChart("Yield", "sample NB", "Probability", dataSet, PlotOrientation.VERTICAL, false, false, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setNoDataMessage("no data"); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setBaseItemLabelsVisible(true); renderer.setSeriesPaint(0, Color.BLUE); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true);/*w ww . j a v a 2 s . com*/ renderer.setBaseItemLabelsVisible(true); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT)); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelFont(new Font("Times New Romain", 0, 10)); plot.setRenderer(renderer); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createDownRotationLabelPositions(Math.PI / 6.0)); chartPane = new ChartPanel(chart); }
From source file:com.charts.MaxChart.java
public MaxChart(YStockQuote currentStock) throws ParseException { DateAxis domainAxis = new DateAxis("Date"); NumberAxis rangeAxis = new NumberAxis("Price"); CandlestickRenderer renderer = new CandlestickRenderer(); XYDataset dataset = getDataSet(currentStock); XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); //Do some setting up, see the API Doc renderer.setSeriesPaint(0, Color.BLACK); renderer.setDrawVolume(false);/*from w w w . ja va 2 s. c o m*/ rangeAxis.setAutoRangeIncludesZero(false); domainAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yy")); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); //Now create the chart and chart panel JFreeChart chart = new JFreeChart(currentStock.get_name(), null, mainPlot, false); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(900, 400)); XYPlot plot = (XYPlot) chart.getPlot(); LegendTitle legend = new LegendTitle(plot); chart.addLegend(legend); chart.getLegend().setVisible(true); chart.getLegend().setPosition(RectangleEdge.BOTTOM); ValueAxis yAxis = (ValueAxis) plot.getRangeAxis(); DateAxis xAxis = (DateAxis) plot.getDomainAxis(); xAxis.setDateFormatOverride(new SimpleDateFormat("MMM y")); xAxis.setAutoTickUnitSelection(true); xAxis.setAutoRange(true); renderer.setAutoWidthFactor(0.5); renderer.setUpPaint(Color.green); renderer.setDownPaint(new Color(0xc0, 0x00, 0x00)); renderer.setSeriesPaint(0, Color.black); StandardXYItemRenderer renderer1 = new StandardXYItemRenderer(); renderer1.setSeriesPaint(0, Color.BLUE); TimeSeries movingAverage30 = MovingAverage.createMovingAverage(close, "MA(30)", 30, 0); Double currMA30 = (Double) movingAverage30.getDataItem(movingAverage30.getItemCount() - 1).getValue(); currMA30 = Math.round(currMA30 * 100.0) / 100.0; movingAverage30.setKey("MA(30): " + currMA30); TimeSeriesCollection collection = new TimeSeriesCollection(); collection.addSeries(movingAverage30); plot.setDataset(1, collection); plot.setRenderer(1, renderer1); chartPanel.revalidate(); chartPanel.repaint(); chartPanel.revalidate(); chartPanel.repaint(); }
From source file:org.jfree.expdemo.SelectionDemo3.java
private static JFreeChart createChart(XYDataset dataset, DatasetSelectionExtension ext) { JFreeChart chart = ChartFactory.createScatterPlot("SelectionDemo3", "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("NO DATA"); plot.setDomainPannable(true);// w ww . j a va2 s . c o m plot.setRangePannable(true); plot.setDomainZeroBaselineVisible(true); plot.setRangeZeroBaselineVisible(true); plot.setDomainGridlineStroke(new BasicStroke(0.0f)); plot.setRangeGridlineStroke(new BasicStroke(0.0f)); plot.setDomainMinorGridlinesVisible(true); plot.setRangeMinorGridlinesVisible(true); //XYItemRenderer r = plot.getRenderer(); XYDotRenderer r = new XYDotRenderer(); r.setDotHeight(2); r.setDotWidth(2); r.setSeriesPaint(0, Color.blue); r.setSeriesPaint(1, Color.green); r.setSeriesPaint(2, Color.yellow); r.setSeriesPaint(3, Color.orange); plot.setRenderer(r); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setTickMarkInsideLength(2.0f); domainAxis.setTickMarkOutsideLength(2.0f); domainAxis.setMinorTickCount(2); domainAxis.setMinorTickMarksVisible(true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setTickMarkInsideLength(2.0f); rangeAxis.setTickMarkOutsideLength(2.0f); rangeAxis.setMinorTickCount(2); rangeAxis.setMinorTickMarksVisible(true); //add selection specific rendering IRSUtilities.setSelectedItemPaint(r, ext, Color.red); //register plot as selection change listener ext.addSelectionChangeListener(plot); return chart; }
From source file:net.mohatu.bloocoin.miner.SubmitList.java
private void submit() { for (int i = 0; i < solved.size(); i++) { try {//from w ww . j a v a 2 s. co m Socket sock = new Socket(this.url, this.port); String result = new String(); DataInputStream is = new DataInputStream(sock.getInputStream()); DataOutputStream os = null; BufferedReader in = new BufferedReader(new InputStreamReader(is)); solution = solved.get(i); hash = DigestUtils.sha512Hex(solution); String command = "{\"cmd\":\"check" + "\",\"winning_string\":\"" + solution + "\",\"winning_hash\":\"" + hash + "\",\"addr\":\"" + Main.getAddr() + "\"}"; os = new DataOutputStream(sock.getOutputStream()); os.write(command.getBytes()); String inputLine; while ((inputLine = in.readLine()) != null) { result += inputLine; } if (result.contains("\"success\": true")) { System.out.println("Result: Submitted"); Main.updateStatusText(solution + " submitted", Color.blue); Thread gc = new Thread(new Coins()); gc.start(); } else if (result.contains("\"success\": false")) { System.out.println("Result: Failed"); Main.updateStatusText("Submission of " + solution + " failed, already exists!", Color.red); } is.close(); os.close(); os.flush(); sock.close(); } catch (UnknownHostException e) { e.printStackTrace(); Main.updateStatusText("Submission of " + solution + " failed, connection failed!", Color.red); } catch (IOException e) { e.printStackTrace(); Main.updateStatusText("Submission of " + solution + " failed, connection failed!", Color.red); } } Thread gc = new Thread(new Coins()); gc.start(); }
From source file:ScaleTest_2008.java
/** * Paints the test image that will be downscaled and timed by the various * scaling methods. A different image is rendered into each of the four * quadrants of this image: RGB stripes, a picture, vector art, and * a black and white grid.//from ww w .j a va 2 s . co m */ private void paintOriginalImage() { Graphics g = originalImage.getGraphics(); // Erase to black g.setColor(Color.BLACK); g.fillRect(0, 0, FULL_SIZE, FULL_SIZE); // RGB quadrant for (int i = 0; i < QUAD_SIZE; i += 3) { int x = i; g.setColor(Color.RED); g.drawLine(x, 0, x, QUAD_SIZE); x++; g.setColor(Color.GREEN); g.drawLine(x, 0, x, QUAD_SIZE); x++; g.setColor(Color.BLUE); g.drawLine(x, 0, x, QUAD_SIZE); } // Picture quadrant try { URL url = getClass().getResource("BBGrayscale.png"); BufferedImage picture = ImageIO.read(url); // Center picture in quadrant area int xDiff = QUAD_SIZE - picture.getWidth(); int yDiff = QUAD_SIZE - picture.getHeight(); g.drawImage(picture, QUAD_SIZE + xDiff / 2, yDiff / 2, null); } catch (Exception e) { System.out.println("Problem reading image file: " + e); } // Vector drawing quadrant g.setColor(Color.WHITE); g.fillRect(0, QUAD_SIZE, QUAD_SIZE, QUAD_SIZE); g.setColor(Color.BLACK); g.drawOval(2, QUAD_SIZE + 2, QUAD_SIZE - 4, QUAD_SIZE - 4); g.drawArc(20, QUAD_SIZE + 20, (QUAD_SIZE - 40), QUAD_SIZE - 40, 190, 160); int eyeSize = 7; int eyePos = 30 - (eyeSize / 2); g.fillOval(eyePos, QUAD_SIZE + eyePos, eyeSize, eyeSize); g.fillOval(QUAD_SIZE - eyePos - eyeSize, QUAD_SIZE + eyePos, eyeSize, eyeSize); // B&W grid g.setColor(Color.WHITE); g.fillRect(QUAD_SIZE + 1, QUAD_SIZE + 1, QUAD_SIZE, QUAD_SIZE); g.setColor(Color.BLACK); for (int i = 0; i < QUAD_SIZE; i += 4) { int pos = QUAD_SIZE + i; g.drawLine(pos, QUAD_SIZE + 1, pos, FULL_SIZE); g.drawLine(QUAD_SIZE + 1, pos, FULL_SIZE, pos); } originalImagePainted = true; }
From source file:com.charts.YTDChart.java
public YTDChart(YStockQuote currentStock) throws ParseException { DateAxis domainAxis = new DateAxis("Date"); NumberAxis rangeAxis = new NumberAxis("Price"); CandlestickRenderer renderer = new CandlestickRenderer(); XYDataset dataset = getDataSet(currentStock); XYPlot mainPlot = new XYPlot(dataset, domainAxis, rangeAxis, renderer); //Do some setting up, see the API Doc renderer.setSeriesPaint(0, Color.BLACK); renderer.setDrawVolume(false);//www .j a v a2 s. c om rangeAxis.setAutoRangeIncludesZero(false); domainAxis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yy")); domainAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); //Now create the chart and chart panel JFreeChart chart = new JFreeChart(currentStock.get_name(), null, mainPlot, false); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(900, 400)); XYPlot plot = (XYPlot) chart.getPlot(); LegendTitle legend = new LegendTitle(plot); chart.addLegend(legend); chart.getLegend().setVisible(true); chart.getLegend().setPosition(RectangleEdge.BOTTOM); ValueAxis yAxis = (ValueAxis) plot.getRangeAxis(); DateAxis xAxis = (DateAxis) plot.getDomainAxis(); xAxis.setDateFormatOverride(new SimpleDateFormat("MMM y")); xAxis.setAutoTickUnitSelection(true); xAxis.setAutoRange(true); renderer.setAutoWidthFactor(0.5); renderer.setUpPaint(Color.green); renderer.setDownPaint(new Color(0xc0, 0x00, 0x00)); renderer.setSeriesPaint(0, Color.black); StandardXYItemRenderer renderer1 = new StandardXYItemRenderer(); renderer1.setSeriesPaint(0, Color.BLUE); TimeSeries movingAverage30 = MovingAverage.createMovingAverage(close, "MA(30)", 30, 0); Double currMA30 = (Double) movingAverage30.getDataItem(movingAverage30.getItemCount() - 1).getValue(); currMA30 = Math.round(currMA30 * 100.0) / 100.0; movingAverage30.setKey("MA(30): " + currMA30); TimeSeriesCollection collection = new TimeSeriesCollection(); collection.addSeries(movingAverage30); plot.setDataset(1, collection); plot.setRenderer(1, renderer1); chartPanel.revalidate(); chartPanel.repaint(); chartPanel.revalidate(); chartPanel.repaint(); }