Results 1 to 7 of 7

Thread: jlist items

  1. #1
    bullstreetboy is offline Member
    Join Date
    Apr 2009
    Posts
    10
    Rep Power
    0

    Default jlist items

    I need to iterate though all items in a list box.

    :confused: How do I get ALL items in a listbox?

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    if your list box is JList...
    read JList (Java Platform SE 6)

    if your list box is JCombobox
    read JComboBox (Java Platform SE 6)
    getItemAt(int index)
    getItemCount()
    may help you...

  3. #3
    bullstreetboy is offline Member
    Join Date
    Apr 2009
    Posts
    10
    Rep Power
    0

    Default

    Thanks for the response mtyoung. It must contain the answer somewhere.

    I'm a complete novice to Java but an experience vb.net programmer trying to ditch Microsoft.

    Is it just me? - the link you sent seems daunting to a would be Java programmer.

    I'm not asking anyone to write the code for me but the transition from Net to Java is not as trivial as I hoped.

    I'll keep trying.

  4. #4
    neilcoffey is offline Senior Member
    Join Date
    Nov 2008
    Posts
    286
    Rep Power
    6

    Default

    The link that @mtyoung gave should be regarded as the reference manual; it assumes you know the basics of Java and Swing.

    You need to know the basics of Java: how to declare variables, how to write a loop, how to put classes together etc. This part is surely quite different to VB. If you were a C# programmer, it would probably seem much closer.

    Then, I'd recommend you go through at least parts of a basic Swing tutorial, such as Sun's Swing tutorial. I think many of the concepts of the library classes will be similar to .Net (I'm not a .Net programmer, but the bits I've seen seem pretty much a direct rip-off from Java; not sure how the UI classes work, though).

  5. #5
    bullstreetboy is offline Member
    Join Date
    Apr 2009
    Posts
    10
    Rep Power
    0

    Default

    Thanks Neil

    I've got the basic of Java via Sams Teach yourself but it is not the best Sams that I have read. I'll take a look at the Swing tutorial.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    At least search on the forum, or on the web. You can find lots of examples related to this. :)

  7. #7
    bullstreetboy is offline Member
    Join Date
    Apr 2009
    Posts
    10
    Rep Power
    0

    Default

    Thanks Eranga

    I've found a solution. I think I must switch off my VB.net brain and start thinking Java.

Similar Threads

  1. CheckBox Jlist items
    By dropez in forum AWT / Swing
    Replies: 1
    Last Post: 03-26-2009, 07:39 PM
  2. different sort of items
    By jrleonard in forum SWT / JFace
    Replies: 0
    Last Post: 12-23-2008, 02:41 PM
  3. Replies: 0
    Last Post: 07-11-2008, 04:31 PM
  4. Display items in the JCombo Box
    By eddy001 in forum AWT / Swing
    Replies: 1
    Last Post: 01-21-2008, 12:27 AM
  5. Replies: 0
    Last Post: 01-04-2008, 09:34 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
  •