I try to create Multiple Document Interface. I use JDesktopPane and added three JInternalFrame on it. It looks like that: It works good but if I activate the first window it closes the second and third window and I was no longer able to open them. How to prevent the activation JInternalFrame?
This is how I create JInternalFrame:
protected void createFrame() {
MyInternalFrame frame = new MyInternalFrame();
frame.setVisible(true); //necessary as of 1.3
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
}
and there is class MyInternalFrame:
public class MyInternalFrame extends JInternalFrame{
static int openFrameCount = 0;
static final int xOffset = 30, yOffset = 30;
public MyInternalFrame() {
super("Document #" + (++openFrameCount),
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
//...Create the GUI and put it in the window...
//...Then set the window size or call pack...
setSize(300,300);
//Set the window's location.
setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
}
}