This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Richards Milan
Greenhorn
Posts: 29
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ..
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

That should be the last statement of your code. Always first initialize and set components to frame, and then display it.
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the question is related to Swing, I shall move the thread.
 
Richards Milan
Greenhorn
Posts: 29
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kemal thank you !! frame.revalidate(); did the trick !! can you tell me what exactly does this revalidate() do ?
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic