javax.swing.JDesktopPane Java Examples
The following examples show how to use
javax.swing.JDesktopPane.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SeaGlassDesktopPaneUI.java From seaglass with Apache License 2.0 | 6 votes |
void adjustSize() { JDesktopPane desktop = (JDesktopPane) getParent(); if (desktop != null) { int height = getPreferredSize().height; Insets insets = getInsets(); if (height == insets.top + insets.bottom) { if (getHeight() <= height) { // Initial size, because we have no buttons yet height += 21; } else { // We already have a good height height = getHeight(); } } setBounds(0, desktop.getHeight() - height, desktop.getWidth(), height); revalidate(); repaint(); } }
Example #2
Source File: Test6505027.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #3
Source File: Test6505027.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #4
Source File: WindowBuilders.java From visualvm with GNU General Public License v2.0 | 6 votes |
static ComponentBuilder getBuilder(Instance instance, Heap heap) { if (DetailsUtils.isSubclassOf(instance, JRootPane.class.getName())) { return new JRootPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JDesktopPane.class.getName())) { return new JDesktopPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JLayeredPane.class.getName())) { return new JLayeredPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Frame.class.getName())) { return new FrameBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Dialog.class.getName())) { return new DialogBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JInternalFrame.class.getName())) { return new JInternalFrameBuilder(instance, heap); } return null; }
Example #5
Source File: InternalFrameDemo.java From marathonv5 with Apache License 2.0 | 6 votes |
public InternalFrameDemo() { super("InternalFrameDemo"); // Make the big window be indented 50 pixels from each edge // of the screen. int inset = 50; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset * 2); // Set up the GUI. desktop = new JDesktopPane(); // a specialized layered pane createFrame(); // create first "window" setContentPane(desktop); setJMenuBar(createMenuBar()); // Make dragging a little faster but perhaps uglier. desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); }
Example #6
Source File: WindowBuilders.java From netbeans with Apache License 2.0 | 6 votes |
static ComponentBuilder getBuilder(Instance instance, Heap heap) { if (DetailsUtils.isSubclassOf(instance, JRootPane.class.getName())) { return new JRootPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JDesktopPane.class.getName())) { return new JDesktopPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JLayeredPane.class.getName())) { return new JLayeredPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Frame.class.getName())) { return new FrameBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Dialog.class.getName())) { return new DialogBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JInternalFrame.class.getName())) { return new JInternalFrameBuilder(instance, heap); } return null; }
Example #7
Source File: Test6505027.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #8
Source File: InternalFrameDemoHandler.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Creates the content for the application frame. * * @return a panel containing the basic user interface. */ private JDesktopPane init(final DemoController ctrl) { final JPanel content = new JPanel(new BorderLayout()); content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); content.add(createDefaultTable(data)); content.add(new JButton(ctrl.getExportAction()), BorderLayout.SOUTH); final JInternalFrame frame = new JInternalFrame(); frame.setClosable(false); frame.setVisible(true); frame.setContentPane(content); frame.pack(); final JDesktopPane desktop = new JDesktopPane(); desktop.setDoubleBuffered(false); desktop.add(frame); return desktop; }
Example #9
Source File: Test6505027.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #10
Source File: Test6505027.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #11
Source File: JInternalFrameDraggingTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void createAndShowGUI() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); desktopPane = new JDesktopPane(); desktopPane.setBackground(BACKGROUND_COLOR); frame.add(desktopPane, BorderLayout.CENTER); frame.setSize(FRAME_SIZE, FRAME_SIZE); frame.setVisible(true); internalFrame = new JInternalFrame("Test"); internalFrame.setSize(FRAME_SIZE / 2, FRAME_SIZE / 2); desktopPane.add(internalFrame); internalFrame.setVisible(true); internalFrame.setResizable(true); frame.setVisible(true); }
Example #12
Source File: Test6505027.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #13
Source File: Test6505027.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #14
Source File: Test6802868.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #15
Source File: InternalFrameDemo.java From beautyeye with Apache License 2.0 | 5 votes |
/** * InternalFrameDemo Constructor. * * @param swingset the swingset */ public InternalFrameDemo(SwingSet2 swingset) { super(swingset, "InternalFrameDemo" , "toolbar/JDesktop.gif"); // preload all the icons we need for this demo icon1 = createImageIcon("ImageClub/misc/fish.gif", getString("InternalFrameDemo.fish")); icon2 = createImageIcon("ImageClub/misc/moon.gif", getString("InternalFrameDemo.moon")); icon3 = createImageIcon("ImageClub/misc/sun.gif", getString("InternalFrameDemo.sun")); icon4 = createImageIcon("ImageClub/misc/cab.gif", getString("InternalFrameDemo.cab")); smIcon1 = createImageIcon("ImageClub/misc/fish_small.gif", getString("InternalFrameDemo.fish")); smIcon2 = createImageIcon("ImageClub/misc/moon_small.gif", getString("InternalFrameDemo.moon")); smIcon3 = createImageIcon("ImageClub/misc/sun_small.gif", getString("InternalFrameDemo.sun")); smIcon4 = createImageIcon("ImageClub/misc/cab_small.gif", getString("InternalFrameDemo.cab")); // Create the desktop pane desktop = new JDesktopPane(); getDemoPanel().add(desktop, BorderLayout.CENTER); // Create the "frame maker" palette createInternalFramePalette(); // Create an initial internal frame to show JInternalFrame frame1 = createInternalFrame(icon1, FIRST_FRAME_LAYER, 1, 1); frame1.setBounds(FRAME0_X, FRAME0_Y, FRAME0_WIDTH, FRAME0_HEIGHT); // Create four more starter windows createInternalFrame(icon1, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT); createInternalFrame(icon3, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT); createInternalFrame(icon4, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT); createInternalFrame(icon2, DEMO_FRAME_LAYER, FRAME_WIDTH, FRAME_HEIGHT); }
Example #16
Source File: Test6802868.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #17
Source File: Test6802868.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #18
Source File: Test6802868.java From hottub with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #19
Source File: InternalFrameDemo.java From littleluck with Apache License 2.0 | 5 votes |
/** * InternalFrameDemo Constructor */ public InternalFrameDemo() { setLayout(new BorderLayout()); // preload all the icons we need for this demo icon1 = resourceManager.createImageIcon("bananas.png", resourceManager.getString("InternalFrameDemo.bananas")); icon2 = resourceManager.createImageIcon("globe.png", resourceManager.getString("InternalFrameDemo.globe")); icon3 = resourceManager.createImageIcon("package.png", resourceManager.getString("InternalFrameDemo.package")); icon4 = resourceManager.createImageIcon("soccer_ball.png", resourceManager.getString("InternalFrameDemo.soccerball")); smIcon1 = resourceManager.createImageIcon("bananas_small.png", resourceManager.getString("InternalFrameDemo.bananas")); smIcon2 = resourceManager.createImageIcon("globe_small.png", resourceManager.getString("InternalFrameDemo.globe")); smIcon3 = resourceManager.createImageIcon("package_small.png", resourceManager.getString("InternalFrameDemo.package")); smIcon4 = resourceManager.createImageIcon("soccer_ball_small.png", resourceManager.getString("InternalFrameDemo.soccerball")); //<snip>Create desktop pane // The desktop pane will contain all the internal frames desktop = new JDesktopPane(); add(desktop, BorderLayout.CENTER); //</snip> // Create the "frame maker" palette createInternalFramePalette(); // Create an initial internal frame to show JInternalFrame frame1 = createInternalFrame(icon2, DEMO_FRAME_LAYER, 1, 1); frame1.setBounds(FRAME0_X, FRAME0_Y, FRAME0_WIDTH, FRAME0_HEIGHT); }
Example #20
Source File: OOODesktopManager.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
public void activateFrame(JInternalFrame f) { Container p = f.getParent(); Component[] c; JDesktopPane d = f.getDesktopPane(); JInternalFrame currentlyActiveFrame = (d == null) ? null : d.getSelectedFrame(); // fix for bug: 4162443 if (p == null) { // If the frame is not in parent, its icon maybe, check it p = f.getDesktopIcon().getParent(); if (p == null) return; } // we only need to keep track of the currentActive InternalFrame, if any if (currentlyActiveFrame == null) { if (d != null) { d.setSelectedFrame(f); } } else if (currentlyActiveFrame != f) { // if not the same frame as the current active // we deactivate the current if (currentlyActiveFrame.isSelected()) { try { currentlyActiveFrame.setSelected(false); } catch (Exception e2) { } } if (d != null) { d.setSelectedFrame(f); } } f.moveToFront(); }
Example #21
Source File: Test6802868.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #22
Source File: TestJInternalFrameIconify.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void createUI(String lookAndFeelString) throws Exception { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { frame = new JFrame(lookAndFeelString); desktopPane = new JDesktopPane(); frame.getContentPane().add(desktopPane); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JInternalFrame f = new JInternalFrame("Child ", true, true, true, true); f.setSize(200, 300); f.setLocation(20, 20); try { f.setIcon(true); } catch (PropertyVetoException ex) { errorMessage += ex.getMessage() + "\n"; } desktopPane.add(f); f.setVisible(true); frame.setSize(500, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); }
Example #23
Source File: Test6802868.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #24
Source File: JInternalFrameOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JInternalFrame.getDesktopPane()} through queue */ public JDesktopPane getDesktopPane() { return (runMapping(new MapAction<JDesktopPane>("getDesktopPane") { @Override public JDesktopPane map() { return ((JInternalFrame) getSource()).getDesktopPane(); } })); }
Example #25
Source File: GUI.java From AML-Project with Apache License 2.0 | 5 votes |
public GUI() { setTitle("AgreementMakerLight"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setDefaultLookAndFeelDecorated(true); amlMenuBar = new AMLMenuBar(); setJMenuBar(amlMenuBar); desktop = new JDesktopPane(); desktop.setLayout(new BorderLayout()); //Get the effective screen size GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); Dimension screenSize = env.getMaximumWindowBounds().getSize(); //Get the insets (shouldn't be necessary, but just in case) Insets insets = this.getInsets(); int w = insets.left + insets.right + 10; int h = insets.top + insets.bottom; //Determine width and height of the panels int width = screenSize.width - w; int panel = 85; int viewer = screenSize.height - h - panel - (4*amlMenuBar.getPreferredSize().height); //Set their dimensions panelMin = new Dimension(width - 20, panel); panelMax = new Dimension(width, panel); viewerMin = new Dimension(width, viewer); viewerMax = new Dimension(width, viewer); resourcePanel = new ResourcePanel(panelMax,panelMin); desktop.add(resourcePanel,BorderLayout.NORTH); alignPanel = new AlignmentPanel(viewerMax,viewerMin); desktop.add(alignPanel); setContentPane(desktop); this.pack(); setExtendedState(JFrame.MAXIMIZED_BOTH); setVisible(true); }
Example #26
Source File: JInternalFrameMoveOverlapping.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override protected void prepareControls() { JDesktopPane desktopPane = new JDesktopPane(); JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false); bottomFrame.setSize(220, 220); super.propagateAWTControls(bottomFrame); desktopPane.add(bottomFrame); bottomFrame.setVisible(true); JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false); topFrame.setSize(200, 200); topFrame.add(new JButton("LW Button") { { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lwClicked = true; } }); } }); desktopPane.add(topFrame); topFrame.setVisible(true); JFrame frame = new JFrame("Test Window"); frame.setSize(300, 300); frame.setContentPane(desktopPane); frame.setVisible(true); locTopFrame = topFrame.getLocationOnScreen(); locTarget = new Point(locTopFrame.x + bottomFrame.getWidth() / 2, locTopFrame.y + bottomFrame.getHeight()/2); }
Example #27
Source File: JInternalFrameOverlapping.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creating two JInternalFrames in JDesktopPanes. Put lightweight component into one frame and heavyweight into another. */ @Override protected void prepareControls() { JDesktopPane desktopPane = new JDesktopPane(); JFrame frame = new JFrame("Test Window"); frame.setSize(300, 300); frame.setContentPane(desktopPane); frame.setVisible(true); JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false); bottomFrame.setSize(220, 220); desktopPane.add(bottomFrame); bottomFrame.setVisible(true); super.propagateAWTControls(bottomFrame); JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false); topFrame.setSize(200, 200); JButton jbutton = new JButton("LW Button") {{ addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lwClicked = true; } }); }}; topFrame.add(jbutton); desktopPane.add(topFrame); topFrame.setVisible(true); lLoc = jbutton.getLocationOnScreen(); lLoc.translate(jbutton.getWidth()/2, jbutton.getWidth()/2); //click at middle of the button }
Example #28
Source File: SeaGlassDesktopPaneUI.java From seaglass with Apache License 2.0 | 5 votes |
public void propertyChange(PropertyChangeEvent evt) { if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) { updateStyle((JDesktopPane) evt.getSource()); } if (evt.getPropertyName() == "ancestor" && taskBar != null) { taskBar.adjustSize(); } }
Example #29
Source File: Test6802868.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #30
Source File: Test6802868.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }