Last active
January 2, 2016 22:38
-
-
Save AnnaBoro/c1249432c58f8ce4ce67 to your computer and use it in GitHub Desktop.
JFrame + JPanel
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
package lesson5_8; | |
import javax.swing.*; | |
import java.awt.*; | |
public class JJFrame extends JPanel{ | |
public static void main(String[] args) { | |
new JJFrame(); | |
} | |
public JJFrame() { | |
JFrame f = new JFrame("Day5_8"); | |
f.setMinimumSize(new Dimension(800, 600)); | |
f.setLocation(300, 100); | |
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
f.getContentPane().add(this); | |
f.pack(); | |
f.setVisible(true); | |
} | |
@Override | |
protected void paintComponent(Graphics g) { | |
super.paintComponent(g); | |
this.setBackground(Color.CYAN); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment