• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to add the Jpanel dynamically inside a single frame.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
H Friends,
I am building a GUI application which consists of two panels "panel" and "panel1". "panel1" have a button "addTimer" when clicked it should add the "panel" to the frame if i gain click the button it should again add the "panel" without overlapping the previous "panel" rather it should be created below the previous "panel". If i click on the button "addTimer" n times it should add the panel n times. Along with this the frame size has to dynamically change depending on the number of panels produced. Below is the code i tried my level best to satisfy the above conditions.

Please give me your valuable suggestions. Thank you in advance.

 
Marshal
Posts: 79240
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Don't add things dynamically. It looks very strange if the display changes suddenly like that. Consider a dialogue instead.
 
sumanth kavikondala
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to add dynamically because this is the project given to me in my school. Please suggest me.
 
Bartender
Posts: 5466
212
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Sumanth,

here is a small program that just adds a new panel when you click on a button.
It doesn't use a GridLayout, consider it as an example that you can use to
get an idea how to achieve your goal.

Greetz,
Piet
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic