JDK-4241787 : JTabbedPane: getTabForLocation(x,y)
  • Type: Enhancement
  • Status: Resolved
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: javax.swing
  • Priority: P4
  • Affected Version: 1.2.1
  • OS: generic
  • CPU: generic
  • Submit Date: 1999-05-27
  • Updated Date: 2000-03-09
  • Resolved Date: 2000-03-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
1.4.0 betaResolved
Description

Name: vi73552			Date: 05/27/99


-1-
The JTabbedPane does not allow to know which tab (and not its
associated pane) is currently pointed by the mouse. So there is
no way to add a "special" mouse handler. 

Ex.: 
- Bring a popup menu when r-click on a tab
- Customize tab content when d-click.

A method like getTabAT(x,y) or equivalent would be appreciated.

-2-

You also fixed the display of the Tab to a Label (which is a nice
default). You could use the same approach you used with trees,
lists and tables where a cell renderer can be set.

ex: setTabRenderer(myOwnRenderer).
(Review ID: 83567) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin merlin-beta FIXED IN: merlin merlin-beta INTEGRATED IN: merlin-beta
2004-06-14

EVALUATION excellent idea. (renderer rfe filed separately: 4318509). amy.fowler@Eng 2000-03-02 Added: /** * Returns the tab index corresponding to the tab whose bounds * intersect the specified location. Returns -1 if no tab * intersects the location. * * @param x the x location relative to this tabbedpane * @param y the y location relative to this tabbedpane * @return the tab index which intersects the location, or * -1 if no tab intersects the location * @since 1.4 */ public int indexAtLocation(int x, int y) { if (ui != null) { return ((TabbedPaneUI)ui).tabForCoordinate(this, x, y); } return -1; } amy.fowler@Eng 2000-03-02
2000-03-02