Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By kjkrum

Thread: Dynamic content on JScrollPane

  1. #1
    genome_boy is offline Member
    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0

    Default Dynamic content on JScrollPane

    Hello there, my 1st post in here ;)

    I recently started using swing and since then I managed to get used to must of the stuff. However, I'm having some trouble regarding dynamic contents:

    Suposing that I have a class "Car" and some other class that keeps a list of cars.

    On the graphical interface I'm trying to show the content of that list on a JScroll, as is (sort of like a list):

    "Car1" "Red" "150BHP" "InStock" "Serial1235"
    "Car2" "Black" "120BHP" "SoldOut" "Serial2334"

    with each string ("") possibly being a different label.

    Furthermore I was also hoping to being able to change the content of each row of the list. Per example: the "InStock" row would be a drop-down list where I would be able to update the status of the stock for each car.

    With my little knowledge on this subject, I was thinking on something like this:

    1) through code, iterate through the list and, for each entry,
    2) create a generic jpanel and add the necessary jLabels setting the text of each one according to the each car

    However, I think this would require some knowledge on layouts, borders, etc no?

    Sorry for the long post but I was trying to be as accurate as possible. Any help would be appreciated! Thanks in advance ;)

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Dynamic content on JScrollPane

    Fubarable likes this.
    Get in the habit of using standard Java naming conventions!

  3. #3
    genome_boy is offline Member
    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0

    Default Re: Dynamic content on JScrollPane

    Yeah, that probably should do it. I will study its features. Thanks for the (quick) help :)

Similar Threads

  1. print the full content of JScrollpane
    By Mion in forum AWT / Swing
    Replies: 13
    Last Post: 11-25-2011, 04:22 PM
  2. Replies: 1
    Last Post: 04-19-2011, 08:52 AM
  3. Dynamic Content and Styles problem...
    By ThisIsPathetic in forum New To Java
    Replies: 1
    Last Post: 03-20-2011, 07:24 PM
  4. Moving whole content of JScrollPane by mousedrag
    By Taiko in forum AWT / Swing
    Replies: 4
    Last Post: 01-16-2010, 08:44 PM
  5. Replies: 0
    Last Post: 02-12-2008, 05:05 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
  •