Advertisement
Guest User

Untitled

a guest
Aug 13th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package BeatBox;
  2.  
  3. import javax.swing.*;
  4. import java.awt.event.*;
  5.  
  6. public class SimpleGui1B implements ActionListener {
  7.     JButton button;
  8.  
  9.     public static void main(String[] args) {
  10.         SimpleGui1B gui = new SimpleGui1B();
  11.         gui.go();
  12.     }
  13.  
  14.     public void go() {
  15.         JFrame frame = new JFrame();
  16.         JButton button = new JButton("Click me!");
  17.  
  18.         button.addActionListener(this);
  19.  
  20.         frame.getContentPane().add(button);
  21.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  22.         frame.setSize(300, 300);
  23.         frame.setVisible(true);
  24.     }
  25.  
  26.     public void actionPerformed(ActionEvent event) {
  27.         button.setText("Hui sasi!");
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement