• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

problem in refreshing JPanels in cardlayout

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...! i have a problem in refreshing JPanels in cardlayout. I have used cardlayout and i displayed separate informations in different JPanels. Now selecting each JMenuItems from the menuBar displays separate JPanels.

I have used three classes for this.....
1) A class containing the connections and the database queries.....
2) One main class......
3) Separate separate classes for the JPanels (which are in cardlayout) and these JPanels are then added to the main class, which contains the cardlayout........

Again in each JPanels(in cardlayout) there are JLabels and Graphs containing database values. Now my problem is that when i select different menuItems it displays the required JPanels, but it leaves the previous JPanel in that state in which i left.....

Let me explain properly.... For example in one JPanel there is a combobox, having list of Temperature, Rainfall, Wind. Now at first it displays Temperature Graph and if i select Rainfall then it displays Rainfall Graph. Working fine.... Now if i select another JMenuItem then it takes me to the respective JPanel, but it leaves the JPanel in that state where i left i.e when i again select JMenuItem (for the JPanel) then i found the JPanel with the Rainfall Graph but i need the JPanel with the Temperature Graph..... i.e the JPanels must got refreshed at each switching (of JPanels), by selecting JMenuItem

Probably i could explain you properly..... I have tried to use swing timers, but still not any progress........ Please suggest me..... please guide me........ Please give some valuabe information...... Any help will highly be appreciated.... Thanks
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but it leaves the previous JPanel in that state in which i left.....



Yes, that is the way it should work. You didn't change the state of any component on the panel so it should look exactly the same the next time you display the panel. As a user this is what I would expect.

If you want the panel to have different information, then you need to update the components on the panel with new information.
 
partha phukan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply. But would you please give me some hint or some suggestion about doing that. Please guide me.... i could not able to find a proper way of doing that. please....
 
What a show! What atmosphere! What fun! What a tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic