Created
January 3, 2021 12:16
-
-
Save yostane/4f3e86ac2ba93fa83fa0097f43348a8e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.swing.JFrame; | |
| import javax.swing.JLabel; | |
| import javax.swing.WindowConstants; | |
| public class SimpleGui { | |
| private static void createAndShowGUI() { | |
| // Create and set up the window. | |
| JFrame frame = new JFrame("HelloWorldSwing"); | |
| frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | |
| // Add the ubiquitous "Hello World" label. | |
| JLabel label = new JLabel("Hello World"); | |
| frame.getContentPane().add(label); | |
| // Display the window. | |
| frame.pack(); | |
| frame.setVisible(true); | |
| } | |
| public static void main(String[] args) { | |
| javax.swing.SwingUtilities.invokeLater(SimpleGui::createAndShowGUI); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment