Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;

import javax.swing.JButton;
import javax.swing.JFrame;

public class Main {
    public static void main(String[] args) {

        JFrame frame = new JFrame();
        frame.setLayout(new FlowLayout());
        frame.setVisible(true);

        JButton button1 = new JButton("");
        JButton button2 = new JButton("");

        frame.getContentPane().add(button1);
        frame.getContentPane().add(button2);

        button1.addActionListener(e -> {
            System.out.println("Lambda");
        });

        button2.addActionListener(Main::doSomething);

    }

    public static void doSomething(ActionEvent e) {
        System.out.println("");
    }
}