115 * the key bindings specification for further details. 116 * 117 * @deprecated As of Java 2 platform v1.3. 118 */ 119 @Deprecated 120 protected KeyStroke leftKey; 121 /** 122 * As of Java 2 platform v1.3 this previously undocumented field is no 123 * longer used. 124 * Key bindings are now defined by the LookAndFeel, please refer to 125 * the key bindings specification for further details. 126 * 127 * @deprecated As of Java 2 platform v1.3. 128 */ 129 @Deprecated 130 protected KeyStroke rightKey; 131 132 133 // Transient variables (recalculated each time TabbedPane is layed out) 134 /** Tab runs */ 135 protected int tabRuns[] = new int[10]; 136 /** Run count */ 137 protected int runCount = 0; 138 /** Selected run */ 139 protected int selectedRun = -1; 140 /** Tab rects */ 141 protected Rectangle rects[] = new Rectangle[0]; 142 /** Maximum tab height */ 143 protected int maxTabHeight; 144 /** Maximum tab width */ 145 protected int maxTabWidth; 146 147 // Listeners 148 149 /** Tab change listener */ 150 protected ChangeListener tabChangeListener; 151 /** Property change listener */ 152 protected PropertyChangeListener propertyChangeListener; 153 /** Mouse change listener */ 154 protected MouseListener mouseListener; 155 /** Focus change listener */ 156 protected FocusListener focusListener; 157 158 // Private instance data 159 160 private Insets currentPadInsets = new Insets(0,0,0,0); 161 private Insets currentTabAreaInsets = new Insets(0,0,0,0); 969 * e.g. A "File" tab which has cropped been cropped just after the "i": 970 * ------------- 971 * | ..... | 972 * | . | 973 * | ... . | 974 * | . . | 975 * | . . | 976 * | . . | 977 * -------------- 978 * 979 * The x, y arrays below define the pattern used to create a "torn" edge 980 * segment which is repeated to fill the edge of the tab. 981 * For tabs placed on TOP and BOTTOM, this righthand torn edge is created by 982 * line segments which are defined by coordinates obtained by 983 * subtracting xCropLen[i] from (tab.x + tab.width) and adding yCroplen[i] 984 * to (tab.y). 985 * For tabs placed on LEFT or RIGHT, the bottom torn edge is created by 986 * subtracting xCropLen[i] from (tab.y + tab.height) and adding yCropLen[i] 987 * to (tab.x). 988 */ 989 private static int xCropLen[] = {1,1,0,0,1,1,2,2}; 990 private static int yCropLen[] = {0,3,3,6,6,9,9,12}; 991 private static final int CROP_SEGMENT = 12; 992 993 private static Polygon createCroppedTabShape(int tabPlacement, Rectangle tabRect, int cropline) { 994 int rlen; 995 int start; 996 int end; 997 int ostart; 998 999 switch(tabPlacement) { 1000 case LEFT: 1001 case RIGHT: 1002 rlen = tabRect.width; 1003 start = tabRect.x; 1004 end = tabRect.x + tabRect.width; 1005 ostart = tabRect.y + tabRect.height; 1006 break; 1007 case TOP: 1008 case BOTTOM: 1009 default: 1010 rlen = tabRect.height; 1011 start = tabRect.y; 1012 end = tabRect.y + tabRect.height; 1013 ostart = tabRect.x + tabRect.width; 1014 } 1015 int rcnt = rlen/CROP_SEGMENT; 1016 if (rlen%CROP_SEGMENT > 0) { 1017 rcnt++; 1018 } 1019 int npts = 2 + (rcnt*8); 1020 int xp[] = new int[npts]; 1021 int yp[] = new int[npts]; 1022 int pcnt = 0; 1023 1024 xp[pcnt] = ostart; 1025 yp[pcnt++] = end; 1026 xp[pcnt] = ostart; 1027 yp[pcnt++] = start; 1028 for(int i = 0; i < rcnt; i++) { 1029 for(int j = 0; j < xCropLen.length; j++) { 1030 xp[pcnt] = cropline - xCropLen[j]; 1031 yp[pcnt] = start + (i*CROP_SEGMENT) + yCropLen[j]; 1032 if (yp[pcnt] >= end) { 1033 yp[pcnt] = end; 1034 pcnt++; 1035 break; 1036 } 1037 pcnt++; 1038 } 1039 } 1040 if (tabPlacement == JTabbedPane.TOP || tabPlacement == JTabbedPane.BOTTOM) { 1041 return new Polygon(xp, yp, pcnt); | 115 * the key bindings specification for further details. 116 * 117 * @deprecated As of Java 2 platform v1.3. 118 */ 119 @Deprecated 120 protected KeyStroke leftKey; 121 /** 122 * As of Java 2 platform v1.3 this previously undocumented field is no 123 * longer used. 124 * Key bindings are now defined by the LookAndFeel, please refer to 125 * the key bindings specification for further details. 126 * 127 * @deprecated As of Java 2 platform v1.3. 128 */ 129 @Deprecated 130 protected KeyStroke rightKey; 131 132 133 // Transient variables (recalculated each time TabbedPane is layed out) 134 /** Tab runs */ 135 protected int[] tabRuns = new int[10]; 136 /** Run count */ 137 protected int runCount = 0; 138 /** Selected run */ 139 protected int selectedRun = -1; 140 /** Tab rects */ 141 protected Rectangle[] rects = new Rectangle[0]; 142 /** Maximum tab height */ 143 protected int maxTabHeight; 144 /** Maximum tab width */ 145 protected int maxTabWidth; 146 147 // Listeners 148 149 /** Tab change listener */ 150 protected ChangeListener tabChangeListener; 151 /** Property change listener */ 152 protected PropertyChangeListener propertyChangeListener; 153 /** Mouse change listener */ 154 protected MouseListener mouseListener; 155 /** Focus change listener */ 156 protected FocusListener focusListener; 157 158 // Private instance data 159 160 private Insets currentPadInsets = new Insets(0,0,0,0); 161 private Insets currentTabAreaInsets = new Insets(0,0,0,0); 969 * e.g. A "File" tab which has cropped been cropped just after the "i": 970 * ------------- 971 * | ..... | 972 * | . | 973 * | ... . | 974 * | . . | 975 * | . . | 976 * | . . | 977 * -------------- 978 * 979 * The x, y arrays below define the pattern used to create a "torn" edge 980 * segment which is repeated to fill the edge of the tab. 981 * For tabs placed on TOP and BOTTOM, this righthand torn edge is created by 982 * line segments which are defined by coordinates obtained by 983 * subtracting xCropLen[i] from (tab.x + tab.width) and adding yCroplen[i] 984 * to (tab.y). 985 * For tabs placed on LEFT or RIGHT, the bottom torn edge is created by 986 * subtracting xCropLen[i] from (tab.y + tab.height) and adding yCropLen[i] 987 * to (tab.x). 988 */ 989 private static int[] xCropLen = {1,1,0,0,1,1,2,2}; 990 private static int[] yCropLen = {0,3,3,6,6,9,9,12}; 991 private static final int CROP_SEGMENT = 12; 992 993 private static Polygon createCroppedTabShape(int tabPlacement, Rectangle tabRect, int cropline) { 994 int rlen; 995 int start; 996 int end; 997 int ostart; 998 999 switch(tabPlacement) { 1000 case LEFT: 1001 case RIGHT: 1002 rlen = tabRect.width; 1003 start = tabRect.x; 1004 end = tabRect.x + tabRect.width; 1005 ostart = tabRect.y + tabRect.height; 1006 break; 1007 case TOP: 1008 case BOTTOM: 1009 default: 1010 rlen = tabRect.height; 1011 start = tabRect.y; 1012 end = tabRect.y + tabRect.height; 1013 ostart = tabRect.x + tabRect.width; 1014 } 1015 int rcnt = rlen/CROP_SEGMENT; 1016 if (rlen%CROP_SEGMENT > 0) { 1017 rcnt++; 1018 } 1019 int npts = 2 + (rcnt*8); 1020 int[] xp = new int[npts]; 1021 int[] yp = new int[npts]; 1022 int pcnt = 0; 1023 1024 xp[pcnt] = ostart; 1025 yp[pcnt++] = end; 1026 xp[pcnt] = ostart; 1027 yp[pcnt++] = start; 1028 for(int i = 0; i < rcnt; i++) { 1029 for(int j = 0; j < xCropLen.length; j++) { 1030 xp[pcnt] = cropline - xCropLen[j]; 1031 yp[pcnt] = start + (i*CROP_SEGMENT) + yCropLen[j]; 1032 if (yp[pcnt] >= end) { 1033 yp[pcnt] = end; 1034 pcnt++; 1035 break; 1036 } 1037 pcnt++; 1038 } 1039 } 1040 if (tabPlacement == JTabbedPane.TOP || tabPlacement == JTabbedPane.BOTTOM) { 1041 return new Polygon(xp, yp, pcnt); |