Ciao ragazzi vi spiego il mio problema ho realizzato in Eclipse una piccola interfaccia con i miei amici che sono più esperti di programmazione ma c'è un problema. Allora vi spiego meglio il problema: io voglio che si imposti un countdown prestabilito da me cioè che si inizializzi questo contatore a mio piacimento cioé: 2 dd, 3 hh, 20 mm, 30 ss, 320 SSS. Ora vi posto il codice, mi potete dire come modificare quello che ho richiesto ?

.--------------------------

import java.awt.event.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;


import javax.swing.*;


public class CountdownTimer extends JFrame implements ActionListener, Runnable
{
private static int dd = 2;
private long startTime;
private final static java.text.SimpleDateFormat timerFormat = new java.text.SimpleDateFormat("dd: hh: ss: SSS"+dd);
private final JButton startStopButton = new JButton("Start/Stop");
private Thread updater;
private boolean isRunning = false;
private final Runnable displayUpdater = new Runnable()
{
public void run()
{

displayElapsedTime(CountdownTimer.this.startTime - System.currentTimeMillis());
}
};
public void actionPerformed(ActionEvent ae)
{
if(isRunning)
{
long elapsed = startTime - System.currentTimeMillis();

isRunning = false;
try
{
updater.join();
// Wait for updater to finish
}
catch(InterruptedException ie) {}
displayElapsedTime(elapsed);
// Display End Result
}
else
{
startTime = 2*60*1000+System.currentTimeMillis();
isRunning = true;
updater = new Thread(this);
updater.start();
}
}
private void displayElapsedTime(long elapsedTime)
{
startStopButton.setText(timerFormat.format(new java.util.Date(elapsedTime)));
}
public void run()
{
try
{
while(isRunning)
{
SwingUtilities.invokeAndWait(displayUpdater);
Thread.sleep(50);
}
}
catch(java.lang.reflect.InvocationTargetException ite)
{
ite.printStackTrace(System.err);
// Prints Error - shouldn't ever happen
}
catch(InterruptedException ie) {}
// Ignore and return!
}
public CountdownTimer()
{
startStopButton.addActionListener(this);
getContentPane().add(startStopButton);
setSize(100,50);
setVisible(true);
}
public static void main(String[] arg)
{
new CountdownTimer().addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}