• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

List box with vertical & horizontal scroll bar

I created a List box. When I add more items than will fit in the display size a vertical scroll bar is created. How can I cause a horizonal scroll bar to be created so that I can view lines that are too long for the display?
0
jc31415
Asked:
jc31415
  • 3
  • 2
1 Solution
 
CrawfordCommented:
AWT or Swing?
0
 
ylyipCommented:
I assume you are talking about common list of AWT. You may not treat it as an answer: you don't need to do anything, but the scroll bar will appear when it is needed.

You can make an applet and try two things:
1. Create a list and add items that are too long before execution, then execute the applet.

2. Create a list, a textbox and a button. At run time, when the button is pressed, the text content is added to the list.

You will see that in both cases, the scroll bar appear automatically.
(Please tell me if you find a different result.)
0
 
jc31415Author Commented:
I am using AWT. I assumed it would work as you described, but I added an item that was too long and no horizontal scroll bar appeared. One note, I am using reshape to set the size of the list box. That may have an affect on my result.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
ylyipCommented:
I have tried reshape(), but it is ok. Anyway, reshape is deprecated, use setbound instead.
Could you post your code here?
0
 
jc31415Author Commented:
When I said it didn't create a horizonal scroll bar I was running on 1.2. When I ran on 1.1.2 it worked as expected.
0
 
ylyipCommented:
I have checked the spec. of list for 1.2, but it seems to contain nothing about the auto-scroll. If you are interested, please read
http://java.sun.com/products/jdk/1.2/docs/api/java/awt/List.html
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now