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

    Default i have a bunch of strings in an arraylist and...

    i want to allow the user of my program to type in a certain string into a textfield and click search. after this if the string is found it should be shown in a textfield. how can I do this? thanks.

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

    Default

    Set up your gui. You can use an ActionListener added to the entry textField and/or a JButton to start processing the search. In the actionPerformed method read the string in from the entry textField and send it to a search method in which you traverse through the ArrayList and compare the search string with each item in the list. If you find a match set the text in the second textField.

Similar Threads

  1. Replies: 2
    Last Post: 04-21-2008, 11:43 AM
  2. characters + strings
    By Gilgamesh in forum New To Java
    Replies: 3
    Last Post: 03-02-2008, 10:10 PM
  3. Comparison of Strings
    By Cero.Uno in forum New To Java
    Replies: 3
    Last Post: 02-11-2008, 03:46 AM
  4. Comparing Strings
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-03-2007, 10:44 AM
  5. reversing Strings
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-11-2007, 09:24 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
  •