显示JInternalFrame
的技巧是什么?
Follow f = new Follow();
Follow
是我的JInternalFrame
,我想在JFrame
上打印出来。在JFrame
中,已经有一个JInternalFrame
正在运行。我想在JInternalFrame
上打印ConfirmDialog
。
答案 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);
}
}