List of usage examples for org.jfree.chart.plot CompassPlot setBackgroundImageAlpha
public void setBackgroundImageAlpha(float alpha)
From source file:ucar.unidata.idv.flythrough.Flythrough.java
/** * _more_/* w w w .j a v a 2s . co m*/ * * @param g _more_ * @param comp _more_ */ public void paintDashboardAfter(Graphics g, JComponent comp) { Graphics2D g2 = (Graphics2D) g; AffineTransform oldTransform = g2.getTransform(); Rectangle b = dashboardLbl.getBounds(); int w = dashboardImage.getWidth(null); int h = dashboardImage.getHeight(null); Point ul = new Point(b.width / 2 - w / 2, b.height - h); int ptsIdx = 0; try { pipPanel.setPreferredSize(new Dimension(dialPts[ptsIdx][2], dialPts[ptsIdx][3])); pipFrame.setSize(dialPts[ptsIdx][2], dialPts[ptsIdx][3]); pipPanel.doLayout(); pipPanel.validate(); pipFrame.pack(); pipPanel.resetDrawBounds(); pipPanel.redraw(); } catch (Exception ignore) { } JLabel locLbl = null; if (lastLocation != null) { try { locLbl = new JLabel("<html><table width=100%><tr><td align=right> Lat:</td></td>" + getIdv().getDisplayConventions().formatLatLon(getLat(lastLocation)) + "</td></tr>" + "<tr><td align=right> Lon:</td></td>" + getIdv().getDisplayConventions().formatLatLon(getLon(lastLocation)) + "</td></tr>" + "<tr><td align=right> Alt:</td></td>" + getIdv().getDisplayConventions().formatDistance(getAlt(lastLocation)) + "</table>"); } catch (Exception ignore) { } } if (locLbl == null) { locLbl = new JLabel( "<html><table width=100%><tr><td align=right> Lat:</td></td>N/A </td></tr><tr><td align=right> Lon:</td></td>N/A </td></tr><tr><td align=right> Alt:</td></td>N/A </table>"); } locLbl.setOpaque(true); locLbl.setBackground(Color.white); DefaultValueDataset headingDataset = new DefaultValueDataset(new Double(currentHeading)); CompassPlot plot = new CompassPlot(headingDataset); plot.setSeriesNeedle(0); plot.setSeriesPaint(0, Color.red); plot.setSeriesOutlinePaint(0, Color.red); JFreeChart chart = new JFreeChart("", plot); ChartPanel compassPanel = new ChartPanel(chart); plot.setBackgroundPaint(new Color(255, 255, 255, 0)); plot.setBackgroundImageAlpha(0.0f); chart.setBackgroundPaint(new Color(255, 255, 255, 0)); compassPanel.setBackground(new Color(255, 255, 255, 0)); compassPanel.setPreferredSize(dialDimension); // compassPanel.setSize(new Dimension(100,100)); g2.setTransform(oldTransform); pipRect = drawDial(g2, pipPanel, ptsIdx++, ul); JFrame dummyFrame = new JFrame(""); dummyFrame.setContentPane(compassPanel); dummyFrame.pack(); g2.setTransform(oldTransform); drawDial(g2, compassPanel, ptsIdx++, ul); g2.setTransform(oldTransform); dummyFrame.setContentPane(locLbl); dummyFrame.pack(); drawDial(g2, locLbl, ptsIdx++, ul); if (showReadout) { for (JComponent dial : dials) { dummyFrame.setContentPane(dial); dummyFrame.pack(); g2.setTransform(oldTransform); drawDial(g2, dial, ptsIdx++, ul); } } g2.setTransform(oldTransform); }