Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #178
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail |
|---|---|
| From | "usenet" <usenet@THRWHITE.remove-dii-this> |
| Subject | Re: Highlight itemin JLis |
| Message-ID | <4T3la4akInu5@uni.chka.de> (permalink) |
| X-Comment-To | comp.lang.java.gui |
| Newsgroups | comp.lang.java.gui |
| In-Reply-To | <9_n5h.217903$Ry4.146642@newsfe10.phx> |
| References | <9_n5h.217903$Ry4.146642@newsfe10.phx> |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] |
| Lines | 35 |
| Date | Wed, 27 Apr 2011 15:26:02 GMT |
| NNTP-Posting-Host | 96.60.20.240 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1303917962 96.60.20.240 (Wed, 27 Apr 2011 10:26:02 CDT) |
| NNTP-Posting-Date | Wed, 27 Apr 2011 10:26:02 CDT |
| Organization | TDS.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.gui:178 |
Show key headers only | View raw
To: comp.lang.java.gui
Knute Johnson <nospam@rabbitbrush.frazmtn.com> wrote:
> Java and Swing wrote:
> > I have a JList which I add a MouseListener to. When the mouseEntered
> > method gets called I'd like to select the item in the JList for which
> > the mouse is over.
> I thought this was going to be difficult, turns out it is pretty simple.
> JList list = new JList();
> list.addMouseMotionListener(new MouseAdapter() {
> public void mouseMoved(MouseEvent me) {
> Point p = new Point(me.getX(),me.getY());
Eh, MouseEvent.getPoint().
> list.setSelectedIndex(list.locationToIndex(p));
Probably setSelectedIndex(-1) is not valid -- this occurs (only) if there
are no items.
Also see: http://groups.google.com/group/comp.lang.java.gui/browse_frm/thread/1f9886beebe795b
Christian
---
* 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
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Find similar
Highlight itemin JList on "Java and Swing" <java.and.swing@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
Re: Highlight itemin JLis "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
Re: Highlight itemin JLis "usenet" <usenet@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
csiph-web