Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create a horizontal JList?

 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need JList into a GUI but I need to scroll its elements horizontally not vertically.
just consider its element (right now) as one object.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the information for the setLayoutOrientation method in the Method Details section of the JList api.
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for that.
my second question is:
consider these information:

first name
last name
address
email
phone

I want all those information to be in one element. when the user scroll to another element there will be another information for another person.
How can achieve that?
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any idea please?
 
Kriti Garg
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think OOPS will help u out of this problem

Make a class like Employee or Person

with variable like Name,phone etc what u need.

in your JList add this Object and in
the Class toString() method return Name+Phone+...; etc

Use Default List model if necessary.

addElemet takes Object as argument .


BBye
Kriti.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic