• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create a horizontal list?

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to create a list that its containts displayed horizontaly?
another thing please,
each item in this list contains many information (e.g name, address,..) all this information is a one item in a horizontal list.

thanks for your ideas
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can cause the fields of each element to appear on one line by overriding toString() like this:
public String toString() { return name + address + city + state; }

You can put lots of stuff on one line by repeatedly using System.out.print(), subject to the size of your line.
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you for your reply but may by it was my fault that I was not clear enough.
What I meant is to create a JList into a GUI like the one below:

|--------------------------------------------|
| first last first1 last1 |
| 11 this Rd, 22 another Rd, |
| first@mymail.com first1@hismail.com |
|---------------------------------------------

--------> Reading this JList in this direction
You can see the first item in this JList contains many information about a person called (first last), his address and his email, so when the item is highlighted, all those information will be highlighted at one time considered as one item in a JList.
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, the image that I created was not clear enough.
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Qusay Jaafar:
thank you for your reply but may by it was my fault that I was not clear enough.
What I meant is to create a JList into a GUI like the one below:

|--------------------------------------------|
| first last first1 last1 |
| 11 this Rd, 22 another Rd, |
| first@mymail.com first1@hismail.com |
|---------------------------------------------



If I understand your question right, you want to have a List box on your GUI inside which you can have three columns. Is that correct?

You can have a Vector to hold three String containing the information that you want and then create a JList using that Vector into the Constructor. Can't you? Try it out.
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using a vector is the same as using an array or using add(object) method. JList will display all those information vertically.
Let me ask my question in another form.
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 Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any idea?
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this is a GUI-related question, you will probaly get a better response if you wander over to the Swing / AWT / SWT / JFace forum to ask your question.

HTH

Layne
 
It runs on an internal combustion engine. This ad does not:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic