Help,Components inside my Frame would not be displayed until maximized.
Femi Alla
Ranch Hand
Joined: Jul 05, 2002
Posts: 79
posted
0
Greetings everyone, I have this application I developed ( the full version is in the IO section, under the topic,
I need help with seeking to abitrary positions within a text file
) but the GUI of the application has this problem I don't seem to know how to resolve. This is it; when you run this application, an empty frame is displayed. You'll then have to maximize the frame/window to see all the TextFields and TextAreas that have been added to the frame. You can then restore it to it's original size and these things still get displayed. They never get displayed unless you first maximize it. Can anyone help figure out what's wrong? Here's the GUI part of the application and it still has this same behaviour.
Remove frame.add(p); from this location and put add( p ); in your constructor. You are setting up the panel and setting the frame's size and making the frame visible in with the constructor, then you add the panel to the frame... this is out of order...
Femi Alla
Ranch Hand
Joined: Jul 05, 2002
Posts: 79
posted
0
Thank you very much.
Femi Alla
Ranch Hand
Joined: Jul 05, 2002
Posts: 79
posted
0
I see the logic in your explanation. I did just that but problem still persists. Could you please take a closer look?
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
Change the display part to look like this:
It is moving the add like Nathan said and replacing the setVisible with show.
Femi Alla
Ranch Hand
Joined: Jul 05, 2002
Posts: 79
posted
0
Thanks a lot Paul, but then I still would like to know why I should use show() and not setvisible. Are there any advantages? Again, thanks.
Femi Alla
Ranch Hand
Joined: Jul 05, 2002
Posts: 79
posted
0
Thanks a lot Paul, but then I still would like to know why I should use show() and not setvisible. Are there any advantages? Again, thanks.