Results 1 to 2 of 2
  1. #1
    imran46726 is offline Member
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Post how to dispose login page

    import java.awt.*;
    import javax.swing.*;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.imageio.ImageIO;
    import javax.swing.JPanel;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JComponent;
    import javax.swing.JFrame;



    public class login {
    JLabel lbluserid, lblpass, image;
    JTextField txtuserid;
    JPasswordField tppass;
    JButton blogin;
    JFrame frame;
    JPanel panel1;
    ImageIcon icon;

    public login(){

    frame = new JFrame(".:: LOGIN ::.");
    frame.setSize(300, 200);
    frame.setResizable(false);
    frame.setLayout(null);

    JPanel panel1 = new JPanel(null);
    panel1.setBorder(BorderFactory.createTitledBorder( "LOGIN"));
    JLabel lbluserid = new JLabel("USER ID :");
    JLabel lblpass = new JLabel ("PASSWORD :");
    final JTextField txtuserid = new JTextField ();
    final JPasswordField tppass = new JPasswordField();
    JButton blogin = new JButton("LOGIN");
    final JLabel image = new JLabel();
    icon = new ImageIcon("IMRAN.jpg");

    panel1.add(lbluserid);
    panel1.add(lblpass);
    panel1.add(txtuserid);
    panel1.add(tppass);
    panel1.add(blogin);
    panel1.add(image);
    frame.add(panel1);

    panel1.setBounds(0,0,300,200);
    image.setBounds(0,0,300,200);
    lbluserid.setBounds(30,30,100,20);
    lblpass.setBounds(30,60,100,20);
    txtuserid.setBounds(140,30,100,20);
    tppass.setBounds(140,60,100,20);
    blogin.setBounds(80,120,80,20);

    ImageIcon img = new ImageIcon("login.jpg")
    {

    @Override
    public void paintIcon(Component c, Graphics g, int x, int y)
    {
    g.drawImage(getImage(), x, y, c.getWidth(), c.getHeight(), c);
    }

    @Override
    public int getIconHeight()
    {
    return image.getHeight();
    }

    @Override
    public int getIconWidth()
    {

    return image.getWidth();
    }
    };
    image.setIcon(img);

    blogin.addActionListener(new java.awt.event.ActionListener() {

    public void actionPerformed(java.awt.event.ActionEvent evt) {
    String id = txtuserid.getText();
    char p[] = tppass.getPassword();
    String psw = new String(p);
    if( (id.equals( "admin")) && (psw.equals( "123"))){

    JOptionPane.showMessageDialog(null,"Login Successful !!!");
    gui obj1=new gui();
    loading obj2=new loading();
    obj2.liquid();
    frame.dispose();
    }else{

    JOptionPane.showMessageDialog(null,"Wrong User Name/ password !!!");
    }
    }
    });





    frame.setFocusable(true);
    frame.setVisible(true);
    frame.setLocationRelativeTo(null);

    }

    }


    here frame.dispose() didnot work and obj.loading() didnot work properly

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: how to dispose login page

    Please use [code] tags [/code] when posting code.
    That lot is rather difficult to read without them.

    What does "did not work" mean?
    Errors?
    Exceptions?
    At first glance that code doean't look like it would compile.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. login page
    By banie in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-09-2008, 08:37 AM
  2. JSP login page
    By banie in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-06-2008, 04:23 AM
  3. login page
    By keerthi_y19 in forum New To Java
    Replies: 9
    Last Post: 08-06-2008, 11:58 AM
  4. Login page
    By banie in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-03-2008, 02:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •