logo       

[ xframe-Bugs-1194591 ] addMouseListener doesn't work: msg#00032

Subject: [ xframe-Bugs-1194591 ] addMouseListener doesn't work
Bugs item #1194591, was opened at 2005-05-03 19:15
Message generated for change (Settings changed) made by kriede
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=454391&aid=1194591&group_id=48863

Category: JXTable
Group: swing
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Iñaqui Medina (inaquimj)
Assigned to: Nobody/Anonymous (nobody)
Summary: addMouseListener doesn't work

Initial Comment:
When you add a mouse listener to a JXTable, the 
methods of the listener are never called.

Probably something like:

public void addMouseListener(MouseListener ml)
{
   getLockedTable().addMouseListener(ml);
   getScrollTable().addMouseListener(ml);
}


Will fix it but then we have another problem: in the 
mouse listener you'll probably try something like:

public void mouseClicked(MouseEvent me)
{
   int col = table.colAtPoint(me.getPoint());
   //do something with col
}

The problem is that the point in the event is relative to 
one of the real tables, so if you try the previous code 
and click on the scroll table you'll get the wrong col.

The way I solve it is by adding a colAtPoint method that 
takes the MouseEvent instead of just the point to get 
the source and compare it against the scroll table and 
then just add getFrozenColumns() to the result.

This is not a neat solution... I guess the nice solution is 
to save the listeners ourselves and add another one that 
identifies the source of the click and creates a new 
mouse event with a modified point and source and 
passes this one to the listeners instead.

I assume colAtPoint still needs to be overriden and 
compare x against getLockedTable().getWidth() to 
identify the table to ask the "question" to.

Hope it's clear.

----------------------------------------------------------------------

Comment By: Kurt Riede (kriede)
Date: 2005-05-10 09:35

Message:
Logged In: YES 
user_id=484961

support for the three listeners MouseListener, 
MouseMotionListener and MouseWheelListener added.

What I did is to write a new implementation for the three 
listener interfaces that delegates all events from the KTables 
to the listeners of the JXTable with translated coordinates.

Also fixed a bug with calculation of x/y coordinates in method 
JXTable.columnAtPoint().

Could you please test this?
As far as I see, your example of a mouseClicked event (using 
method columnAtPoint) should now work as is withourr any 
hacks.
I also think/hope that your new method colAtPoint
(MouseEvent) is not needed anymore.

Regards
Kurt

----------------------------------------------------------------------

Comment By: Iñaqui Medina (inaquimj)
Date: 2005-05-04 22:09

Message:
Logged In: YES 
user_id=1086927

Well I just implemented the not-nice solution so I wouldn't do 
it right away.

If you do it I'll test it.

----------------------------------------------------------------------

Comment By: Kurt Riede (kriede)
Date: 2005-05-04 00:10

Message:
Logged In: YES 
user_id=484961

After short thinking, our own Listener sounds as the right way 
to do it. Do you have the time and the need to implement 
this, or would you like me to help providing some initial 
changes?
I would then ask you to test and finalise it.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=454391&aid=1194591&group_id=48863


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe