Results 1 to 5 of 5
  1. #1
    Bomber_Will is offline Member
    Join Date
    Nov 2008
    Posts
    40
    Rep Power
    0

    Default Deleting and Adding Lists in Java Applets

    The coding to this is in my other topic on this section but I'm not allowed to link until I have a post count of 20.

    Is their a way to make a choice list in the applet that when you pick on a choice, creates a new list? Then if the user picks a new choice from the first list, it deletes the second list and makes a new list.

    Example:
    -User opens the applet and sees List 1 with Choice A, Choice B, Choice C.
    -User picks Choice A from List 1 and it creates a List 2 with Choice D, Choice E, Choice F
    -User goes back to List 1 and picks Choice B
    -List 2 gets deleted and List 3 is created with Choice G, Choice H, Choice I

    The only way I'm thinking is to make a class per choice but I don't even know if that would delete automatically or not and I am not sure how to delete specific things. Last time I tried to delete one list, I managed to delete everything but the first Label created.

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Have you looked into JListControl?
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    Bomber_Will is offline Member
    Join Date
    Nov 2008
    Posts
    40
    Rep Power
    0

    Default

    I just looked into JList and it seems that clear() method almost does what I want. I just need to find a way for it to clear 1 section instead of the entire applet. Thanks, i'll keep looking.

  4. #4
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Very likely, what you need to do is call new on each new List, depends on system loading and so on. For each section, have one list. You can have an array of Lists or a list of lists. Sounds like new operator is what you want.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  5. #5
    Bomber_Will is offline Member
    Join Date
    Nov 2008
    Posts
    40
    Rep Power
    0

    Default

    I saw somewhere that they had a list, cleared it, and put it back along with a new option and new lists under it. That would be a way to get what I want and it seems pretty easy to do. I found a few books that'll help me with my second problem of connecting to a database, hopefully I can make sense out of it so I can knock out the connecting to a database and this list problem at the same time.

Similar Threads

  1. Rotating objects in Java Applets
    By Unome in forum Java Applets
    Replies: 1
    Last Post: 10-17-2008, 07:35 AM
  2. Java Collection Framework (Lists)
    By Java Tutorial in forum Java Tutorial
    Replies: 1
    Last Post: 05-16-2008, 01:44 PM
  3. reading dir in java applets
    By willemjav in forum Java Applets
    Replies: 3
    Last Post: 02-07-2008, 12:36 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
  •