Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3081 > unrolled thread

JList: Scroll to Selected

Started by"Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this>
First post2011-04-27 15:42 +0000
Last post2011-04-27 15:42 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.lang.java.gui


Contents

  JList: Scroll to Selected "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
    Re: JList: Scroll to Sele "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
      Re: JList: Scroll to Sele "Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000

#3081 — JList: Scroll to Selected

From"Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectJList: Scroll to Selected
Message-ID<3ONmj.5795$O9.926@trnddc01>
  To: comp.lang.java.gui
I'm using Java 1.4.2 and I've tried searching for this and can't find it,
but I'm sure I saw a method for a JList to scroll to the selected item.

There are times a JList (in a JScrollPane) is reloaded.  On some platforms,
apparently, when I reload it, even though I make sure the same item stays
selected, users report that the list then resets to show the top of the
list only.

Maybe I'm mixing things up, but I was sure I saw something like
scrollToSelected() for a JList or JScrollPane, but I can't find it in the
API index and couldn't find it in a search.  Is it under a different
wording or is there another method that scrolls a JList to show the
selected item?

Thanks!

Hal

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#3082 — Re: JList: Scroll to Sele

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: JList: Scroll to Sele
Message-ID<479bc2e7$0$27870$b9f67a60@news.newsdemon.com>
In reply to#3081
  To: comp.lang.java.gui
Hal Vaughan wrote:
> I'm using Java 1.4.2 and I've tried searching for this and can't find it,
> but I'm sure I saw a method for a JList to scroll to the selected item.
> 
> There are times a JList (in a JScrollPane) is reloaded.  On some platforms,
> apparently, when I reload it, even though I make sure the same item stays
> selected, users report that the list then resets to show the top of the
> list only.
> 
> Maybe I'm mixing things up, but I was sure I saw something like
> scrollToSelected() for a JList or JScrollPane, but I can't find it in the
> API index and couldn't find it in a search.  Is it under a different
> wording or is there another method that scrolls a JList to show the
> selected item?
> 
> Thanks!
> 
> Hal

See JList.ensureIndexIsVisible() and JList.setSelectedValue()

-- 

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDem

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3083 — Re: JList: Scroll to Sele

From"Hal Vaughan" <hal.vaughan@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: JList: Scroll to Sele
Message-ID<paRmj.533$ar6.314@trnddc07>
In reply to#3082
  To: comp.lang.java.gui
Knute Johnson wrote:

> Hal Vaughan wrote:
>> I'm using Java 1.4.2 and I've tried searching for this and can't find it,
>> but I'm sure I saw a method for a JList to scroll to the selected item.
>> 
>> There are times a JList (in a JScrollPane) is reloaded.  On some
>> platforms, apparently, when I reload it, even though I make sure the same
>> item stays selected, users report that the list then resets to show the
>> top of the list only.
>> 
>> Maybe I'm mixing things up, but I was sure I saw something like
>> scrollToSelected() for a JList or JScrollPane, but I can't find it in the
>> API index and couldn't find it in a search.  Is it under a different
>> wording or is there another method that scrolls a JList to show the
>> selected item?
>> 
>> Thanks!
>> 
>> Hal
> 
> See JList.ensureIndexIsVisible() and JList.setSelectedValue()
> 
Great!  I knew about setSelectedValue(), but the ensureIndexIsVisible() is
exactly what I was looking for!  I guess it's a case of tunnel vision where
I was so stuck on what I thought I saw I missed what I needed.

Thanks!

Hal

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web