• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Repainting Problem(please help)

Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really need your help guys, im working on this for days now. I created sort of mock up of what im really actually doing. Im really working on a Table and a Spit Pane. Just to present to you as brief as possible i wrote a two table instead. The real issue is I can't seems to resolve on repainting a panel. The buttons are located in another class, while the panel to repaint is in separate class. When i click a the button one, it should present the table one and button two on table two. .

I really appreciate any help. Here are the codes of 3 classes. You may ignore the table model method below

[ July 23, 2004: Message edited by: john von ]
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your code won't work because it doesn't ever change the tables.

You can't just change onTable and have the JFrame automatically change too. You need to remove the current JTable from the contentPane and then add the one you are trying to show.

Another, possibly easier way to do this, is use a CardLayout manager. It will let you swap the entire panel, regardless of how many components you add to it.

You also don't need to explicitly create a JPanel and then do a setContentPane. Just do a getContentPane() and add your components to it. Saves creating a JPanel.

You may have just won ten million dollars! Or, maybe a tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic