hi all,

very new to swing and awt programming. Pretty much I have to just create a graphical user interface which uses an event. The code is below:

Java Code:
public class RollDie extends Frame {

private ImageIcon dice;
private JLabel diceLabel;

public RollDie(String title){

setLayout(new FlowLayout());

JButton rollButton = new ButtonImage("roll");

dice = new ImageIcon("dice.gif");
diceLabel = new JLabel(dice);

JLabel instruc = new JLabel("Please click on roll to decide whos turn will be first");

addWindowListener(new WindowCloser());
rollButton.addActionListener(new ButtonListener());


class WindowCloser extends WindowAdapter{

public void windowClosing(WindowEvent evt){

class RollClick implements ActionListener{
public void actionPerformed(ActionEvent evt){

This does execute with a main method class and a ButtonImage class ive created to get the proper button pictures I've created, but the picture, button and text are not in the places I want them. However I'm so stuck with layouts. What I wanted was a layout in which on the top of the frame is the picture of the dice. Then just under that is the Roll button. Then after that is the JLabel of text.

Also I believe when the button is clicked the actionlistener code would be executed. What I want is that when the roll button is pressed the static picture of the dice already on the frame changes to a different gif picture which is a moving dice. But I don't know how this could work.

Could anyone point me in the right direction please?

Thanks in advance