Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.event.*;
- import java.util.Scanner;
- import java.awt.*;
- import java.io.File;
- import javax.imageio.ImageIO;
- import java.awt.image.BufferedImage;
- import java.io.IOException;
- import java.awt.Image;
- import javax.swing.ImageIcon;
- //////////////////////////////////
- // 3nriched Games Presents: //
- // MIPS The Mouse!! //
- //////////////////////////////////
- class BGPanel extends JPanel
- {
- private Image img;
- BGPanel(ImageIcon i)
- {
- img = i.getImage();
- setPreferredSize(new Dimension(img.getWidth(this), img.getHeight(this)));
- }
- @Override
- public void paintComponent(Graphics g)
- {
- super.paintComponent(g);
- g.drawImage(img, 0, 0, this);
- }
- }
- public class enrichedisgay extends JFrame implements ActionListener
- {
- JPasswordField pass;
- public static void main(String[] args)
- {
- enrichedisgay dumbfuck = new enrichedisgay();
- }
- public enrichedisgay()
- {
- ImageIcon image1 = new ImageIcon("C:/Documents and Settings/oasisfleeting/My Documents/My Pictures/beccaM3/BeccasPussyClevage.jpg");
- ImageIcon image2 = new ImageIcon("C:/Documents and Settings/oasisfleeting/My Documents/My Pictures/beccaM3/BeccasPussyClevage.jpg");
- BGPanel panel = new BGPanel(image1);
- add(panel);
- this.setIconImage(image2.getImage());
- setTitle("Mips The Mouse Login");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- pass = new JPasswordField(5); //sets password length to 5
- pass.setEchoChar('@'); //hide characters as @ symbol
- pass.addActionListener(this); //adds action listener
- JButton btnEnter = new JButton("Enter"); //creates a button
- btnEnter.addActionListener(this);// Register the action listener.
- JLabel lblpdub = new JLabel(" Your Password: ");
- panel.add(lblpdub, BorderLayout.CENTER);// adds label and inputbox
- panel.add(pass, BorderLayout.CENTER); // to panel and sets location
- panel.add(btnEnter, BorderLayout.CENTER); //adds button to panel
- pack(); // packs controls and
- setLocationRelativeTo(null); // Implicit "this" if inside JFrame constructor.
- setVisible(true);
- }
- public void actionPerformed(ActionEvent a)
- {
- Object source = a.getSource();
- char[] passy = pass.getPassword();
- String p = new String(passy);
- //determines if user entered correct password
- if (p.equals("mouse"))
- {
- JOptionPane.showMessageDialog(null, "Welcome beta user: USERNAME.");
- }
- else
- {
- JOptionPane.showMessageDialog(null, "You have enter an incorrect password. Please try again.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement