Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- class HelloSwing5 extends JFrame implements ActionListener
- {
- HelloSwing5()
- {
- setTitle("Hello Swing5");
- setLayout(new FlowLayout());
- setSize(400,300);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Container c=getContentPane();
- JButton btn=new JButton("Click me!");
- c.add(btn);
- btn.addActionListener(this);
- setVisible(true);
- }
- public void actionPerformed(ActionEvent e)
- {
- int i=JOptionPane.showConfirmDialog(this,"Hello");
- }
- }
- public class Ex5
- {
- public static void main(String[] args)
- {
- new HelloSwing5();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement