wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Help,Components inside my Frame would not be displayed until maximized. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help,Components inside my Frame would not be displayed until maximized." Watch "Help,Components inside my Frame would not be displayed until maximized." New topic
Author

Help,Components inside my Frame would not be displayed until maximized.

Femi Alla
Ranch Hand

Joined: Jul 05, 2002
Posts: 79
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.


SCJP
jrookie
Greenhorn

Joined: Aug 20, 2002
Posts: 17
hi
try use pack() method
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

"jrookie" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

Thanks! and welcome to the JavaRanch!


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Femi,

Your problem is in the following code:


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
Thank you very much.
Femi Alla
Ranch Hand

Joined: Jul 05, 2002
Posts: 79
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
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
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help,Components inside my Frame would not be displayed until maximized.
 
Similar Threads
buttons don't work
Center a JPanel in JScrollPane and add a JToolBar
I need help with seeking to abitiary positions within a text file.
Focussing a TextField
getActionCommand() this is not working in code