List of usage examples for javax.swing JDesktopPane setLayout
public void setLayout(LayoutManager mgr)
From source file:org.eclipse.wb.internal.swing.utils.SwingScreenshotMaker.java
public SwingScreenshotMaker(AbstractComponentInfo rootModel, Component rootComponent) { m_root = rootModel;/*from ww w .j av a 2s . 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(); } }