Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.67 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.event.*;
  3. import java.util.Scanner;
  4. import java.awt.*;
  5. import java.io.File;
  6. import javax.imageio.ImageIO;                    
  7. import java.awt.image.BufferedImage;    
  8. import java.io.IOException;
  9. import java.awt.Image;
  10. import javax.swing.ImageIcon;  
  11. //////////////////////////////////
  12. //   3nriched Games Presents:   //
  13. //      MIPS The Mouse!!        //
  14. //////////////////////////////////          
  15.  
  16.  
  17. class BGPanel extends JPanel
  18. {
  19.    private Image img;
  20.  
  21.    BGPanel(ImageIcon i)
  22.    {
  23.       img = i.getImage();
  24.       setPreferredSize(new Dimension(img.getWidth(this), img.getHeight(this)));
  25.    }
  26.    
  27.    @Override
  28.    public void paintComponent(Graphics g)
  29.    {
  30.       super.paintComponent(g);
  31.       g.drawImage(img, 0, 0, this);
  32.    }
  33. }
  34.  
  35. public class enrichedisgay extends JFrame implements ActionListener
  36. {
  37.     JPasswordField pass;
  38.    
  39.     public static void main(String[] args)
  40.     {
  41.         enrichedisgay dumbfuck = new enrichedisgay();
  42.     }
  43.  
  44.     public enrichedisgay()
  45.     {
  46.        
  47.        
  48.       ImageIcon image1 = new ImageIcon("C:/Documents and Settings/oasisfleeting/My Documents/My Pictures/beccaM3/BeccasPussyClevage.jpg");
  49.       ImageIcon image2 = new ImageIcon("C:/Documents and Settings/oasisfleeting/My Documents/My Pictures/beccaM3/BeccasPussyClevage.jpg");
  50.      
  51.      
  52.         BGPanel panel = new BGPanel(image1);
  53.      
  54.         add(panel);
  55.  
  56.         this.setIconImage(image2.getImage());
  57.         setTitle("Mips The Mouse Login");
  58.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  59.        
  60.         pass = new JPasswordField(5);  //sets password length to 5         
  61.         pass.setEchoChar('@');   //hide characters as @ symbol
  62.         pass.addActionListener(this);    //adds action listener
  63.  
  64.         JButton btnEnter = new JButton("Enter"); //creates a button    
  65.         btnEnter.addActionListener(this);// Register the action listener.
  66.  
  67.         JLabel lblpdub = new JLabel("       Your Password: ");
  68.  
  69.         panel.add(lblpdub, BorderLayout.CENTER);//  adds label and inputbox
  70.         panel.add(pass, BorderLayout.CENTER);   // to panel and sets location
  71.         panel.add(btnEnter, BorderLayout.CENTER); //adds button to panel
  72.  
  73.         pack(); // packs controls and
  74.  
  75.         setLocationRelativeTo(null);    // Implicit "this" if inside JFrame constructor.
  76.  
  77.         setVisible(true);
  78.     }
  79.  
  80.     public void actionPerformed(ActionEvent a)
  81.     {
  82.         Object source = a.getSource();
  83.         char[] passy = pass.getPassword();
  84.         String p = new String(passy);
  85.  
  86.         //determines if user entered correct password
  87.         if (p.equals("mouse"))
  88.         {
  89.             JOptionPane.showMessageDialog(null, "Welcome beta user: USERNAME.");
  90.         }
  91.         else
  92.       {
  93.             JOptionPane.showMessageDialog(null, "You have enter an incorrect password. Please try again.");
  94.       }
  95.     }
  96.  
  97.    
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement