List of usage examples for javax.swing JDesktopPane add
public Component add(Component comp)
From source file:Software_Jframes.chart.java
public void barchart(JDesktopPane jdesktop) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); try {/*from w w w .j av a 2 s . c o m*/ ResultSet rs = db.statement().executeQuery("select date,name,amount from other_exp"); while (rs.next()) { String date = rs.getString("date"); String name = rs.getString("name"); String amnt = rs.getString("Amount"); int amount = Integer.parseInt(amnt); dataset.setValue(amount, name, date); } } catch (Exception e) { } JFreeChart chart = ChartFactory.createBarChart("Other Expenses for Last week", "Date", "Expense", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setBackgroundPaint(Color.WHITE); p.setRangeGridlinePaint(Color.black); ChartPanel panel = new ChartPanel(chart); jdesktop.add(panel).setSize(550, 230); }
From source file:org.eclipse.wb.internal.swing.utils.SwingScreenshotMaker.java
public SwingScreenshotMaker(AbstractComponentInfo rootModel, Component rootComponent) { m_root = rootModel;/*from ww w. ja va2s .c o m*/ SwingUtils.ensureQueueEmpty(); // fill images map with key m_componentImages.put(rootComponent, null); rootModel.accept(new ObjectInfoVisitor() { @Override public void endVisit(ObjectInfo objectInfo) throws Exception { if (objectInfo instanceof ComponentInfo) { m_componentImages.put(((ComponentInfo) objectInfo).getComponent(), null); } } }); // prepare component m_component = rootComponent; if (m_component instanceof Window) { m_window = (Window) m_component; } else { JFrame frame = new JFrame(); m_window = frame; // configure panel to have same size as given component JPanel panel; { panel = new JPanel(new BorderLayout()); panel.setPreferredSize(m_component.getSize()); frame.getContentPane().add(panel, BorderLayout.CENTER); } // add component if (m_component instanceof JInternalFrame) { JDesktopPane desktop = new JDesktopPane(); desktop.setLayout(new BorderLayout()); panel.add(desktop); desktop.add(m_component); m_component.setVisible(true); } else { panel.add(m_component); } frame.pack(); } }
From source file:org.renjin.desktop.MainFrame.java
public MainFrame() { super("Renjin"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); desktop.setBackground(new Color(171, 171, 171)); JInternalFrame internalFrame = new JInternalFrame("R Console", true, true, true, true); console = new JConsole(); internalFrame.add(console, BorderLayout.CENTER); internalFrame.setBounds(25, 25, 600, 300); internalFrame.setVisible(true);/*ww w.j ava 2s.c om*/ desktop.add(internalFrame); add(desktop, BorderLayout.CENTER); setSize(650, 450); setVisible(true); }