Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes How to create a horizontal JList? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to create a horizontal JList?" Watch "How to create a horizontal JList?" New topic
Author

How to create a horizontal JList?

Qusay Jaafar
Ranch Hand

Joined: May 06, 2002
Posts: 127
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.


Qusay
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Check out the information for the setLayoutOrientation method in the Method Details section of the JList api.
Qusay Jaafar
Ranch Hand

Joined: May 06, 2002
Posts: 127
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

Joined: May 06, 2002
Posts: 127
any idea please?
Kriti Garg
Ranch Hand

Joined: Sep 13, 2004
Posts: 50
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to create a horizontal JList?
 
Similar Threads
Loading/Saving a Listbox
JList selection method
Vector or ArrayList use for dropdown with more than 1000 entries
Count items in JList
JList Autosearch with Custom Renderer