List of usage examples for javax.swing JInternalFrame JInternalFrame
public JInternalFrame(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
JInternalFrame
with the specified title, resizability, closability, maximizability, and iconifiability. 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 w w . j a v a2 s .c om*/ 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.OUTLINE_DRAG_MODE); desktop.remove(0); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
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;//w w w . j a v a 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.OUTLINE_DRAG_MODE); desktop.removeAll(); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:MainClass.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;// www. j a v a 2s . co 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.OUTLINE_DRAG_MODE); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:MainClass.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) }; InternalFrameListener internalFrameListener = new InternalFrameIconifyListener(); int pos = 0;//w ww.ja v a2 s. c o m for (JInternalFrame internalFrame : internalFrames) { desktop.add(internalFrame); internalFrame.setBounds(pos * 25, pos * 25, 200, 100); pos++; internalFrame.addInternalFrameListener(internalFrameListener); JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER); internalFrame.add(label, BorderLayout.CENTER); internalFrame.setVisible(true); } frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:InternalFrameListenerDemo.java
public static void main(final String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); JInternalFrame internalFrame = new JInternalFrame("Can Do All", true, true, true, true); desktop.add(internalFrame);/* w w w . j av a 2s .c o m*/ internalFrame.setBounds(25, 25, 200, 100); JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER); internalFrame.add(label, BorderLayout.CENTER); internalFrame.setVisible(true); internalFrame.addInternalFrameListener(new InternalFrameListener() { public void internalFrameClosing(InternalFrameEvent e) { displayMessage("Internal frame closing", e); } public void internalFrameClosed(InternalFrameEvent e) { displayMessage("Internal frame closed", e); } public void internalFrameOpened(InternalFrameEvent e) { displayMessage("Internal frame opened", e); } public void internalFrameIconified(InternalFrameEvent e) { displayMessage("Internal frame iconified", e); } public void internalFrameDeiconified(InternalFrameEvent e) { displayMessage("Internal frame deiconified", e); } public void internalFrameActivated(InternalFrameEvent e) { displayMessage("Internal frame activated", e); } public void internalFrameDeactivated(InternalFrameEvent e) { displayMessage("Internal frame deactivated", e); } void displayMessage(String prefix, InternalFrameEvent e) { System.out.println(prefix + ": " + e.getSource()); } }); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:DesktopSample.java
public static void main(String[] args) { String title = "Desktop Sample"; JFrame frame = new JFrame(title); 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) }; InternalFrameListener internalFrameListener = new InternalFrameIconifyListener(); for (int i = 0, n = internalFrames.length; i < n; i++) { desktop.add(internalFrames[i]);/*from ww w . j a v a 2 s . c om*/ internalFrames[i].setBounds(i * 25, i * 25, 200, 100); internalFrames[i].addInternalFrameListener(internalFrameListener); JLabel label = new JLabel(internalFrames[i].getTitle(), JLabel.CENTER); Container content = internalFrames[i].getContentPane(); content.add(label, BorderLayout.CENTER); internalFrames[i].setVisible(true); } JInternalFrame palette = new JInternalFrame("Palette", true, false, true, false); palette.setBounds(350, 150, 100, 100); palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); desktop.add(palette, JDesktopPane.PALETTE_LAYER); palette.setVisible(true); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); Container content = frame.getContentPane(); content.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:InternalFramePropertyChangeHandler.java
public static void main(final String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); JInternalFrame internalFrame = new JInternalFrame("Can Do All", true, true, true, true); InternalFramePropertyChangeHandler ins = new InternalFramePropertyChangeHandler(); // Add listener for iconification events internalFrame.addPropertyChangeListener(ins); desktop.add(internalFrame);//ww w . j a v a2s . com internalFrame.setBounds(25, 25, 200, 100); JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER); internalFrame.add(label, BorderLayout.CENTER); internalFrame.setVisible(true); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:InternalFrameIconifyListener.java
public static void main(final String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); JInternalFrame internalFrame = new JInternalFrame("Can Do All", true, true, true, true); InternalFrameListener internalFrameListener = new InternalFrameIconifyListener(); // Add listener for iconification events internalFrame.addInternalFrameListener(internalFrameListener); desktop.add(internalFrame);//from w w w.jav a2s .com internalFrame.setBounds(25, 25, 200, 100); JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER); internalFrame.add(label, BorderLayout.CENTER); internalFrame.setVisible(true); frame.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:ResourceModExample.java
public static void main(String[] args) { Border border = BorderFactory.createRaisedBevelBorder(); Border tripleBorder = new CompoundBorder(new CompoundBorder(border, border), border); UIManager.put("Button.border", tripleBorder); UIManager.put("InternalFrame.closeIcon", new ImageIcon("close.gif")); UIManager.put("InternalFrame.iconizeIcon", new ImageIcon("iconify.gif")); UIManager.put("InternalFrame.maximizeIcon", new ImageIcon("maximize.gif")); UIManager.put("InternalFrame.altMaximizeIcon", new ImageIcon("altMax.gif")); UIManager.put("InternalFrame.titleFont", new Font("Serif", Font.ITALIC, 12)); UIManager.put("ScrollBar.width", new Integer(30)); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container c = f.getContentPane(); JDesktopPane desk = new JDesktopPane(); c.add(desk, BorderLayout.CENTER); JButton cut = new JButton("Cut"); JButton copy = new JButton("Copy"); JButton paste = new JButton("Paste"); JPanel p = new JPanel(new FlowLayout()); p.add(cut);// w ww . j a va 2s . c om p.add(copy); p.add(paste); c.add(p, BorderLayout.SOUTH); JInternalFrame inf = new JInternalFrame("MyFrame", true, true, true, true); JLabel l = new JLabel(new ImageIcon("luggage.jpeg")); JScrollPane scroll = new JScrollPane(l); inf.setContentPane(scroll); inf.setBounds(10, 10, 350, 280); desk.add(inf); inf.setVisible(true); f.setSize(380, 360); f.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { final JFrame jf = new JFrame("JIFrameDemo Main Window"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); screenSize.width -= 42;// w ww . ja v a 2 s . c o m screenSize.height -= 42; jf.setSize(screenSize); jf.setLocation(20, 20); JMenuBar mb = new JMenuBar(); jf.setJMenuBar(mb); JMenu fm = new JMenu("File"); mb.add(fm); JMenuItem mi; fm.add(mi = new JMenuItem("Exit")); mi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); JDesktopPane dtp = new JDesktopPane(); //dtp.setBackground(Color.GREEN); jf.setContentPane(dtp); JInternalFrame mboxFrame = new JInternalFrame("Mail Reader", true, true, true, true); JLabel reader = new JLabel("Mail Reader Would Be Here"); mboxFrame.setContentPane(reader); mboxFrame.setSize(400, 300); mboxFrame.setLocation(50, 50); mboxFrame.setVisible(true); dtp.add(mboxFrame); JInternalFrame compFrame = new JInternalFrame("Compose Mail", true, true, true, true); JLabel composer = new JLabel("Mail Compose Would Be Here"); compFrame.setContentPane(composer); compFrame.setSize(300, 200); compFrame.setLocation(200, 200); compFrame.setVisible(true); dtp.add(compFrame); JInternalFrame listFrame = new JInternalFrame("Users", true, true, true, true); JLabel list = new JLabel("List of Users Would Be Here"); listFrame.setContentPane(list); listFrame.setLocation(400, 400); listFrame.setSize(500, 200); listFrame.setVisible(true); dtp.add(listFrame); jf.setVisible(true); jf.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { jf.setVisible(false); jf.dispose(); System.exit(0); } }); }