i have a problem. i don't know where i am making the mistake.... i need to refreshed my JPanels automatically with time..... i have used timers for this. i used in the constructor of the class...
public class HoursPanel{
//....
//.....
public HoursPanel(){
int delay = 60000;
Timer timer = new Timer(delay, new ActionListener(){
public void actionPerformed(ActionEvent e){
hrPanel.invalidate();
hrPanel.revalidate();
hrPanel.repaint();
}
});
timer.start();
}
//....
//.....
//.....
i am posting only my timer portion. I need to refresh my JPanel which contain values from database. i need to refresh at a regular interval of 1 min automatically, but i got my JPanel refreshed only when i minimize the JFrame or if i switch to different JPanel(which are in cardlayout) and coming back to that JPanel...
in above hrPanel is an object of JPanel, where i put all my JLabel and graphs.... please give me suggestion that where i am doing wrong. Thank you in advance.....