aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes I dont see all the components I added until I resize the frame !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "I dont see all the components I added until I resize the frame !!" Watch "I dont see all the components I added until I resize the frame !!" New topic
Author

I dont see all the components I added until I resize the frame !!

Richards Milan
Greenhorn

Joined: Jun 24, 2012
Posts: 29

Hi guys ! I was trying out swing , and with this code I am not able to see all the components I added until I resize my frame ..


Do you know why Java programmers wear specs ? Its because they don't 'C#'
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5


That should be the last statement of your code. Always first initialize and set components to frame, and then display it.


The quieter you are, the more you are able to hear.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4658
    
    5

Since the question is related to Swing, I shall move the thread.


luck, db
There are no new questions, but there may be new answers.
Richards Milan
Greenhorn

Joined: Jun 24, 2012
Posts: 29

HI kemal >> I had used frame.setVisible(true); in my program but forgot to copy it while posting >> can you suggest something else ?
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Richards Milan wrote:HI kemal >> I had used frame.setVisible(true); in my program but forgot to copy it while posting >> can you suggest something else ?


I see you used it, it is in the code you posted. You should just move it to be the last statement in your code. Another approach is to invoke frame.revalidate() also as the last statement, but I would suggest you do the first one.
Richards Milan
Greenhorn

Joined: Jun 24, 2012
Posts: 29

Kemal thank you !! frame.revalidate(); did the trick !! can you tell me what exactly does this revalidate() do ?
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

frame.revalidate(); did the trick

Placing that frame.setVisible(true); at the end would do it, too.

can you tell me what exactly does this revalidate() do ?

It's all in the API.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I dont see all the components I added until I resize the frame !!