Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- public class Ruben {
- private static Button button;
- private static class eventHandler implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- if(e.getSource() == button) {
- msgFrame mf = new msgFrame();
- mf.add(new Label("Button Clicked"));
- mf.setVisible(true);
- }
- }
- }
- public static void main(String[] args) {
- button = new Button("u mad.");
- appFrame f = new appFrame();
- f.setLayout(new FlowLayout());
- f.add(new Label("Bro, First Java Program Im Happy!"));
- f.add(button);
- button.addActionListener(new eventHandler());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement