XJTabbedPane.java |
1 /* XJTabbedPane.java 2 * 3 * Copyright (c) 1998-2005, The University of Sheffield. 4 * 5 * This file is part of GATE (see http://gate.ac.uk/), and is free 6 * software, licenced under the GNU Library General Public License, 7 * Version 2, June 1991 (in the distribution as file licence.html, 8 * and also available at http://gate.ac.uk/gate/licence.html). 9 * 10 * Valentin Tablan 04/04/2001 11 * 12 * $Id: XJTabbedPane.java,v 1.6 2005/01/11 13:51:37 ian Exp $ 13 * 14 */ 15 16 package gate.swing; 17 18 import java.awt.Point; 19 20 import javax.swing.JTabbedPane; 21 22 /** 23 * An extended version of {@link javax.swing.JTabbedPane}. 24 */ 25 public class XJTabbedPane extends JTabbedPane { 26 27 public XJTabbedPane(int tabPlacement){ 28 super(tabPlacement); 29 } 30 31 /** 32 * Gets the tab index for a given location 33 */ 34 public int getIndexAt(Point p){ 35 for(int i = 0; i < getTabCount(); i++){ 36 if(getBoundsAt(i).contains(p)) return i; 37 } 38 return -1; 39 }// int getIndexAt(Point p) 40 }// class XJTabbedPane extends JTabbedPane