Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.JFrame;
- import javax.swing.JButton;
- import javax.swing.JLabel;
- public class Test
- {
- public static void main(String[] args)
- {
- JFrame frame = new JFrame("Example Program");
- JLabel label = new JLabel("0");
- JButton button = new JButton("Click me");
- frame.setSize(400, 400);
- label.setBounds(50, 50, 150, 30);
- button.setBounds(100, 100, 150, 30);
- frame.add(label);
- frame.add(button);
- frame.setLayout(null);
- frame.setVisible(true);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- button.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- int x = 0;
- while (x <= 10000000)
- {
- String x_string = Integer.toString(x);
- label.setText(x_string);
- x++;
- }
- } // end actionPerformed method
- }); // end actionListener
- } // end main method
- } // end class Test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement