|
-
November 1st, 2006, 11:32 AM
#2
Re: Need Button advice
Hi,
Firstly without all your code it is hard to help, I don't know what type the variable dvds is? You say it is an array but it looks more like a List of some type. If you want to just get the first entry then doing it like this should work:
Code:
DVD dvd = (DVD)dvds.get(0);
Although I'm not sure why you would only want to get the first entry each time you click the button
It seems that what you had was correct, it looks like you have a JList that is populated with data from your List/Array. So then you would be able to get the exact entry that is selected in the JList by saying:
Code:
DVD dvd = (DVD)dvds.get(list.getSelectedIndex());
Which is what you had and seems like the most logical thing to do.
Hope This Helps
Byron Tymvios
Please use [ CODE ] and [/ CODE ] tags when posting code! See THIS on how to use code tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|