Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.78 KB | None | 0 0
  1. // The "HelloWorldGUI" class.\
  2. import java.awt.*;
  3. import hsa.Console;
  4. import javax.swing.*;
  5. import java.awt.event.*;
  6.  
  7. public class HelloWorldGUI implements ActionListener
  8. {
  9. JFrame frame;
  10. JPanel contentPane;
  11. JLabel label;
  12. JButton buttonme;
  13. JButton buttonavatar;
  14. JButton buttontitle;
  15. JButton buttonexit;
  16. JButton pic;
  17. int counter, counter1, counter2, counter3 = 0;
  18.  
  19. public HelloWorldGUI ()
  20. {
  21. frame = new JFrame ("P H O T O A L B U M_________________G O P A L");
  22. frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
  23. contentPane = new JPanel ();
  24.  
  25. label = new JLabel (" HOME PAGE");
  26. label.setBorder (BorderFactory.createEmptyBorder (20, 5, 20, 5));
  27. contentPane.setLayout (new BoxLayout (contentPane, BoxLayout.PAGE_AXIS));
  28. contentPane.add (label);
  29.  
  30. pic = new JButton (new ImageIcon ("title.jpg"));
  31. pic.setBorder (BorderFactory.createEmptyBorder (20, 20, 20, 20));
  32. pic.setActionCommand ("pic");
  33. pic.addActionListener (this);
  34. contentPane.add (pic);
  35.  
  36. buttontitle = new JButton ("HOME PAGE");
  37. buttontitle.setActionCommand ("HOME PAGE");
  38. buttontitle.addActionListener (this);
  39. contentPane.add (buttontitle);
  40.  
  41. buttonme = new JButton ("VIEW A PIX OF GOPAL");
  42. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  43. buttonme.addActionListener (this);
  44. contentPane.add (buttonme);
  45.  
  46. buttonavatar = new JButton ("WATCH HIM GET A MAKEOVER");
  47. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  48. buttonavatar.addActionListener (this);
  49. contentPane.add (buttonavatar);
  50. buttonexit = new JButton ("DONT CLICK HERE OR YOU WILL EXIT");
  51. buttonexit.setActionCommand ("DONT CLICK HERE OR YOU WILL EXIT");
  52. buttonexit.addActionListener (this);
  53. contentPane.add (buttonexit);
  54. frame.setContentPane (contentPane);
  55. frame.pack ();
  56. frame.setVisible (true);
  57. }
  58.  
  59.  
  60. public void actionPerformed (ActionEvent event)
  61. {
  62. String eventName = event.getActionCommand ();
  63.  
  64. if (eventName.equals ("HOME PAGE"))
  65. {
  66. counter1 = 0;
  67. pic.setIcon (new ImageIcon ("title.jpg"));
  68. label.setText (" P H O T O A L B U M");
  69. buttontitle.setText ("HOME PAGE");
  70. buttontitle.setActionCommand ("HOME PAGE");
  71. label.setText (" HOME PAGE");
  72. buttonme.setText ("VIEW A PIX OF GOPAL");
  73. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  74. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  75. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  76.  
  77. if ((eventName.equals ("pic")) && counter1 == 0)
  78. {
  79. pic.setIcon (new ImageIcon ("title.jpg"));
  80. label.setText (" P H O T O A L B U M");
  81. buttontitle.setText ("HOME PAGE");
  82. buttontitle.setActionCommand ("HOME PAGE");
  83. label.setText (" HOME PAGE");
  84. buttonme.setText ("VIEW A PIX OF GOPAL");
  85. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  86. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  87. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  88. counter1++;
  89. }
  90. else if ((eventName.equals ("pic")) && counter1 == 1)
  91. {
  92. pic.setIcon (new ImageIcon ("me.jpg"));
  93. label.setText (" PHOTO OF MOI!");
  94. buttonme.setText ("YOU ARE SEEING HIM");
  95. buttonme.setActionCommand ("YOU ARE SEEING HIM");
  96. label.setText (" PHOTO OF MOI!");
  97. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  98. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  99. buttontitle.setText ("HOME PAGE");
  100. buttontitle.setActionCommand ("HOME PAGE");
  101. counter1++;
  102. }
  103. else if ((eventName.equals ("pic")) && counter1 == 2)
  104. {
  105. pic.setIcon (new ImageIcon ("avatar.jpg"));
  106. label.setText (" AVATAR G!");
  107. buttonavatar.setText ("YOU ARE SEEING THE NEW G");
  108. buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
  109. label.setText (" AVATAR G!");
  110. buttontitle.setText ("HOME PAGE");
  111. buttontitle.setActionCommand ("HOME PAGE");
  112. buttonme.setText ("VIEW A PIX OF GOPAL");
  113. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  114. counter1++;
  115. }
  116. }
  117. else if (eventName.equals ("VIEW A PIX OF GOPAL"))
  118. {
  119. counter2 = 0;
  120. pic.setIcon (new ImageIcon ("me.jpg"));
  121. label.setText (" PHOTO OF MOI!");
  122. buttonme.setText ("YOU ARE SEEING HIM");
  123. buttonme.setActionCommand ("YOU ARE SEEING HIM");
  124. label.setText (" PHOTO OF MOI!");
  125. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  126. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  127. buttontitle.setText ("HOME PAGE");
  128. buttontitle.setActionCommand ("HOME PAGE");
  129.  
  130. if ((eventName.equals ("pic")) && counter2 == 0)
  131. {
  132. pic.setIcon (new ImageIcon ("title.jpg"));
  133. label.setText (" P H O T O A L B U M");
  134. buttontitle.setText ("HOME PAGE");
  135. buttontitle.setActionCommand ("HOME PAGE");
  136. label.setText (" HOME PAGE");
  137. buttonme.setText ("VIEW A PIX OF GOPAL");
  138. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  139. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  140. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  141. counter2++;
  142. }
  143. else if ((eventName.equals ("pic")) && counter2 == 1)
  144. {
  145. pic.setIcon (new ImageIcon ("me.jpg"));
  146. label.setText (" PHOTO OF MOI!");
  147. buttonme.setText ("YOU ARE SEEING HIM");
  148. buttonme.setActionCommand ("YOU ARE SEEING HIM");
  149. label.setText (" PHOTO OF MOI!");
  150. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  151. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  152. buttontitle.setText ("HOME PAGE");
  153. buttontitle.setActionCommand ("HOME PAGE");
  154. counter2++;
  155. }
  156. else if ((eventName.equals ("pic")) && counter2 == 2)
  157. {
  158. pic.setIcon (new ImageIcon ("avatar.jpg"));
  159. label.setText (" AVATAR G!");
  160. buttonavatar.setText ("YOU ARE SEEING THE NEW G");
  161. buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
  162. label.setText (" AVATAR G!");
  163. buttontitle.setText ("HOME PAGE");
  164. buttontitle.setActionCommand ("HOME PAGE");
  165. buttonme.setText ("VIEW A PIX OF GOPAL");
  166. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  167. counter2++;
  168. }
  169. }
  170. else if (eventName.equals ("WATCH HIM GET A MAKEOVER"))
  171. {
  172. counter3 = 0;
  173. pic.setIcon (new ImageIcon ("avatar.jpg"));
  174. label.setText (" AVATAR G!");
  175. buttonavatar.setText ("YOU ARE SEEING THE NEW G");
  176. buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
  177. label.setText (" AVATAR G!");
  178. buttontitle.setText ("HOME PAGE");
  179. buttontitle.setActionCommand ("HOME PAGE");
  180. buttonme.setText ("VIEW A PIX OF GOPAL");
  181. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  182.  
  183. if ((eventName.equals ("pic")) && counter3 == 0)
  184. {
  185. pic.setIcon (new ImageIcon ("title.jpg"));
  186. label.setText (" P H O T O A L B U M");
  187. buttontitle.setText ("HOME PAGE");
  188. buttontitle.setActionCommand ("HOME PAGE");
  189. label.setText (" HOME PAGE");
  190. buttonme.setText ("VIEW A PIX OF GOPAL");
  191. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  192. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  193. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  194. counter3++;
  195. }
  196. else if ((eventName.equals ("pic")) && counter3 == 1)
  197. {
  198. pic.setIcon (new ImageIcon ("me.jpg"));
  199. label.setText (" PHOTO OF MOI!");
  200. buttonme.setText ("YOU ARE SEEING HIM");
  201. buttonme.setActionCommand ("YOU ARE SEEING HIM");
  202. label.setText (" PHOTO OF MOI!");
  203. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  204. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  205. buttontitle.setText ("HOME PAGE");
  206. buttontitle.setActionCommand ("HOME PAGE");
  207. counter3++;
  208. }
  209. else if ((eventName.equals ("pic")) && counter3 == 2)
  210. {
  211. pic.setIcon (new ImageIcon ("avatar.jpg"));
  212. label.setText (" AVATAR G!");
  213. buttonavatar.setText ("YOU ARE SEEING THE NEW G");
  214. buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
  215. label.setText (" AVATAR G!");
  216. buttontitle.setText ("HOME PAGE");
  217. buttontitle.setActionCommand ("HOME PAGE");
  218. buttonme.setText ("VIEW A PIX OF GOPAL");
  219. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  220. counter3++;
  221. }
  222. }
  223. else if (eventName.equals ("DONT CLICK HERE OR YOU WILL EXIT"))
  224. {
  225. label.setText (" TOLD YOU SO!!!!!!!");
  226. buttonexit.setText ("TOLD YOU SO!!!!");
  227. buttonexit.setActionCommand ("TOLD YOU SO!!!!");
  228. label.setText (" TOLD YOU SO!!!!!!!");
  229. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  230. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  231. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  232. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  233. buttonme.setText ("VIEW A PIX OF GOPAL");
  234. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  235. System.exit (0);
  236. }
  237. else if ((eventName.equals ("pic")) && counter == 0)
  238. {
  239. pic.setIcon (new ImageIcon ("title.jpg"));
  240. label.setText (" P H O T O A L B U M");
  241. buttontitle.setText ("HOME PAGE");
  242. buttontitle.setActionCommand ("HOME PAGE");
  243. label.setText (" HOME PAGE");
  244. buttonme.setText ("VIEW A PIX OF GOPAL");
  245. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  246. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  247. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  248. counter = 1;
  249. }
  250. else if ((eventName.equals ("pic")) && counter == 1)
  251. {
  252. pic.setIcon (new ImageIcon ("me.jpg"));
  253. label.setText (" PHOTO OF MOI!");
  254. buttonme.setText ("YOU ARE SEEING HIM");
  255. buttonme.setActionCommand ("YOU ARE SEEING HIM");
  256. label.setText (" PHOTO OF MOI!");
  257. buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
  258. buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
  259. buttontitle.setText ("HOME PAGE");
  260. buttontitle.setActionCommand ("HOME PAGE");
  261. counter = 2;
  262. }
  263. else if ((eventName.equals ("pic")) && counter == 2)
  264. {
  265. pic.setIcon (new ImageIcon ("avatar.jpg"));
  266. label.setText (" AVATAR G!");
  267. buttonavatar.setText ("YOU ARE SEEING THE NEW G");
  268. buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
  269. label.setText (" AVATAR G!");
  270. buttontitle.setText ("HOME PAGE");
  271. buttontitle.setActionCommand ("HOME PAGE");
  272. buttonme.setText ("VIEW A PIX OF GOPAL");
  273. buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
  274. counter = 0;
  275. }
  276. }
  277.  
  278.  
  279. private static void runGUI ()
  280. {
  281. JFrame.setDefaultLookAndFeelDecorated (true);
  282. HelloWorldGUI greeting = new HelloWorldGUI ();
  283. }
  284.  
  285.  
  286. public static void main (String[] args)
  287. {
  288. javax.swing.SwingUtilities.invokeLater (new Runnable ()
  289. {
  290. public void run ()
  291. {
  292. runGUI ();
  293. }
  294. }
  295. );
  296. } // main method
  297. } // HelloWorldGUI class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement