jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java
changeset 32483 851c672880a6
parent 28231 b608ffcaed74
child 33253 78e735319356
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java	Thu Aug 20 13:46:16 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java	Thu Aug 20 13:00:19 2015 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2304,8 +2304,10 @@
         }
 
         public Rectangle getBounds() {
-            return parent.getUI().getTabBounds(parent,
-                                               parent.indexOfTab(title));
+            int i = parent.indexOfTab(title);
+            // Check for no title. Even though that's a bug in the app we should
+            // inhibit an ArrayIndexOutOfBoundsException from getTabBounds.
+            return (i == -1) ? null : parent.getUI().getTabBounds(parent, i);
         }
 
         public void setBounds(Rectangle r) {