Crenox

TheNewBostons Code #1

May 8th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. FORKS CLASS:
  2. import java.awt.*;
  3. import javax.swing.JFrame;
  4.  
  5. public class forks extends JFrame
  6. {
  7. public static void main(String args[])
  8. {
  9. DisplayMode dm = new DisplayMode(1000, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN);
  10. forks f = new forks();
  11. f.run(dm);
  12. }
  13.  
  14. public void run(DisplayMode dm)
  15. {
  16. setBackground(Color.PINK);
  17. setForeground(Color.WHITE);
  18. setFont(new Font("Arial", Font.PLAIN, 52));
  19.  
  20. spoons s = new spoons();
  21. try
  22. {
  23. s.setScreen(dm, this);
  24. try
  25. {
  26. Thread.sleep(5000);
  27. }catch(Exception ex){}
  28. }finally
  29. {
  30. s.restoreScreen();
  31. }
  32. }
  33.  
  34. public void paint(Graphics g)
  35. {
  36. g.drawString("This is gonna be amazing.", 200, 200);
  37. }
  38. }
  39. SPOONS CLASS:
  40. import java.awt.*;
  41. import javax.swing.JFrame;
  42.  
  43. public class spoons
  44. {
  45. private GraphicsDevice VideoCard;
  46.  
  47. public spoons()
  48. {
  49. GraphicsEnvironment Environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
  50. VideoCard = Environment.getDefaultScreenDevice();
  51. }
  52.  
  53. public void setScreen(DisplayMode dm, JFrame w)
  54. {
  55. w.setUndecorated(true);
  56. w.setResizable(false);
  57. VideoCard.setFullScreenWindow(w);
  58.  
  59. if(dm != null && VideoCard.isDisplayChangeSupported())
  60. {
  61. try
  62. {
  63. VideoCard.setDisplayMode(dm);
  64. }catch(Exception e){}
  65. }
  66. }
  67.  
  68. public Window getFullScreenWindow()
  69. {
  70. return VideoCard.getFullScreenWindow();
  71. }
  72.  
  73. public void restoreScreen()
  74. {
  75. Window w = VideoCard.getFullScreenWindow();
  76. if(w != null)
  77. {
  78. w.dispose();
  79. }
  80. VideoCard.setFullScreenWindow(null);
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment