Created
October 22, 2020 17:32
-
-
Save alsamitech/84d8c4d23419fde8ec87fcf17051da25 to your computer and use it in GitHub Desktop.
Java GUI With buttons
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.*; | |
| class Main{ | |
| public static void main(String args[]){ | |
| JFrame frame = new JFrame("My First GUI"); | |
| frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
| frame.setSize(300,300); | |
| JButton button1 = new JButton("Button 1"); | |
| JButton button2 = new JButton("Button 2"); | |
| frame.getContentPane().add(button1); | |
| frame.getContentPane().add(button2); | |
| frame.setVisible(true); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment