Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.FlowLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- public class SimpleWindow extends JFrame {
- public SimpleWindow() {
- super ("A window");
- JButton b = new JButton("Click");
- b.addActionListener( new ActionListener(){
- @Override
- public void actionPerformed(ActionEvent e) {
- new SimpleWindow();
- }
- });
- setLayout(new FlowLayout());
- getContentPane().add(b);
- setSize(200, 200);
- setVisible(true);
- }
- public static void main(String[] args) {
- new SimpleWindow();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement