Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

from list awt to JList swing

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have create program in awt...now i want create in swing...i have one problem

i have this code in awt:



i have problem in:

String selectedSong = getPlayList2().getItem(selectedIndex);

how to write in swing???

i'm trying from long time.... :-(
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paul, please BeForthrightWhenCrossPostingToOtherSites
http://www.java-forums.org/awt-swing/62806-list-awt-jlist-swing.html
 
K. Tsang
Bartender
Posts: 3521
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi paul

Have you looked at the JList javadoc for clues? What does the getPlayerList2() return?
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i Have you looked at the JList javadoc....

but i don't understand....how to write in swing...

help me please!!!

my problem is "getItem"

i don't no how to convert in swing
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getPlayList2() return one file from database....
 
K. Tsang
Bartender
Posts: 3521
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paul beppe wrote:getPlayList2() return one file from database....


There are several ways but to keep it simple, populate the getPlayList2() into an array. Now you will also need to loop through the database to while populating your array. Once you have this array your JList is self explanatory.

You may also want to explore ListModel, which if defined properly should give you more control of your data.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic