Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3.  
  4. public class Ruben {
  5.     private static Button button;
  6.    
  7.     private static class eventHandler implements ActionListener {
  8.         public void actionPerformed(ActionEvent e) {
  9.             if(e.getSource() == button) {
  10.                 msgFrame mf = new msgFrame();
  11.                 mf.add(new Label("Button Clicked"));
  12.                 mf.setVisible(true);
  13.             }
  14.         }
  15.     }
  16.    
  17.     public static void main(String[] args) {
  18.         button = new Button("u mad.");
  19.         appFrame f = new appFrame();
  20.         f.setLayout(new FlowLayout());
  21.         f.add(new Label("Bro, First Java Program Im Happy!"));
  22.         f.add(button);
  23.         button.addActionListener(new eventHandler());
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement