Skip to content

Instantly share code, notes, and snippets.

@jeffreymeng
Created May 30, 2018
Embed
What would you like to do?
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