Results 1 to 3 of 3
  1. #1
    cromie11 is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default swing passwordField to change jPanel background colour

    listen junky heres a few tips back the reason this forum is called NEW TO JAVA is ats it suggests this was my first ever post and its a bit unfair to criticize i could easily have cut out where i was stuck so now with your advice

    public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (OK.equals(cmd)) { //Process the password.
    char[] input = txtPassword2.getPassword();
    if (isPasswordCorrect(input)) {
    jP1.setBackground(Color.red);

    }
    else {
    jP1.setBackground(Color.black);
    }

    //Zero out the possible password, for security.
    Arrays.fill(input, '000');

    txtPassword2.selectAll();

    }
    }http://www.java-forums.org/images/smilies/skype/)-.gif
    why does the panel not change to red but under a button click event does many thanks

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Quote Originally Posted by cromie11 View Post
    listen junky heres a few tips back the reason this forum is called NEW TO JAVA
    Hey. I was just offering some suggestions how you can improve your post and increase the chances of getting help. On the otherhand if you just want to be an ignorant butthole who alienates the very people you want to get help from, then by all means go right ahead.

    Here's one more tip, do not start ANOTHER thread on the same topic. This will also piss regulars off and reduce your chances of getting help. I for one do not plan on wasting anymore time on you!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Duplicate thread closed.

    Original poster, please stick to one thread per question. You may also wish to get a thicker skin and avoid biting the hand that feeds you.

    Luck!

Similar Threads

  1. Replies: 4
    Last Post: 05-30-2011, 02:53 AM
  2. Change colour of JOptionPane
    By chirag123 in forum AWT / Swing
    Replies: 1
    Last Post: 05-03-2011, 02:48 AM
  3. Change JPanel background after its been set once
    By mevets in forum AWT / Swing
    Replies: 4
    Last Post: 04-14-2010, 01:07 AM
  4. unable to change the TextArea.background !
    By Y. Progammer in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 04:55 PM
  5. Replies: 0
    Last Post: 03-26-2009, 01:23 AM

Posting Permissions

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