Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


List box with vertical & horizontal scroll bar

Posted on 1999-07-22
Medium Priority
Last Modified: 2010-04-16
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?
Question by:jc31415
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 1246889
AWT or Swing?

Accepted Solution

ylyip earned 200 total points
ID: 1246890
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.)

Author Comment

ID: 1246891
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.
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.


Expert Comment

ID: 1246892
I have tried reshape(), but it is ok. Anyway, reshape is deprecated, use setbound instead.
Could you post your code here?

Author Comment

ID: 1246893
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.

Expert Comment

ID: 1246894
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question