Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24
  1. #21
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    getNextMatch can only be called with respect to a instance of JList...so can only be called from your "list" object.

    At the moment you have written it in a way that says there is a getNextMatch method on whatever class it is this code is in. Which is clearly not the case.

  2. #22
    Mikey is offline Member
    Join Date
    Mar 2011
    Posts
    15
    Rep Power
    0

    Default

    Right, I did think I would have problems with that line of code. So then, how do I apply the list.getNextMatch(..) to setSelectedIndex()? I want it to set the selected index when the user types a matching search and presses the search button. I just can't seem to figure this out.

  3. #23
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default

    getNextMatch() returns an int.
    That in can either be assigned to a variable:
    Java Code:
    int someInt = list.getNextmatch(...);
    or, it can be passed straight into another method call as a parameter:
    Java Code:
    someOtherMethod(list.getNextMatch(...));
    ...

  4. #24
    Mikey is offline Member
    Join Date
    Mar 2011
    Posts
    15
    Rep Power
    0

    Default

    Thankyou so very very much, I have it now working successfully! Thankyou both :)

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Link one JList to another JList
    By mib1bee in forum AWT / Swing
    Replies: 1
    Last Post: 12-31-2010, 07:10 PM
  2. Link one JList to another JList
    By mib1bee in forum New To Java
    Replies: 1
    Last Post: 12-30-2010, 06:24 PM
  3. Replies: 0
    Last Post: 10-29-2009, 09:28 AM
  4. How could I search elements in a Jlist?Please Help!
    By Pro Alinio in forum New To Java
    Replies: 4
    Last Post: 03-25-2009, 11:49 PM
  5. Replies: 5
    Last Post: 08-26-2008, 03:43 PM

Tags for this Thread

Posting Permissions

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