File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Femi Alla
Ranch Hand
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
jrookie
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
try use pack() method
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
 
Femi Alla
Ranch Hand
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic