FileDocCategorySizeDatePackage
SimpleInternalFrame.javaAPI DocExample1783Mon Nov 09 12:43:34 GMT 1998None

SimpleInternalFrame

public class SimpleInternalFrame extends Frame implements ActionListener

Fields Summary
JButton
openButton
JButton
winButton
JButton
javaButton
JButton
motifButton
JLayeredPane
desktop
JInternalFrame
internalFrame
Constructors Summary
public SimpleInternalFrame()

    super("Internal Frame Demo");
    setSize(500,400);
    openButton = new JButton("Open");
    winButton = new JButton("Windows");
    javaButton = new JButton("Metal");
    motifButton = new JButton("Motif");
    Panel p = new Panel();
    p.add(openButton);
    p.add(javaButton);
    p.add(motifButton);
    p.add(winButton);
    add(p, BorderLayout.SOUTH);
    addWindowListener(new BasicWindowMonitor());
    openButton.addActionListener(this);
    LnFListener lnf = new LnFListener(this);
    winButton.addActionListener(lnf);
    javaButton.addActionListener(lnf);
    motifButton.addActionListener(lnf);

    // Set up the layered pane
    desktop = new JDesktopPane();
    desktop.setOpaque(true);
    add(desktop, BorderLayout.CENTER);
  
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

    if ((internalFrame == null) || (internalFrame.isClosed())) {
      internalFrame = new JInternalFrame("Internal Frame", 
					 true, true, true, true);
      internalFrame.setBounds(50, 50, 200, 100);
      if (internalFrame.isIconifiable()) {
	System.out.println("It's iconifiable...");
      }
      else { // bug work around...
	internalFrame.setIconifiable(true);
      }
      desktop.add(internalFrame, new Integer(1));    
    }
  
public static voidmain(java.lang.String[] args)

    SimpleInternalFrame sif = new SimpleInternalFrame();
    sif.setVisible(true);