Advertisement
Guest User

Untitled

a guest
Sep 1st, 2011
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4.  
  5. public class swing2 {
  6.  
  7.     public static void main(String[] args) {
  8.         JFrame Frame = new JFrame("Events Testing");
  9.         Frame.setVisible(true);
  10.         Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  11.         Frame.setSize(300,300);
  12.         JPanel Panel = new JPanel();
  13.         Frame.add(Panel);
  14.         JButton Button = new JButton("Click Me");
  15.         Panel.add(Button);
  16.         Button.addActionListener(new Action());
  17.        
  18.     }
  19.  
  20.  
  21.     static class Action implements ActionListener {
  22.            
  23.             public void actionperformed (ActionEvent e)
  24.         {
  25.                 JFrame Frame2 = new JFrame("CUNT");
  26.                 Frame2.setVisible(true);
  27.                 Frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  28.                 Frame2.setSize(200,200);
  29.                 JLabel Label = new JLabel("You Clicked Me");
  30.                 JPanel Panel = new JPanel();
  31.                 Frame2.add(Panel);
  32.                 Panel.add(Label);
  33.                
  34.                
  35.                
  36.         }
  37.     }  
  38.    
  39.        
  40.        
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement