Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package testMethods;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JOptionPane;
- public class ListenerPane extends JFrame {
- JButton createPane = new JButton("create");
- public ListenerPane() {
- this.setSize(500,500);
- this.setVisible(true);
- this.setDefaultCloseOperation(EXIT_ON_CLOSE);
- this.add(createPane);
- initListener();
- }
- private void initListener() {
- createPane.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- JOptionPane.showMessageDialog(null, "Test", "test2", 0);
- }
- });
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new ListenerPane();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement