I don't know if the code i did are correctly .. please debug
And how to insert and resize title "Rolling Dice For Games" .
I want you to set the title and Button roll and stop except the pictures of dice like on the pictures.. plsssssss.. sorry for my english grammar if aren't correctly..
here's the example picture..roll dice.jpg
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class LabEx4 extends JFrame{ private boolean stop = false; private JLabel lbltitle, dice1, dice2; private RollButtonHandler rollHandler; private StopButtonHandler stopHandler; public void showWindow(){ Container pane = getContentPane(); pane.setLayout(new FlowLayout(FlowLayout.CENTER )); pane.add(new JLabel("Rolling Dice for Games")); pane.setFont(new Font("TAHOMA", Font.BOLD, 20)); pane.setBackground(Color.white); JButton roll = new JButton("ROLL"); rollHandler = new RollButtonHandler(); roll.addActionListener(rollHandler); roll.setLocation(200,100); roll.setFont(new Font("Tahoma", Font.BOLD, 14)); JButton stop2 = new JButton("STOP"); stopHandler = new StopButtonHandler(); stop2.setLocation(400,200); stop2.addActionListener(stopHandler); setTitle("Two Roll Dice"); setSize(600,500); setResizable(false); setLocation(190,50); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private class RollButtonHandler implements ActionListener{ public void actionPerformed(ActionEvent evt){ stop = false; Thread to = new Thread(){ public void run(){ while(!stop){ try { sleep(500); }catch(InterruptedException ex){ System.out.println("Interrupted"); } } } }; } } private class StopButtonHandler implements ActionListener{ public void actionPerformed(ActionEvent evt){ stop = true; } } }