Java by API/javax.swing/JInternalFrame
Версия от 17:43, 31 мая 2010; (обсуждение)
Содержание
- 1 extends JInternalFrame
- 2 JInternalFrame: add(Component comp)
- 3 JInternalFrame: addInternalFrameListener
- 4 JInternalFrame: addPropertyChangeListener(PropertyChangeListener lis)
- 5 JInternalFrame: addVetoableChangeListener(VetoableChangeListener listener)
- 6 JInternalFrame: getTitle()
- 7 JInternalFrame: isClosable();
- 8 JInternalFrame: isIcon();
- 9 JInternalFrame: isIconifiable();
- 10 JInternalFrame.IS_ICON_PROPERTY
- 11 JInternalFrame: isMaximizable();
- 12 JInternalFrame.isPalette
- 13 JInternalFrame: isResizable();
- 14 JInternalFrame: isSelected();
- 15 JInternalFrame: isVisible();
- 16 JInternalFrame: putClientProperty(Object key,Object value)
- 17 JInternalFrame: setBounds(int x, int y, int width, int height)
- 18 JInternalFrame: setContentPane(Container c)
- 19 JInternalFrame: setVisible(boolean aFlag)
- 20 new JInternalFrame(String title,boolean resizable,boolean closable,boolean maximizable,boolean iconifiable)
extends JInternalFrame
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
public class MainClass {
public static void main(String args[]) {
JFrame f = new JFrame("Sample");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLayeredPane desktop = new JDesktopPane();
desktop.setOpaque(false);
desktop.add(new SelfInternalFrame("1"), JLayeredPane.POPUP_LAYER);
f.add(desktop, BorderLayout.CENTER);
f.setSize(300, 200);
f.setVisible(true);
}
}
class SelfInternalFrame extends JInternalFrame {
public SelfInternalFrame(String s) {
getContentPane().add(new JLabel(s), BorderLayout.CENTER);
setBounds(50, 50, 100, 100);
setResizable(true);
setClosable(true);
setMaximizable(true);
setIconifiable(true);
setTitle(s);
setVisible(true);
}
}
JInternalFrame: add(Component comp)
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
public class Main {
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);
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);
}
}
JInternalFrame: addInternalFrameListener
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
public class MainClass {
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;
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);
}
}
class InternalFrameIconifyListener extends InternalFrameAdapter {
public void internalFrameIconified(InternalFrameEvent internalFrameEvent) {
JInternalFrame source = (JInternalFrame)internalFrameEvent.getSource();
System.out.println ("Iconified: " + source.getTitle());
}
public void internalFrameDeiconified(InternalFrameEvent internalFrameEvent) {
JInternalFrame source = (JInternalFrame)internalFrameEvent.getSource();
System.out.println ("Deiconified: " + source.getTitle());
}
}
JInternalFrame: addPropertyChangeListener(PropertyChangeListener lis)
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
public class MainClass {
public static void main(final String args[]) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JDesktopPane desktop = new JDesktopPane();
JInternalFrame palette = new JInternalFrame("Palette", true, true, true,
true);
palette.addPropertyChangeListener(new InternalFramePropertyChangeHandler());
palette.setBounds(350, 150, 100, 100);
desktop.add(palette, JDesktopPane.PALETTE_LAYER);
palette.setVisible(true);
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
class InternalFramePropertyChangeHandler implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
String propertyName = propertyChangeEvent.getPropertyName();
if (propertyName.equals(JInternalFrame.IS_ICON_PROPERTY)) {
System.out.println("Icon property changed. React.");
}
}
}
JInternalFrame: addVetoableChangeListener(VetoableChangeListener listener)
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
public class MainClass {
public static void main(final String args[]) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JDesktopPane desktop = new JDesktopPane();
JInternalFrame palette = new JInternalFrame("Palette", true, true, true,
true);
palette.addVetoableChangeListener(new IconPolice());
palette.setBounds(350, 150, 100, 100);
desktop.add(palette, JDesktopPane.PALETTE_LAYER);
palette.setVisible(true);
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
class IconPolice implements VetoableChangeListener {
public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
String name = ev.getPropertyName();
if (name.equals(JInternalFrame.IS_ICON_PROPERTY) && (ev.getNewValue() == Boolean.TRUE)) {
System.out.println("JInternalFrame.IS_ICON_PROPERTY");
}
}
}
JInternalFrame: getTitle()
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame: isClosable();
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame: isIcon();
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame: isIconifiable();
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame.IS_ICON_PROPERTY
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
public class MainClass {
public static void main(final String args[]) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JDesktopPane desktop = new JDesktopPane();
JInternalFrame palette = new JInternalFrame("Palette", true, true, true,
true);
palette.addPropertyChangeListener(new InternalFramePropertyChangeHandler());
palette.setBounds(350, 150, 100, 100);
desktop.add(palette, JDesktopPane.PALETTE_LAYER);
palette.setVisible(true);
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
class InternalFramePropertyChangeHandler implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
String propertyName = propertyChangeEvent.getPropertyName();
if (propertyName.equals(JInternalFrame.IS_ICON_PROPERTY)) {
System.out.println("Icon property changed. React.");
}
}
}
JInternalFrame: isMaximizable();
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame.isPalette
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
public class MainClass {
public static void main(final String args[]) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JDesktopPane desktop = new JDesktopPane();
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);
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
JInternalFrame: isResizable();
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame: isSelected();
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame: isVisible();
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
public class Main {
public static void main(String[] argv) throws Exception {
JDesktopPane desktop = new JDesktopPane();
JInternalFrame[] frames = desktop.getAllFrames();
for (int i = 0; i < frames.length; i++) {
String title = frames[i].getTitle();
boolean isVisible = frames[i].isVisible();
boolean isCloseable = frames[i].isClosable();
boolean isResizeable = frames[i].isResizable();
boolean isIconifiable = frames[i].isIconifiable();
boolean isIcon = frames[i].isIcon();
boolean isMaximizable = frames[i].isMaximizable();
boolean isSelected = frames[i].isSelected();
}
}
}
JInternalFrame: putClientProperty(Object key,Object value)
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
public class MainClass {
public static void main(final String args[]) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JDesktopPane desktop = new JDesktopPane();
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);
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
JInternalFrame: setBounds(int x, int y, int width, int height)
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
public class Main {
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;
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);
}
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
JInternalFrame: setContentPane(Container c)
/*
* Copyright (c) Ian F. Darwin, http://www.darwinsys.ru/, 1996-2002.
* All rights reserved. Software written by Ian F. Darwin and others.
* $Id: LICENSE,v 1.8 2004/02/09 03:33:38 ian Exp $
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS""
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Java, the Duke mascot, and all variants of Sun"s Java "steaming coffee
* cup" logo are trademarks of Sun Microsystems. Sun"s, and James Gosling"s,
* pioneering role in inventing and promulgating (and standardizing) the Java
* language and environment is gratefully acknowledged.
*
* The pioneering role of Dennis Ritchie and Bjarne Stroustrup, of AT&T, for
* inventing predecessor languages C and C++ is also gratefully acknowledged.
*/
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
/**
* Internal Frames Demo
*
* @version $Id: JIFrameDemo.java,v 1.4 2003/07/15 01:46:47 ian Exp $
*/
public class Main {
/* Main View */
public static void main(String[] a) {
final JFrame jf = new JFrame("JIFrameDemo Main Window");
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
screenSize.width -= 42;
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);
}
});
}
}
JInternalFrame: setVisible(boolean aFlag)
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
public class Main {
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;
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);
}
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}
new JInternalFrame(String title,boolean resizable,boolean closable,boolean maximizable,boolean iconifiable)
import java.awt.BorderLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
public class MainClass {
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;
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);
}
frame.add(desktop, BorderLayout.CENTER);
frame.setSize(500, 300);
frame.setVisible(true);
}
}