Article View: borland.public.jbuilder.java.swing
Article #256Re: Missing events
From: garethconner
Date: Tue, 29 May 2007 01:59
Date: Tue, 29 May 2007 01:59
24 lines
2196 bytes
2196 bytes
On Apr 6, 11:42 am, "Bruce Houghton" <bhou...@globalserve.net> wrote:
> When using MouseAdapters on JLists or JTables I seem to experience
> missing events. Clicking on an area will always cause that area to be
> highlited, but it won't allways cause and event.
> One other thing, the Lists and Tables are in ScrollPanes
> Q. Is there a better way to do this?
> Q. Or is this the only way and I'm stuck with it?
> Oh by the way, these are in JApplet's.....JRE1.5...
> Bruce Houghton
> Example:
> JScrollPane jScrollPane = new JScrollPane(jTable1);
> jScrollPane.setBounds(new Rectangle(20, 92, 480, 612));
> jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
> public void mouseClicked(MouseEvent e) {
> JOptionPane.showMessageDialog(null, "Say Something");
> }
>
> });
It's more reliable to use mousePressed(MouseEvent e). The
mouseClicked event will only be dispatched if the cursor position
hasn't changed between the mousePressed and mouseReleased.
-Gareth Conner
Technical Details
Message-ID:
<1180403980.476157.87640@k79g2000hse.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!k79g2000hse.googlegroups.com!not-for-mailReferences:
<46166a31$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,dec980017feb87ab X-Google-Attributes: gid111d45,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!k79g2000hse.googlegroups.com!not-for-mail From: garethconner@gmail.com Newsgroups: borland.public.jbuilder.java.swing Subject: Re: Missing events Date: 28 May 2007 18:59:40 -0700 Organization: http://groups.google.com Lines: 25 Message-ID: <1180403980.476157.87640@k79g2000hse.googlegroups.com> References: <46166a31$1@newsgroups.borland.com> NNTP-Posting-Host: 70.188.130.95 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1180403980 32679 127.0.0.1 (29 May 2007 01:59:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 29 May 2007 01:59:40 +0000 (UTC) In-Reply-To: <46166a31$1@newsgroups.borland.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k79g2000hse.googlegroups.com; posting-host=70.188.130.95; posting-account=NHGfewwAAACmRlQlFQZUCIkp8yCu3FHh