Skip to content

Instantly share code, notes, and snippets.

@jeffreymeng
Created May 30, 2018 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffreymeng/0af3b2e0c23e8645c1b36fda32a28b6d to your computer and use it in GitHub Desktop.
Save jeffreymeng/0af3b2e0c23e8645c1b36fda32a28b6d to your computer and use it in GitHub Desktop.
package BlackJackCopy;
import java.awt.*;
import javax.swing.*;
public class GUI extends JPanel{
final int width = 800;
final int height = 600;
JFrame frame = new JFrame("Blackjack");
public void paintComponent(Graphics graphics) {
int width = frame.getWidth();
int height = frame.getHeight();
super.paintComponent(graphics);
graphics.setColor(new Color(39,119,20));
graphics.fillRect(0, 0, width, height);
}
public void setupWindow(GUI panel) {
frame.setSize(width, height);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(panel);
frame.setVisible(true);
}
public static void main(String[] args) {
GUI panel = new GUI();
panel.setupWindow(panel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment