1 19 20 package org.netbeans.core.output; 21 22 import java.awt.Rectangle ; 23 import javax.swing.JTabbedPane ; 24 25 35 36 public class JdkBug4620540Hack 37 { 38 private JdkBug4620540Hack() {} 39 40 44 public static void fixGetBoundsAt(Rectangle b) { 45 if (b.y < 0) 46 b.y = -b.y; 47 if (b.x < 0) 48 b.x = -b.x; 49 } 50 51 60 public static int findTabForCoordinate(JTabbedPane tab, int x, int y) { 61 for (int i = 0; i < tab.getTabCount(); i++) { 62 Rectangle b = tab.getBoundsAt(i); 63 if (b != null) { 64 b = new Rectangle (b); 65 fixGetBoundsAt(b); 66 67 if (b.contains(x, y)) { 68 return i; 69 } 70 } 71 } 72 return -1; 73 } 74 } 75 | Popular Tags |