import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.UIManager;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class SimpleSwingApp2 {

    public SimpleSwingApp2() {
        final JFrame frame = new JFrame("SimpleSwingApp");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new BorderLayout());

        JPanel swingPanel = new JPanel();
        swingPanel.setLayout(new FlowLayout());
        frame.getContentPane().add(swingPanel, BorderLayout.CENTER);

        JButton swingButton = new JButton("Click me");
        swingButton.addActionListener(e -> System.err.println("Hi"));

        swingPanel.add(swingButton);

        // show frame
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        SwingUtilities.invokeLater(() -> new SimpleSwingApp2());
    }
}
