-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.3.0
-
sparc
-
solaris_7
Name: boT120536 Date: 01/10/2001
(filed against kest-sol-fcs)
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
A JList, in a JScrollPane, in a box, in a JPanel, with
20 some items:
a.) Returns -1 from getFirstVisibleIndex() when the
first item in the list is displayed.
b.) Returns -1 from getLastVisibleIndex() when the
last item in the list is displayed.
The application has two lists of terms, where each list
is in a different language. The goal was to keep the two
lists synchronized after selections, yet independently
scrollable. It seemed that ensureIndexIsVisible() would
be the right way to do that. But even after correcting the
values returned by getFirstVisibleIndex and getLastVisibleIndex
in one list, using those values as arguments to ensureIndexIsVisible
in the second list has no effect.
Only ensureIndexIsVisible() on the selected-item index has any
effect, but the effect is limited -- the lists are not fully
syncronized.
Possible solutions:
added API: ensureRangeIsVisible(firstIndex, lastIndex)
--this API would allow precise positioning of the displayed
values
(OR)
added API: ensureIndexIsVisibleAtPosition(index, lineNumber)
--again, this API would allow precise positioning of the
displayed values.
As a documentation exercise:
--if -1 can be returned by the visibleIndex operations under
any circumstances, those circumstances should be documented.
--the effect of ensureIndexIsVisible should be documented.
..will the minimum amount of scrolling take place?
..will the item be shown at the top of the list, or at the
bottom?
..will it be shown at the top if it was above the current
view, and at the bottom if after?
..will multiple calls have any effect?
for example, will ensureIndexIsVisible(0) followed by
ensureIndexIsVisible(20) always ensure that item 20 is
at the top of the list, as opposed to it being at the
bottom in some circumstances? Or are multiple calls
ignored in favor of the last? (It appears that may be
the case, at the moment, in which case the argument for
the additional APIs is all the stronger.)
(Review ID: 111391)
======================================================================
- duplicates
-
JDK-4308384 Allow JList items to be arranged horizontally
- Resolved