This is my first time making a GUI and we're making a stopwatch...I figured everything out except for how to make the time elapsed have one decimal place ex: 1.1 seconds
this is what I have so far
public void actionPerformed(ActionEvent ae){
stop.setEnabled(true);
long endTime;
if(ae.getActionCommand().equals("Start")){
display.setText("Start Button was Pressed");
startTime=System.currentTimeMillis();
return;
}
display.setText("Stop Button was Pressed");
endTime=System.currentTimeMillis();
DecimalFormat df = new DecimalFormat("#.#");
String i=df.format(((endTime-startTime)/1000));
display.setText("Seconds : " + i);//milliseconds-->seconds
stop.setEnabled(false);
}
Any help is appreciated guys!