United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4241787 : JTabbedPane: getTabForLocation(x,y)

Details
Type:
Enhancement
Submit Date:
1999-05-27
Status:
Resolved
Updated Date:
2000-03-09
Project Name:
JDK
Resolved Date:
2000-03-09
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.2.1
Fixed Versions:
1.4.0 (beta)

Related Reports

Sub Tasks

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



Hardware and Software, Engineered to Work Together