Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The "HelloWorldGUI" class.\
- import java.awt.*;
- import hsa.Console;
- import javax.swing.*;
- import java.awt.event.*;
- public class HelloWorldGUI implements ActionListener
- {
- JFrame frame;
- JPanel contentPane;
- JLabel label;
- JButton buttonme;
- JButton buttonavatar;
- JButton buttontitle;
- JButton buttonexit;
- JButton pic;
- int counter, counter1, counter2, counter3 = 0;
- public HelloWorldGUI ()
- {
- frame = new JFrame ("P H O T O A L B U M_________________G O P A L");
- frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
- contentPane = new JPanel ();
- label = new JLabel (" HOME PAGE");
- label.setBorder (BorderFactory.createEmptyBorder (20, 5, 20, 5));
- contentPane.setLayout (new BoxLayout (contentPane, BoxLayout.PAGE_AXIS));
- contentPane.add (label);
- pic = new JButton (new ImageIcon ("title.jpg"));
- pic.setBorder (BorderFactory.createEmptyBorder (20, 20, 20, 20));
- pic.setActionCommand ("pic");
- pic.addActionListener (this);
- contentPane.add (pic);
- buttontitle = new JButton ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- buttontitle.addActionListener (this);
- contentPane.add (buttontitle);
- buttonme = new JButton ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- buttonme.addActionListener (this);
- contentPane.add (buttonme);
- buttonavatar = new JButton ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttonavatar.addActionListener (this);
- contentPane.add (buttonavatar);
- buttonexit = new JButton ("DONT CLICK HERE OR YOU WILL EXIT");
- buttonexit.setActionCommand ("DONT CLICK HERE OR YOU WILL EXIT");
- buttonexit.addActionListener (this);
- contentPane.add (buttonexit);
- frame.setContentPane (contentPane);
- frame.pack ();
- frame.setVisible (true);
- }
- public void actionPerformed (ActionEvent event)
- {
- String eventName = event.getActionCommand ();
- if (eventName.equals ("HOME PAGE"))
- {
- counter1 = 0;
- pic.setIcon (new ImageIcon ("title.jpg"));
- label.setText (" P H O T O A L B U M");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- label.setText (" HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- if ((eventName.equals ("pic")) && counter1 == 0)
- {
- pic.setIcon (new ImageIcon ("title.jpg"));
- label.setText (" P H O T O A L B U M");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- label.setText (" HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- counter1++;
- }
- else if ((eventName.equals ("pic")) && counter1 == 1)
- {
- pic.setIcon (new ImageIcon ("me.jpg"));
- label.setText (" PHOTO OF MOI!");
- buttonme.setText ("YOU ARE SEEING HIM");
- buttonme.setActionCommand ("YOU ARE SEEING HIM");
- label.setText (" PHOTO OF MOI!");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- counter1++;
- }
- else if ((eventName.equals ("pic")) && counter1 == 2)
- {
- pic.setIcon (new ImageIcon ("avatar.jpg"));
- label.setText (" AVATAR G!");
- buttonavatar.setText ("YOU ARE SEEING THE NEW G");
- buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
- label.setText (" AVATAR G!");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- counter1++;
- }
- }
- else if (eventName.equals ("VIEW A PIX OF GOPAL"))
- {
- counter2 = 0;
- pic.setIcon (new ImageIcon ("me.jpg"));
- label.setText (" PHOTO OF MOI!");
- buttonme.setText ("YOU ARE SEEING HIM");
- buttonme.setActionCommand ("YOU ARE SEEING HIM");
- label.setText (" PHOTO OF MOI!");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- if ((eventName.equals ("pic")) && counter2 == 0)
- {
- pic.setIcon (new ImageIcon ("title.jpg"));
- label.setText (" P H O T O A L B U M");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- label.setText (" HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- counter2++;
- }
- else if ((eventName.equals ("pic")) && counter2 == 1)
- {
- pic.setIcon (new ImageIcon ("me.jpg"));
- label.setText (" PHOTO OF MOI!");
- buttonme.setText ("YOU ARE SEEING HIM");
- buttonme.setActionCommand ("YOU ARE SEEING HIM");
- label.setText (" PHOTO OF MOI!");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- counter2++;
- }
- else if ((eventName.equals ("pic")) && counter2 == 2)
- {
- pic.setIcon (new ImageIcon ("avatar.jpg"));
- label.setText (" AVATAR G!");
- buttonavatar.setText ("YOU ARE SEEING THE NEW G");
- buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
- label.setText (" AVATAR G!");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- counter2++;
- }
- }
- else if (eventName.equals ("WATCH HIM GET A MAKEOVER"))
- {
- counter3 = 0;
- pic.setIcon (new ImageIcon ("avatar.jpg"));
- label.setText (" AVATAR G!");
- buttonavatar.setText ("YOU ARE SEEING THE NEW G");
- buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
- label.setText (" AVATAR G!");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- if ((eventName.equals ("pic")) && counter3 == 0)
- {
- pic.setIcon (new ImageIcon ("title.jpg"));
- label.setText (" P H O T O A L B U M");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- label.setText (" HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- counter3++;
- }
- else if ((eventName.equals ("pic")) && counter3 == 1)
- {
- pic.setIcon (new ImageIcon ("me.jpg"));
- label.setText (" PHOTO OF MOI!");
- buttonme.setText ("YOU ARE SEEING HIM");
- buttonme.setActionCommand ("YOU ARE SEEING HIM");
- label.setText (" PHOTO OF MOI!");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- counter3++;
- }
- else if ((eventName.equals ("pic")) && counter3 == 2)
- {
- pic.setIcon (new ImageIcon ("avatar.jpg"));
- label.setText (" AVATAR G!");
- buttonavatar.setText ("YOU ARE SEEING THE NEW G");
- buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
- label.setText (" AVATAR G!");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- counter3++;
- }
- }
- else if (eventName.equals ("DONT CLICK HERE OR YOU WILL EXIT"))
- {
- label.setText (" TOLD YOU SO!!!!!!!");
- buttonexit.setText ("TOLD YOU SO!!!!");
- buttonexit.setActionCommand ("TOLD YOU SO!!!!");
- label.setText (" TOLD YOU SO!!!!!!!");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- System.exit (0);
- }
- else if ((eventName.equals ("pic")) && counter == 0)
- {
- pic.setIcon (new ImageIcon ("title.jpg"));
- label.setText (" P H O T O A L B U M");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- label.setText (" HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- counter = 1;
- }
- else if ((eventName.equals ("pic")) && counter == 1)
- {
- pic.setIcon (new ImageIcon ("me.jpg"));
- label.setText (" PHOTO OF MOI!");
- buttonme.setText ("YOU ARE SEEING HIM");
- buttonme.setActionCommand ("YOU ARE SEEING HIM");
- label.setText (" PHOTO OF MOI!");
- buttonavatar.setText ("WATCH HIM GET A MAKEOVER");
- buttonavatar.setActionCommand ("WATCH HIM GET A MAKEOVER");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- counter = 2;
- }
- else if ((eventName.equals ("pic")) && counter == 2)
- {
- pic.setIcon (new ImageIcon ("avatar.jpg"));
- label.setText (" AVATAR G!");
- buttonavatar.setText ("YOU ARE SEEING THE NEW G");
- buttonavatar.setActionCommand ("YOU ARE SEEING THE NEW G");
- label.setText (" AVATAR G!");
- buttontitle.setText ("HOME PAGE");
- buttontitle.setActionCommand ("HOME PAGE");
- buttonme.setText ("VIEW A PIX OF GOPAL");
- buttonme.setActionCommand ("VIEW A PIX OF GOPAL");
- counter = 0;
- }
- }
- private static void runGUI ()
- {
- JFrame.setDefaultLookAndFeelDecorated (true);
- HelloWorldGUI greeting = new HelloWorldGUI ();
- }
- public static void main (String[] args)
- {
- javax.swing.SwingUtilities.invokeLater (new Runnable ()
- {
- public void run ()
- {
- runGUI ();
- }
- }
- );
- } // main method
- } // HelloWorldGUI class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement