Skip to content

Instantly share code, notes, and snippets.

@AnnaBoro
Last active January 2, 2016 22:38
Show Gist options
  • Save AnnaBoro/c1249432c58f8ce4ce67 to your computer and use it in GitHub Desktop.
Save AnnaBoro/c1249432c58f8ce4ce67 to your computer and use it in GitHub Desktop.
JFrame + JPanel
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