Ciao a tutti,
Sono nuovo di qui, mi chiedevo se mi potevate dare una mano con un progettino che stò facendo in java, si tratta di un cronometro...e dato che sono un programmatore alle prime armi non sò bene tutto quello che c'è da sapere...
Il problema è il seguente: volevo aggiungere al mio cronometro una tabella nella parte a destra del cronometro...che ad ogni stop del cronometro mi segni il tempo...e non sò proprio da dove iniziare..e poi volevo sapere anche come faccio ad aggiungere una mia immagine alla finestra...

ecco il codice(anche se non vi servirà penso):

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class Cronometro

{
private JFrame frame;
private JLabel labelTime;
private JLabel labelTex;
private JPanel panelButtons;
private JPanel panellabel;
private JButton buttonStartStop;
private Timer timer;
private long startTime;

private boolean started;

public Cronometro ()

{
started=false;

frame = new JFrame ("Cronometro");
frame.setSize (800,700);

labelTime = new JLabel ("0:00:00:00");
labelTime.setOpaque(true);
labelTime.setBackground(Color.black);
labelTime.setForeground(Color.white);
labelTime.setFont (new Font ("", Font.PLAIN, 85));
labelTime.setHorizontalAlignment (JLabel.CENTER);

labelTex = new JLabel ("...PRONTI...PARTENZA...");
labelTex.setOpaque(true);
labelTex.setBackground(Color.yellow);
labelTex.setForeground(Color.black);
labelTex.setFont (new Font ("", Font.ROMAN_BASELINE, 30));

panellabel = new JPanel (new FlowLayout ());
panellabel.setBackground(Color.BLACK);
panellabel.add (labelTex);


buttonStartStop = new JButton ("START");
buttonStartStop.setBackground(Color.RED);
buttonStartStop.setForeground(Color.ORANGE);
buttonStartStop.setFont (new Font ("", Font.LAYOUT_LEFT_TO_RIGHT, 35));

panelButtons = new JPanel (new GridLayout (1, 1));
panelButtons.add (buttonStartStop);



frame.add (panellabel, BorderLayout.NORTH);
frame.add (labelTime, BorderLayout.CENTER);
frame.add (panelButtons, BorderLayout.SOUTH);


timer = new Timer (50, new ActionListener () {
public void actionPerformed (ActionEvent e) {
long diffTime = System.currentTimeMillis () - startTime;

int decSeconds = (int) (diffTime % 1000 / 10);
int seconds = (int) (diffTime / 1000 % 60);
int minutes = (int) (diffTime / 60000 % 60);
int hours = (int) (diffTime / 3600000);
String s = String.format ("%d:%02d:%02d:%02d", hours, minutes,
seconds, decSeconds);

labelTime.setText (s);
}
});

buttonStartStop.addActionListener (new ActionListener () {
public void actionPerformed (ActionEvent e) {

if (started==false)
{
//fallo partire
startTime = System.currentTimeMillis ();
timer.start();
labelTex.setText(" VIA! ");
buttonStartStop.setText("STOP");
started=true;
}
else
{
//fermalo
started=false;
labelTex.setText("...PRONTI...PARTENZA...");
timer.stop();
buttonStartStop.setText("RESTART");
}

}
});

frame.setVisible (true);
}

public static void main (String[] args)
{
SwingUtilities.invokeLater (new Runnable () {
public void run () {
new Cronometro ();
}
});
}

}



GRZ
Attendo risposte..
ciao