Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- public class swing2 {
- public static void main(String[] args) {
- JFrame Frame = new JFrame("Events Testing");
- Frame.setVisible(true);
- Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Frame.setSize(300,300);
- JPanel Panel = new JPanel();
- Frame.add(Panel);
- JButton Button = new JButton("Click Me");
- Panel.add(Button);
- Button.addActionListener(new Action());
- }
- static class Action implements ActionListener {
- public void actionperformed (ActionEvent e)
- {
- JFrame Frame2 = new JFrame("CUNT");
- Frame2.setVisible(true);
- Frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Frame2.setSize(200,200);
- JLabel Label = new JLabel("You Clicked Me");
- JPanel Panel = new JPanel();
- Frame2.add(Panel);
- Panel.add(Label);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement