Link to home
Start Free TrialLog in
Avatar of Ronayne
Ronayne

asked on

load a frame once

Im using the code below to load a frame every time a user opens the class file concerned with the following code. But I want the frame only to be loaded once, just when the user loads the class for the first time, and the for the class to be dynamically updated. The if statement im tyring to use throws an error when a second user trys to concurrently load the class file. Any help would be great, thanks.

public F(int NO){
            super("F");
            if(NO == 0){//this flag causes an error
            dis = new TextArea(20 , 10);
                  add("Center" , display);
          resize(300 , 150);
          show();
            }      
Avatar of Mick Barry
Mick Barry
Flag of Australia image

you need to change the code that actually create F.
Keep an instance to F, and reuse it.
Avatar of Ronayne
Ronayne

ASKER

Im creating different instances of f for different parameters passed in variable NO
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
does the question mean the instance of the frame can be open one at a time?

i try this using JInternalFrame.

set
-doDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); for the frame
-when you want to frame to be open, use setVisible(true);

i successfully restrict the frame to be loaded one at a time.

Feel free to discard this comment if this is not what you asking ;)

-Child that so pissed off!-