List of usage examples for java.awt Color WHITE
Color WHITE
To view the source code for java.awt Color WHITE.
Click Source Link
From source file:com.spstudio.common.image.ImageUtils.java
public static BufferedImage zoom(BufferedImage sourceImage, int width, int height) { BufferedImage zoomImage = new BufferedImage(width, height, sourceImage.getType()); Image image = sourceImage.getScaledInstance(width, height, Image.SCALE_SMOOTH); Graphics gc = zoomImage.getGraphics(); gc.setColor(Color.WHITE); gc.drawImage(image, 0, 0, null);// w ww .j a v a 2 s . c o m return zoomImage; }
From source file:com.thalesgroup.hudson.plugins.sourcemonitor.SourceMonitorChartBuilder.java
public static JFreeChart buildChart(SourceMonitorBuildAction action) { JFreeChart chart = ChartFactory.createStackedAreaChart(null, null, "Number of errors", buildDataset(action), PlotOrientation.VERTICAL, true, false, true); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(null);//from w ww.jav a2s. co m plot.setForegroundAlpha(0.8f); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); CategoryAxis domainAxis = new ShiftedCategoryAxis(null); plot.setDomainAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); domainAxis.setCategoryMargin(0.0); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // crop extra space around the graph plot.setInsets(new RectangleInsets(0, 0, 0, 5.0)); CategoryItemRenderer firstRender = new DefaultCategoryItemRenderer(); SourceMonitorRenderer renderer = new SourceMonitorRenderer(action.getUrlName()); plot.setRenderer(firstRender); return chart; }
From source file:IconPaint.java
public void paintComponent(Graphics g) { super.paintComponent(g); setBackground(Color.white); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2.drawImage(img, 10, 10, 100, 100, this); }
From source file:com.charts.IntradayChart.java
public IntradayChart(YStockQuote currentStock) { TimeSeries series = new TimeSeries(currentStock.get_name()); ArrayList<String> fiveDayData = currentStock.get_one_day_data(); int length = fiveDayData.size(); for (int i = 17; i < length; i++) { String[] data = fiveDayData.get(i).split(","); Date time = new Date((long) Integer.parseInt(data[0]) * 1000); DateFormat df = new SimpleDateFormat("MM-dd-yyyy-h-m"); series.addOrUpdate(new Minute(time), Double.parseDouble(data[1])); }/*from ww w . j a va 2s .c o m*/ TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createTimeSeriesChart( currentStock.get_name() + "(" + currentStock.get_symbol() + ")" + " Intraday", "Date", "Price", dataset, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); ValueAxis yAxis = (ValueAxis) plot.getRangeAxis(); DateAxis xAxis = (DateAxis) plot.getDomainAxis(); xAxis.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline()); xAxis.setDateFormatOverride(new SimpleDateFormat("h:m a")); xAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); //xAxis.setVerticalTickLabels(true); chartPanel = new ChartPanel(chart); chart.setBackgroundPaint(chartPanel.getBackground()); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); chartPanel.setVisible(true); chartPanel.revalidate(); chartPanel.repaint(); }
From source file:org.mwc.debrief.sensorfusion.views.DataSupport.java
/** * Creates a chart.//w w w . j a va2 s . c o m * * @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:com.google.code.facebook.graph.sna.applet.VisualizationImageServerDemo.java
/** * /*w w w . j a va 2 s . com*/ */ 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); }
From source file:dr.PlotPanel.java
public PlotPanel(PCADataset dataset) { super(null);//from ww w.jav a 2 s. c om chart = ChartFactory.createXYAreaChart("", dataset.getXLabel(), dataset.getYLabel(), dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title TextTitle chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chart.removeSubtitle(chartTitle); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.setForegroundAlpha(dataPointAlpha); NumberFormat numberFormat = NumberFormat.getNumberInstance(); // set the X axis (component 1) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(numberFormat); // set the Y axis (component 2) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(numberFormat); plot.setDataset(dataset); spotRenderer = new PlotRenderer(plot, dataset); itemLabelGenerator = new PlotItemLabelGenerator(); spotRenderer.setBaseItemLabelGenerator(itemLabelGenerator); spotRenderer.setBaseItemLabelsVisible(true); spotRenderer.setBaseToolTipGenerator(new PlotToolTipGenerator()); plot.setRenderer(spotRenderer); }
From source file:LineBreakSample.java
public void paintComponent(Graphics g) { super.paintComponent(g); setBackground(Color.white); Graphics2D graphics2D = (Graphics2D) g; // Set formatting width to width of Component. Dimension size = getSize();/*from www . j a va 2 s .co m*/ float formatWidth = (float) size.width; float drawPosY = 0; lineMeasurer.setPosition(paragraphStart); // Get lines from lineMeasurer until the entire // paragraph has been displayed. while (lineMeasurer.getPosition() < paragraphEnd) { // Retrieve next layout. TextLayout layout = lineMeasurer.nextLayout(formatWidth); // Move y-coordinate by the ascent of the layout. drawPosY += layout.getAscent(); // Compute pen x position. If the paragraph is // right-to-left, we want to align the TextLayouts // to the right edge of the panel. float drawPosX; if (layout.isLeftToRight()) { drawPosX = 0; } else { drawPosX = formatWidth - layout.getAdvance(); } // Draw the TextLayout at (drawPosX, drawPosY). layout.draw(graphics2D, drawPosX, drawPosY); // Move y-coordinate in preparation for next layout. drawPosY += layout.getDescent() + layout.getLeading(); } }
From source file:networkanalyzer.DynamicPing.java
public JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createTimeSeriesChart("Ping Chart", //title "Time", //x-axis "Ping", //y-axis dataset, false, false, false); final XYPlot plot = result.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); ValueAxis xaxis = plot.getDomainAxis(); xaxis.setAutoRange(true);/*from w w w . j a v a 2 s . com*/ xaxis.setFixedAutoRange(60000.0); xaxis.setVerticalTickLabels(true); ValueAxis yaxis = plot.getRangeAxis(); yaxis.setAutoRange(true); return result; }
From source file:de.bund.bfr.jung.JungUtils.java
public static <V, E> Transformer<V, Paint> newNodeFillTransformer(RenderContext<V, E> renderContext, Map<V, Paint> nodeColors) { return node -> { Paint color = nodeColors != null && nodeColors.containsKey(node) ? nodeColors.get(node) : Color.WHITE; return renderContext.getPickedVertexState().isPicked(node) ? mixWith(color, Color.BLUE) : color; };//from w ww.j ava2 s . co m }