JideTabbedPane - Mouse Listener

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

JideTabbedPane - Mouse Listener

Postby vgrossi » Thu Nov 01, 2007 12:21 pm

It seems we need to add the MouseListener on the getTabPanel() of the JideTabbedPaneUI, not just the JideTabbedPane itself.

Code: Select all
     if (tabPane instanceof JideTabbedPane)
         ((JideTabbedPaneUI) ((JideTabbedPane) tabPane).getUI()).getTabPanel().addMouseListener(mouseListener);


Would that be possible to make the JideTabbedPane add/remove the listener on the getTabPanel() of the JideTabbedPaneUI?

May be there is another way of doing this?
vgrossi
 
Posts: 13
Joined: Thu Nov 01, 2007 11:56 am

Postby JIDE Support » Thu Nov 01, 2007 12:27 pm

No, we can't do that. We don't know where to add the mouse listener as user sometimes wants to add to JideTabbedPane, not TabPanel. JTabbedPane requires the same thing if you set the tab layout to scroll layout.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby vgrossi » Fri Nov 02, 2007 4:15 am

I've tried with JTabbedPane tab layout policy JTabbedPane.SCROLL_TAB_LAYOUT. It works fine, the mouse listener is successfully called and I can therefore see my Context Menu.

After further investigation, it turns out it does not work with the JideTabbedPane because of a work around created for handling the following issue: http://developer.java.sun.com/developer ... 68865.html

This workaround sets a MouseListener on the ScrollableTabPanel defined in the ScrollableTabSupport of the BasicJideTabbedPaneUI.

This ScrollableTabPanel having a mouse listener, it therefore is the target of any MouseEvent (see java.awt.Container#getMouseEventTarget). It works fine for the JTabbedPane because the ScrollableTabPanel defined in the ScrollableTabSupport of the BasicTabbedPaneUI do not have any MouseListener, MouseMotionListener or MouseWheelListener defined.


This was once a bug in JtabbedPane too. check http://bugs.sun.com/bugdatabase/view_bu ... id=4765244

The solution is to make sure no MouseListener are defined on the ScrollableTabPane.
vgrossi
 
Posts: 13
Joined: Thu Nov 01, 2007 11:56 am

Postby JIDE Support » Fri Nov 02, 2007 7:28 am

Thanks for the pointer. We added mouse listener to tabPanel for focus and tab editing. Not sure if we can remove it and use some other way. But it worths taking a look.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 5 guests

cron