I am creating a break clock app in Java from my revious version written in VB6 and what it does is shows the current time, your breaks and luches which you enter (real time) and get a popup notification and tone which you choose to go on your break and then it dings 15 or 30 mins later to come back. I have he frame created and everything listed but the JPanel does not refresh every second or at all. Here is my timer code:
CODE
Timer t = new Timer(1000, Tick());
t.start();
class Tick implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
repaint();
}
}
What I need to refresh is this:
CODE
Calendar time = Calendar.getInstance();
int hour = time.get(Calendar.HOUR_OF_DAY);
int min = time.get(Calendar.MINUTE);
int sec = time.get(Calendar.SECOND);
JPanel panel = new JPanel;
panel.add(new JLabel("The current time is: "));
lblCurrentTime = new JLabel(hour + ":" + min + ":" sec)
panel.add(lblCurrentTime);
This displays fine but does not refresh. I am new to Java and am learning on my own but am very familiar with other programming languages. So if you help a description of the solution would be helpful in me learning as well. Thanks in advance.