Created
May 30, 2018 04:48
-
-
Save jeffreymeng/0af3b2e0c23e8645c1b36fda32a28b6d to your computer and use it in GitHub Desktop.
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
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