Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;

public class Main {
    public static void main(String[] argv) throws Exception {
        Action action = new AbstractAction("Button Label") {
            // This method is called when the button is pressed
            public void actionPerformed(ActionEvent evt) {
                // Perform action...
            }
        };

        // Create the button from the action
        JButton button = new JButton(action);
    }
}