• 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

Clearing old widgets and creating the same again on a button click

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ranchers,


On a button click i am creating a table on a composite.
and wen i click agen i want to dispose this table and create again.
because everytime i click the button, new table gets created keeping the old one already on composite.

Hope I am clear.

Thanks,
Madhavee Latha

 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What toolkit are you using? Swing, SWT, or something else?

With Swing (and JTable), you just need to create a new (Default)TableModel, then use the JTable's setModel method. It will replace the old model of the table with the new model.
 
Madi Meka
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using SWT.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think old_Table.dispose() should work, not sure though.

But you may also recreate the composite itself, so the entire previous heirarchy is disposed(I know it a bad idea....but it's an idea ;)
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it can be done .If you you are using one button just maintain the state of Button.And then switch it either to create or dispose Methods.

I think you get my point.
 
reply
    Bookmark Topic Watch Topic
  • New Topic