List of usage examples for javax.swing JDesktopPane LIVE_DRAG_MODE
int LIVE_DRAG_MODE
To view the source code for javax.swing JDesktopPane LIVE_DRAG_MODE.
Click Source Link
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); JInternalFrame internalFrames[] = { new JInternalFrame("Can Do All", true, true, true, true), new JInternalFrame("Not Resizable", false, true, true, true), new JInternalFrame("Not Closable", true, false, true, true), new JInternalFrame("Not Maximizable", true, true, false, true), new JInternalFrame("Not Iconifiable", true, true, true, false) }; int pos = 0;/*from w ww . j ava 2 s. c o m*/ for (JInternalFrame internalFrame : internalFrames) { desktop.add(internalFrame); internalFrame.setBounds(pos * 25, pos * 25, 200, 100); pos++; JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER); internalFrame.add(label, BorderLayout.CENTER); internalFrame.setVisible(true); } desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:InternalFrameTest.java
public DesktopFrame() { setTitle("InternalFrameTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); desktop = new JDesktopPane(); add(desktop, BorderLayout.CENTER); // set up menus JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar);/*from w w w. j a v a2s . c o m*/ JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu); JMenuItem openItem = new JMenuItem("New"); openItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { createInternalFrame(new JLabel(new ImageIcon(planets[counter] + ".gif")), planets[counter]); counter = (counter + 1) % planets.length; } }); fileMenu.add(openItem); JMenuItem exitItem = new JMenuItem("Exit"); exitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { System.exit(0); } }); fileMenu.add(exitItem); JMenu windowMenu = new JMenu("Window"); menuBar.add(windowMenu); JMenuItem nextItem = new JMenuItem("Next"); nextItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { selectNextWindow(); } }); windowMenu.add(nextItem); JMenuItem cascadeItem = new JMenuItem("Cascade"); cascadeItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { cascadeWindows(); } }); windowMenu.add(cascadeItem); JMenuItem tileItem = new JMenuItem("Tile"); tileItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { tileWindows(); } }); windowMenu.add(tileItem); final JCheckBoxMenuItem dragOutlineItem = new JCheckBoxMenuItem("Drag Outline"); dragOutlineItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { desktop.setDragMode(dragOutlineItem.isSelected() ? JDesktopPane.OUTLINE_DRAG_MODE : JDesktopPane.LIVE_DRAG_MODE); } }); windowMenu.add(dragOutlineItem); }
From source file:org.en.tealEye.guiMain.MainAppFrame.java
protected JFrame buildApplicationFrame() { jFrame.setTitle(Application.APPLICATION_NAME + " " + Application.APPLICATION_VERSION); jFrame.setLayout(new BorderLayout()); jFrame.setSize(1024, 768);/*from w w w . j av a2 s. c o m*/ jFrame.getContentPane().add(constructDesktopEnvironment(), BorderLayout.CENTER); jFrame.getContentPane().add(constructMainMenu(), BorderLayout.NORTH); jFrame.getContentPane().add(constructFloatingMenuEnvironment(), BorderLayout.WEST); jFrame.getContentPane().add(constructTaskbarEnvironment(), BorderLayout.SOUTH); desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE); jFrame.addWindowListener(windowController); jFrame.addKeyListener(new MainController(h)); jFrame.setVisible(true); jFrame.validate(); jFrame.requestFocus(); return jFrame; }