$ java JavaGUI1
Exception in thread "main" java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
at java.awt.Window.(Window.java:536)
at java.awt.Frame.(Frame.java:420)
at javax.swing.JFrame.(JFrame.java:233)
at JavaGUI1.(JavaGUI1.java:9)
at JavaGUI1.main(JavaGUI1.java:17)

To resolve this java.awt.HeadlessException, install openjdk package.

$ sudo dnf install java-1.8.0-openjdk

Run again once installed openjdk package

$java JavaGUI1

Output:

ActionListener

ActionListener interface is used to action to control like button press.