Created
September 27, 2016 12:10
-
-
Save shah-smit/e43b3b29e63d2b61d078b47be2481bab to your computer and use it in GitHub Desktop.
A simple GUI with one panel contained in a frame
This file contains 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 java.awt.*; | |
import javax.swing.*; | |
public class SimpleFrame { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
JFrame frame = new JFrame("A simple Frame"); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
JPanel panel = new JPanel(); | |
panel.setBackground(Color.white); | |
panel.setPreferredSize(new Dimension(250,75)); | |
JLabel label1 = new JLabel("Binary and Conversation"); | |
JLabel label2 = new JLabel("1 and 2 conv"); | |
panel.add(label1); | |
panel.add(label2); | |
frame.add(panel); | |
frame.pack(); | |
frame.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment