Results 1 to 2 of 2
  1. #1
    hamzeeco is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Angry whats wrong with this code

    cp = getContentPane(); // from "this" JApplet
    cp.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));

    EnterUserID = new JTextField("Enter ID");
    EnterUserPW = new JPasswordField(10);
    EnterPWButton = new JButton("Enter PW");
    l = new JLabel("Success");

    EnterPWButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {

    if(EnterUserPW.getPassword()[0]=='a')
    {
    AckUser=true;
    cp.remove(EnterUserID);
    cp.remove(EnterUserPW);
    cp.remove(EnterPWButton);

    cp.repaint();
    }

    }
    });

    if((AckUser == false))
    {
    cp.add(EnterUserID);
    cp.add(EnterUserPW);
    cp.add(EnterPWButton);
    }
    else
    {
    cp.add(l);
    }



    after i press the button, the applet is empty, and the label doesnt show

    how do i restructure the frame within the JApplet?

    1) enter pw/id
    2) if yes ->display success message and remove pw/id text fields and button

  2. #2
    hamzeeco is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default

    Quote Originally Posted by ABNER.STERLING View Post
    If you’re like most holiday revelers, you’ve got a few parties to attend this season. Odds are that upon walking through the door, you’ll be faced with a large bowl of murky liquid known as eggnog.
    douchebaggery! look it up!
    and after you do that, you go get yourself a "life".

Similar Threads

  1. whats wrong with my code?
    By beandip408 in forum New To Java
    Replies: 6
    Last Post: 11-03-2010, 12:01 AM
  2. whats is wrong with this app??
    By mrajan in forum New To Java
    Replies: 4
    Last Post: 06-09-2010, 10:56 PM
  3. Whats wrong with this code???
    By javanew in forum New To Java
    Replies: 4
    Last Post: 03-28-2010, 05:46 PM
  4. Whats wrong with this code?
    By bbtgirl in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 03:51 AM
  5. Whats wrong with my code???
    By Soda in forum New To Java
    Replies: 2
    Last Post: 12-06-2007, 12:54 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
  •