显示内部框架的技术是什么?

时间:2013-11-19 10:49:42

标签: java swing jinternalframe

显示JInternalFrame的技巧是什么?

Follow f = new Follow();

Follow是我的JInternalFrame,我想在JFrame上打印出来。在JFrame中,已经有一个JInternalFrame正在运行。我想在JInternalFrame上打印ConfirmDialog

1 个答案:

答案 0 :(得分:2)

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/** Simple example illustrating the use of internal frames.
 * 
 */

public class JInternalFrames extends JFrame {
  public static void main(String[] args) {
    new JInternalFrames();
  }

  public JInternalFrames() {
    super("Multiple Document Interface");
    WindowUtilities.setNativeLookAndFeel();
    addWindowListener(new ExitListener());
    Container content = getContentPane();
    content.setBackground(Color.white);
    JDesktopPane desktop = new JDesktopPane();
    desktop.setBackground(Color.white);
    content.add(desktop, BorderLayout.CENTER);
    setSize(450, 400);
    for(int i=0; i<5; i++) {
      JInternalFrame frame
        = new JInternalFrame(("Internal Frame " + i),
                             true, true, true, true);
      frame.setLocation(i*50+10, i*50+10);
      frame.setSize(200, 150);
      frame.setBackground(Color.white);
      desktop.add(frame);
      frame.moveToFront();
    }
    setVisible(true);
  }
}

enter image description here

另一个教程是Java Tutorials Code Sample – InternalFrameDemo.java