Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JOptionPane;

public class Main {
    public static void main(final String args[]) {
        JButton button = new JButton("Test");

        button.addActionListener(new ClickListener());
        JOptionPane.showMessageDialog(null, button);

        button.doClick();
    }
}

class ClickListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
        System.out.println("test");
    }

}