Results 1 to 2 of 2
  1. #1
    hien_NU is offline Member
    Join Date
    Jan 2008
    Posts
    5
    Rep Power
    0

    Question How an array can check that profile whether exists or not???

    I've declared an array containing profile 1, profile 2, and profile 3. Each profile contains name, job, nation...

    Now, i want to declare a new profile (e.g profile 4). In profile 4, after inputing name, i want array to check that whether name exists or not. If name have existed in profile 1, 2 or 3. It will display message "Your name already exists. Do you want to update or not?".

    Anyone can help me. plz?:confused:

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    You can add an ActionListener to the textField which will send an ActionEvent when the user presses the "enter". In the listener you can read the name from the textField and then run through the array and look for the name in each array element. If you find it you can announce success to the user via a JOptionPane.showMessage/ConfirmDialog.

Similar Threads

  1. Replies: 2
    Last Post: 04-07-2009, 06:25 AM
  2. Using reflection to check array type and length
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 08:42 PM
  3. How to check whether file is exists or not
    By Java Tip in forum java.io
    Replies: 0
    Last Post: 04-05-2008, 10:13 AM
  4. Check if a web page exists or not
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-02-2008, 07:24 PM
  5. questions about using array to store profile
    By hien_NU in forum New To Java
    Replies: 6
    Last Post: 01-08-2008, 05:03 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
  •