1

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);
    }

}
Yassin Hajaj
  • 21,337
  • 9
  • 51
  • 89
  • 1
    For better help sooner, post a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). – Andrew Thompson Nov 14 '15 at 21:41
  • 1
    There's no reason this should be happening, there must be something in your code you're not showing us – MadProgrammer Nov 14 '15 at 22:21
  • @MadProgrammer, maybe I badly described the problem. I'm sorry for my english. There are no problem in my code. My problem is that I'dont know how to change my code. I want to prevent activate one of my JIntenalFrames and I don't know how to do that. – Александр Елизаров Nov 15 '15 at 08:16

0 Answers0