Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.KeyEvent;
  3. import java.awt.event.KeyListener;
  4. import java.awt.image.BufferedImage;
  5. import java.io.File;
  6. import java.io.IOException;
  7. import javax.imageio.ImageIO;
  8. import javax.swing.JFrame;
  9. import javax.swing.*;
  10. import java.awt.Image;
  11. import java.applet.Applet;
  12. import java.applet.*;
  13. public class DDR extends JFrame
  14. {
  15. public static Image background = new ImageIcon("images/TITLEPAGE.png").getImage();
  16.  
  17. private boolean running;
  18.  
  19. public DDR()
  20. {
  21.  
  22. super("Dance Dance Revolution"); //Sets the title of our GUI
  23.  
  24. running = false;
  25.  
  26. setSize(800, 800); //set the size of our JFrame
  27. setLocationRelativeTo(null); //Unique method that allows us to set our JFrame to the
  28. //center of our screen
  29. //Using code from friend
  30. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  31. setContentPane(new DDRDesign()); //Requesting Component from DDRDesign
  32. setVisible(true);
  33. setResizable(true); //no maximize button
  34.  
  35. gameLoop();
  36.  
  37. }
  38.  
  39. private void gameLoop() {
  40. running = true;
  41. while(running) {
  42.  
  43. //Update arrow and object info.
  44.  
  45. //Redraw
  46. repaint();
  47.  
  48. //Pause.
  49. try {
  50. Thread.sleep(35);
  51. } catch(InterruptedException ie) {
  52.  
  53. }
  54.  
  55. }
  56. }
  57.  
  58. public static void main (String[]args)
  59. {
  60. new DDR(); //Initializes the JFrame
  61. }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement