473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ScrollBar Problem

I have Jlist , and i am using HORIZONTAL WRAP , and now want a VerticalscrollBar when needed.
i am giving you the my sample of code
public void reinitialize() {
removeAll();
setLayout(new GridLayout(0, 1));
list = new JList(new AddaxFMSBodyListModel(super.getBodyPanel().getEnti tyList()));
list.setCellRenderer(new AddaxFMSBodyListViewCellRenderer());
list.setVisibleRowCount(-1);
//list.setSize(new Dimension(30, 30));
list.addListSelectionListener(new AddaxFMSBodyListSelectionListener());
DragSelectionListener dragListener = new DragSelectionListener();
list.addMouseMotionListener(dragListener);
list.addMouseListener(dragListener);
PopUpListener popUp = new PopUpListener();
list.addMouseListener(popUp);
list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
JScrollPane scrollPane = new JScrollPane(list,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollPane);
}
but here is the problem is that vertical scrollbar always come.
and i need when its needed .
Can any body help.
Apr 11 '08 #1
1 1552
sukatoa
539 512MB
I have Jlist , and i am using HORIZONTAL WRAP , and now want a VerticalscrollBar when needed.
i am giving you the my sample of code
public void reinitialize() {
removeAll();
setLayout(new GridLayout(0, 1));
list = new JList(new AddaxFMSBodyListModel(super.getBodyPanel().getEnti tyList()));
list.setCellRenderer(new AddaxFMSBodyListViewCellRenderer());
list.setVisibleRowCount(-1);
//list.setSize(new Dimension(30, 30));
list.addListSelectionListener(new AddaxFMSBodyListSelectionListener());
DragSelectionListener dragListener = new DragSelectionListener();
list.addMouseMotionListener(dragListener);
list.addMouseListener(dragListener);
PopUpListener popUp = new PopUpListener();
list.addMouseListener(popUp);
list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
JScrollPane scrollPane = new JScrollPane(list,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollPane);
}
but here is the problem is that vertical scrollbar always come.
and i need when its needed .
Can any body help.
Please use codetags with posting codes so that our experts here can read it easily.

sukatoa.
Apr 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Askari | last post by:
Hi, I do a "perso"widget where have two scrolls (one vertical, one horizontal) for a canvas. When, the first time, I added widget in the canvas, the scroll self-ajust and when I move scrollbar,...
7
by: Barbara de Zoete | last post by:
On one of my pages http://home.wanadoo.nl/b.de.zoete/html/tekeningen.html I have a div containing thumbnails (who ever came up with that word?) to select a larger view of a picture. The div is...
22
by: Colin McGuire | last post by:
I apologize for posting yet another scrollbar question. Here is my code. All I want is for a diagonal line to appear from coordinates (0,0) to (width,height) in a usercontrol regardless of whether...
0
by: d.steininger | last post by:
Hi there! Is there a way to bind a Textbox.Text to a ScrollBar.Value (not the Textbox-own Scrollbar) and vice versa? The Problem: I have to deal with two controls. The Textbox should accept...
2
by: Paul_Madden via DotNetMonster.com | last post by:
I am handling the Listbox DrawItem event to enable the listbox strings to be displayed in different colours for easy reading. Have set ScrollAlwaysVisible and HorizontalScrollbar to true. I...
14
by: Michael Weis | last post by:
Hello all, as a non-professional in these things, I searched for this topic but found no satisfying answer: I have to create a site with 3 frames. (Please no diskussion about the sense of...
2
by: Ray | last post by:
Hi, would someone tell me how to make scrollbar work under grid? I think I'm missing something to connect scrollbar with the grid. following is some sample code. it shows the scrollbar, but it...
1
by: Jenny | last post by:
Dear all, I have one select which lists one visible element. I want this select can show scrollbar after I click its down arrow, so that i can use the scrollbar to select the element i want. ...
3
by: nicky77 | last post by:
Hi, before you say it i know frames are bad practice - but i'm developing dynamic content on a site which has already been designed, so alas there's no option but to use them. Anyway, I just want to...
1
by: Tom | last post by:
First, I posted a similar request for help in another group and now don't find the posting. Problem with my newsreader perhaps ... but apologies if this appears as a cross posting. My code is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.