Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.Color;
  3. import java.awt.Graphics;
  4. public class TowerDefense extends JFrame {
  5.  
  6. //GUI Object
  7. public static TowerDefense gui = new TowerDefense();
  8.  
  9. //Brown color used for HUD
  10. public static Color brown = new Color (139,69,19);
  11.  
  12. //Method to launch GUI Window
  13. public static void LaunchGUI()
  14. {
  15. gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  16. gui.setSize(1920,1080);
  17. gui.setVisible(true);
  18. gui.setTitle("Tower Defense");
  19. gui.setResizable(false);
  20. }
  21.  
  22. //Graphics method
  23. public static void paintComponent(Graphics g)
  24. {
  25. gui.paintComponents(g);
  26. g.setColor(Color.black);
  27. g.drawRect(100, 100, 1920, 100);
  28. gui.repaint();
  29. }
  30.  
  31.  
  32. public static void main(String[] args)
  33. {
  34. // TODO Auto-generated method stub
  35. LaunchGUI();
  36.  
  37.  
  38. }
  39.  
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement