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:Software_Jframes.chart.java
public void piechart(JDesktopPane jDesktopPane1, String pid) { DefaultPieDataset piedataset = new DefaultPieDataset(); try {//www . j a v a2s.c o m ResultSet rs = db.statement() .executeQuery("select name,cost from project_level_payment where projectid='" + pid + "' "); while (rs.next()) { String cost = rs.getString("cost"); int cost_int1 = Integer.parseInt(cost); String name = rs.getString("name"); piedataset.setValue(name, new Integer(cost_int1)); } } catch (Exception e) { e.printStackTrace(); } JFreeChart chart = ChartFactory.createPieChart("Costs for Project", piedataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); p.setBackgroundPaint(Color.white); ChartPanel panel = new ChartPanel(chart); jDesktopPane1.add(panel).setSize(440, 300); }
From source file:org.jfree.chart.demo.AreaChartDemo1.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createAreaChart("Area Chart", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); TextTitle texttitle = new TextTitle( "An area chart demonstration. We use this subtitle as an example of what happens when you get a really long title or subtitle."); texttitle.setFont(new Font("SansSerif", 0, 12)); texttitle.setPosition(RectangleEdge.TOP); texttitle.setPadding(new RectangleInsets(UnitType.RELATIVE, 0.050000000000000003D, 0.050000000000000003D, 0.050000000000000003D, 0.050000000000000003D)); texttitle.setVerticalAlignment(VerticalAlignment.BOTTOM); jfreechart.addSubtitle(texttitle);/*from www .j a v a 2 s.com*/ CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setForegroundAlpha(0.5F); categoryplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setDomainGridlinesVisible(true); categoryplot.setDomainGridlinePaint(Color.white); categoryplot.setRangeGridlinesVisible(true); categoryplot.setRangeGridlinePaint(Color.white); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); categoryaxis.setLowerMargin(0.0D); categoryaxis.setUpperMargin(0.0D); categoryaxis.addCategoryLabelToolTip("Type 1", "The first type."); categoryaxis.addCategoryLabelToolTip("Type 2", "The second type."); categoryaxis.addCategoryLabelToolTip("Type 3", "The third type."); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis.setLabelAngle(0.0D); return jfreechart; }
From source file:chart.DualAxis.java
/** * Creates a new demo instance./*from w ww. j ava2s .c om*/ * * @param title the frame title. */ public DualAxis(final String title, double[] xData, double[] YDataAnalitic, double[] YDataNumerical) { super(title); final CategoryDataset dataset1 = createDataset1(xData, YDataAnalitic); // create the chart... final JFreeChart chart = ChartFactory.createLineChart("", // chart title "x", // domain axis label "y", // range axis label dataset1, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips? false // URL generator? Not required... ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // chart.getLegend().setAnchor(Legend.SOUTH); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(new Color(0xEE, 0xEE, 0xFF)); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); final CategoryDataset dataset2 = createDataset2(xData, YDataNumerical); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); //final ValueAxis axis2 = new NumberAxis(""); final ValueAxis axis2 = new NumberAxis(" "); plot.setRangeAxis(1, axis2); final LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); renderer2.setToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setRenderer(1, renderer2); plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE); // OPTIONAL CUSTOMISATION COMPLETED. // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); // panel.removeAll(); // panel.add(chartPanel); // panel.validate(); }
From source file:InternalFrameListenerDemo.java
public InternalFrameListenerDemo() { setTitle("Animated InternalFrameListener"); m_count = m_tencount = 0;//from www .j av a 2 s . c om JPanel innerListenerPanel = new JPanel(new GridLayout(7, 1)); JPanel listenerPanel = new JPanel(new BorderLayout()); m_ifEventCanvas = new IFEventCanvas(); m_lOpened = new JLabel("internalFrameOpened"); m_lClosing = new JLabel("internalFrameClosing"); m_lClosed = new JLabel("internalFrameClosed"); m_lIconified = new JLabel("internalFrameIconified"); m_lDeiconified = new JLabel("internalFrameDeiconified"); m_lActivated = new JLabel("internalFrameActivated"); m_lDeactivated = new JLabel("internalFrameDeactivated"); innerListenerPanel.add(m_lOpened); innerListenerPanel.add(m_lClosing); innerListenerPanel.add(m_lClosed); innerListenerPanel.add(m_lIconified); innerListenerPanel.add(m_lDeiconified); innerListenerPanel.add(m_lActivated); innerListenerPanel.add(m_lDeactivated); listenerPanel.add("Center", m_ifEventCanvas); listenerPanel.add("West", innerListenerPanel); listenerPanel.setOpaque(true); listenerPanel.setBackground(Color.white); m_desktop = new JDesktopPane(); m_desktop.setBorder(new SoftBevelBorder(BevelBorder.LOWERED)); m_newFrame = new JButton("New Frame"); m_newFrame.addActionListener(this); m_infos = UIManager.getInstalledLookAndFeels(); String[] LAFNames = new String[m_infos.length]; for (int i = 0; i < m_infos.length; i++) { LAFNames[i] = m_infos[i].getName(); } m_UIBox = new JComboBox(LAFNames); m_UIBox.addActionListener(this); JPanel topPanel = new JPanel(true); topPanel.setLayout(new FlowLayout()); topPanel.setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(2, 2, 2, 2), new SoftBevelBorder(BevelBorder.RAISED)))); getContentPane().setLayout(new BorderLayout()); getContentPane().add("North", topPanel); getContentPane().add("Center", m_desktop); getContentPane().add("South", listenerPanel); ((JPanel) getContentPane()).setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED), new CompoundBorder(new EmptyBorder(1, 1, 1, 1), new SoftBevelBorder(BevelBorder.RAISED)))); topPanel.add(m_newFrame); topPanel.add(new JLabel("Look & Feel:", SwingConstants.RIGHT)); topPanel.add(m_UIBox); setSize(645, 500); Dimension dim = getToolkit().getScreenSize(); setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2 - getHeight() / 2); setVisible(true); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(l); m_eventTimer = new Timer(1000, this); m_eventTimer.setRepeats(true); m_eventTimer.start(); }
From source file:net.dv8tion.jda.utils.AvatarUtil.java
private static BufferedImage resize(BufferedImage originalImage) { BufferedImage resizedImage = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_RGB); Graphics2D g = resizedImage.createGraphics(); g.setComposite(AlphaComposite.Src); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.drawImage(originalImage, 0, 0, SIZE, SIZE, Color.white, null); g.dispose();/*from ww w.j a v a2s . co m*/ return resizedImage; }
From source file:DashboardInterface.CableOutSpeedDial.java
public CableOutSpeedDial(JPanel parentIn) { super(new BorderLayout()); parent = parentIn;/*from w w w . java2 s . co m*/ dataset1 = new DefaultValueDataset(0D); dataset2 = new DefaultValueDataset(0D); pipe = MessagePipeline.getInstance(); pipe.attach(this); DialPlot dialplot = new DialPlot(); dialplot.setView(0.0D, 0.0D, 1.0D, 1.0D); dialplot.setDataset(0, dataset1); dialplot.setDataset(1, dataset2); setBackground(Color.WHITE); StandardDialFrame standarddialframe = new StandardDialFrame(); standarddialframe.setBackgroundPaint(Color.lightGray); standarddialframe.setForegroundPaint(Color.darkGray); dialplot.setDialFrame(standarddialframe); DialBackground dialbackground = new DialBackground(Color.LIGHT_GRAY); dialbackground.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL)); dialplot.setBackground(dialbackground); DialTextAnnotation dialtextannotation = new DialTextAnnotation("Cable Out (ft)"); dialtextannotation.setFont(new Font("Dialog", 1, 12)); dialtextannotation.setPaint(new Color(36, 130, 9)); dialtextannotation.setRadius(0.47999999999999996D); dialplot.addLayer(dialtextannotation); DialTextAnnotation dialtextannotation2 = new DialTextAnnotation("Speed (kts)"); dialtextannotation2.setFont(new Font("Dialog", 1, 12)); dialtextannotation2.setPaint(Color.BLUE); dialtextannotation2.setRadius(0.78999999999999996D); dialplot.addLayer(dialtextannotation2); /*DialValueIndicator dialvalueindicator = new DialValueIndicator(0); dialvalueindicator.setFont(new Font("Dialog", 0, 10)); dialvalueindicator.setOutlinePaint(Color.BLACK); dialvalueindicator.setRadius(0.84999999999999998D); dialvalueindicator.setAngle(-90D); dialplot.addLayer(dialvalueindicator); DialValueIndicator dialvalueindicator1 = new DialValueIndicator(1); dialvalueindicator1.setFont(new Font("Dialog", 0, 10)); dialvalueindicator1.setOutlinePaint(Color.BLACK); dialvalueindicator1.setRadius(0.60999999999999998D); dialvalueindicator1.setAngle(-90D); dialplot.addLayer(dialvalueindicator1);*/ StandardDialScale standarddialscale = new StandardDialScale(0D, 90D, -110D, -320D, 10D, 4); standarddialscale.setTickRadius(0.88D); standarddialscale.setTickLabelOffset(0.14999999999999999D); standarddialscale.setTickLabelFont(new Font("Dialog", 0, 14)); standarddialscale.setMajorTickPaint(Color.BLUE); standarddialscale.setMinorTickPaint(Color.BLUE); dialplot.addScale(0, standarddialscale); StandardDialScale standarddialscale1 = new StandardDialScale(0.0D, 6000D, -110D, -320D, 750D, 4); standarddialscale1.setTickRadius(0.5D); standarddialscale1.setTickLabelOffset(0.14999999999999999D); standarddialscale1.setTickLabelFont(new Font("Dialog", 0, 10)); standarddialscale1.setTickLabelPaint(new Color(36, 130, 9)); standarddialscale1.setMajorTickPaint(new Color(36, 130, 9)); standarddialscale1.setMinorTickPaint(new Color(36, 130, 9)); dialplot.addScale(1, standarddialscale1); dialplot.mapDatasetToScale(1, 1); org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer( 0); pointer.setFillPaint(Color.BLUE); dialplot.addPointer(pointer); org.jfree.chart.plot.dial.DialPointer.Pointer pin = new org.jfree.chart.plot.dial.DialPointer.Pointer(1); pin.setRadius(0.55000000000000004D); pin.setFillPaint(new Color(36, 130, 9)); dialplot.addPointer(pin); DialCap dialcap = new DialCap(); dialcap.setRadius(0.10000000000000001D); dialplot.setCap(dialcap); Dimension size = parent.getBounds().getSize(); int width = parent.getWidth(); int height = parent.getHeight(); width = 200; JFreeChart jfreechart = new JFreeChart(dialplot); jfreechart.setBackgroundPaint(Color.WHITE); ChartPanel chartpanel = new ChartPanel(jfreechart); chartpanel.setPreferredSize(new Dimension(width, width)); add(chartpanel); }
From source file:graph.MySensorPanel.java
/** * Creates a new self-contained demo panel. */// www.j a va 2 s.c o m public MySensorPanel(String header_str) { //super(new BorderLayout()); this.series1 = new TimeSeries("Temperature"); this.series2 = new TimeSeries("Humidity"); TimeSeriesCollection dataset1 = new TimeSeriesCollection(this.series1); TimeSeriesCollection dataset2 = new TimeSeriesCollection(this.series2); JFreeChart chart = ChartFactory.createTimeSeriesChart(header_str, "Time", "C", dataset1, true, true, false); /*this.addChart(chart);*/ XYPlot plot = (XYPlot) chart.getPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(1000.0 * 60 * 60 /* 24*/); // 24 hrs plot.setDataset(1, dataset2); NumberAxis rangeAxis2 = new NumberAxis("%"); rangeAxis2.setAutoRangeIncludesZero(false); plot.setRenderer(1, new DefaultXYItemRenderer()); plot.setRangeAxis(1, rangeAxis2); plot.mapDatasetToRangeAxis(1, 1); ChartUtilities.applyCurrentTheme(chart); plot.setBackgroundPaint(Color.DARK_GRAY); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); chartPanel = new ChartPanel(chart); }
From source file:Main.java
public void clear() { graphics2D.setPaint(Color.white); graphics2D.fillRect(0, 0, getSize().width, getSize().height); graphics2D.setPaint(Color.black); repaint(); }
From source file:com.opendoorlogistics.components.barchart.BarchartPanel.java
@Override protected JFreeChart createChart(ODLTableReadOnly table, int[] rowFilter) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); if (rowFilter != null) { for (int row : rowFilter) { createRowData(table, dataset, row); }//from w w w. j ava2s . c o m } else { int n = table.getRowCount(); for (int row = 0; row < n; row++) { createRowData(table, dataset, row); } } // create the chart... JFreeChart chart = ChartFactory.createBarChart( Strings.isEmpty(config.getTitle()) ? null : config.getTitle(), // chart title config.getXLabel(), // domain axis label config.getYLabel(), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); // set the background color for the chart... chart.setBackgroundPaint(Color.WHITE); // don't show legend for just one series if (((BarchartConfig) config).getSeriesNames().size() <= 1) { chart.removeLegend(); } return chart; }
From source file:misc.ScrollablePicture.java
public ScrollablePicture(ImageIcon i, int m) { super(i);//from w ww . j a v a 2s . c o m if (i == null) { missingPicture = true; setText("No picture found."); setHorizontalAlignment(CENTER); setOpaque(true); setBackground(Color.white); } maxUnitIncrement = m; }