• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to resize panel when components are added at runtime to a panel with gridbag layout  RSS feed

 
Mahesh Kolli
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am a fresher to JAVA Swing
I am trying an example problem to add components at runtime to a panel.
I am able to add the components, but unable to resize the panel.
Can someone please suggest me what I am missing here in the following code ?

Thanks,
Mahesh

 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Invoke pack() on JFrame containing your panel after adding components.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also I think text fields are not added on the position you want them to be, so I would check that too.
 
Mahesh Kolli
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, its working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!