01: // DnDTabbedPane.java
02: // $Id: DnDTabbedPane.java,v 1.3 1999/03/05 14:43:41 bmahe Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 1999.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigadmin.widgets;
07:
08: import java.awt.Component;
09: import java.awt.Container;
10:
11: import javax.swing.JTabbedPane;
12:
13: /**
14: * A JTabbedPane for dnd (work arround for a bug in swing)
15: * @version $Revision: 1.3 $
16: * @author Benoît Mahé (bmahe@w3.org)
17: */
18: public class DnDTabbedPane extends JTabbedPane {
19:
20: public DnDTabbedPane() {
21: super ();
22: }
23:
24: public Component findComponentAt(int x, int y) {
25: if (!contains(x, y)) {
26: return null;
27: }
28: int ncomponents = getComponentCount();
29: for (int i = 0; i < ncomponents; i++) {
30: Component comp = getComponentAt(i);
31: if (comp != null) {
32: if (comp instanceof Container) {
33: if (comp.isVisible()) {
34: comp = ((Container) comp).findComponentAt(x
35: - comp.getX(), y - comp.getY());
36: }
37: } else {
38: comp = comp.getComponentAt(x - comp.getX(), y
39: - comp.getY());
40: }
41: if (comp != null && comp.isVisible()) {
42: return comp;
43: }
44: }
45: }
46: return this;
47: }
48: }
|