1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45:
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52:
53:
56: public class MetalTabbedPaneUI extends BasicTabbedPaneUI
57: {
58:
59:
68: public class TabbedPaneLayout
69: extends BasicTabbedPaneUI.TabbedPaneLayout
70: {
71:
74: public TabbedPaneLayout()
75: {
76:
77: }
78:
79:
87: protected void rotateTabRuns(int tabPlacement, int selectedRun)
88: {
89:
90: }
91:
92:
100: protected void padSelectedTab(int tabPlacement, int selectedIndex)
101: {
102:
103:
104: }
105:
106:
110: protected void normalizeTabRuns(int tabPlacement, int tabCount, int start,
111: int max)
112: {
113: if (tabPlacement == TOP || tabPlacement == BOTTOM)
114: super.normalizeTabRuns(tabPlacement, tabCount, start, max);
115: }
116: }
117:
118:
121: protected int minTabWidth;
122:
123:
126: protected Color selectColor;
127:
128:
131: protected Color selectHighlight;
132:
133:
136: protected Color tabAreaBackground;
137:
138:
139: private Graphics hg;
140:
141:
144: private boolean tabsOpaque;
145:
146:
149: public MetalTabbedPaneUI()
150: {
151: super();
152: }
153:
154:
161: public static ComponentUI createUI(JComponent component)
162: {
163: return new MetalTabbedPaneUI();
164: }
165:
166:
171: protected LayoutManager createLayoutManager()
172: {
173: return new TabbedPaneLayout();
174: }
175:
176:
189: protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex,
190: int x, int y, int w, int h, boolean isSelected)
191: {
192: int bottom = y + h - 1;
193: int right = x + w - 1;
194:
195: switch (tabPlacement)
196: {
197: case LEFT:
198: paintLeftTabBorder(tabIndex, g, x, y, w, h, bottom, right, isSelected);
199: break;
200: case BOTTOM:
201: paintBottomTabBorder(tabIndex, g, x, y, w, h, bottom, right, isSelected);
202: break;
203: case RIGHT:
204: paintRightTabBorder(tabIndex, g, x, y, w, h, bottom, right, isSelected);
205: break;
206: case TOP:
207: default:
208: paintTopTabBorder(tabIndex, g, x, y, w, h, bottom, right, isSelected);
209: }
210: }
211:
212:
226: protected void paintTopTabBorder(int tabIndex, Graphics g, int x, int y,
227: int w, int h, int btm, int rght, boolean isSelected)
228: {
229: int tabCount = tabPane.getTabCount();
230: int currentRun = getRunForTab(tabCount, tabIndex);
231: int right = w - 1;
232: int bottom = h - 1;
233:
234:
235: if (shouldFillGap(currentRun, tabIndex, x, y))
236: {
237: g.translate(x, y);
238: g.setColor(getColorForGap(currentRun, x, y + 1));
239: g.fillRect(1, 0, 5, 3);
240: g.fillRect(1, 3, 2, 2);
241: g.translate(-x, -y);
242: }
243:
244: g.translate(x, y);
245:
246: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
247: Color oceanSelectedBorder =
248: UIManager.getColor("TabbedPane.borderHightlightColor");
249: if (isOcean && isSelected)
250: g.setColor(oceanSelectedBorder);
251: else
252: g.setColor(darkShadow);
253:
254:
255: g.drawLine(1, 5, 6, 0);
256:
257: g.drawLine(6, 0, right, 0);
258:
259: int lastIndex = lastTabInRun(tabCount, currentRun);
260: if (tabIndex == lastIndex)
261: g.drawLine(right, 1, right, bottom);
262:
263: int selectedIndex = tabPane.getSelectedIndex();
264: if (isOcean && tabIndex - 1 == selectedIndex
265: && currentRun == getRunForTab(tabCount, selectedIndex))
266: {
267: g.setColor(oceanSelectedBorder);
268: }
269: if (tabIndex != tabRuns[runCount - 1])
270: {
271: if (isOcean && isSelected)
272: {
273: g.drawLine(0, 6, 0, bottom);
274: g.setColor(darkShadow);
275: g.drawLine(0, 0, 0, 5);
276: }
277: else
278: {
279: g.drawLine(0, 0, 0, bottom);
280: }
281: }
282: else
283: {
284: g.drawLine(0, 6, 0, bottom);
285: }
286:
287:
288: g.setColor(isSelected ? selectHighlight : highlight);
289:
290: g.drawLine(1, 6, 6, 1);
291:
292: g.drawLine(6, 1, right, 1);
293:
294: g.drawLine(1, 6, 1, bottom);
295: int firstIndex = tabRuns[currentRun];
296: if (tabIndex == firstIndex && tabIndex != tabRuns[runCount - 1])
297: {
298: if (tabPane.getSelectedIndex() == tabRuns[currentRun + 1])
299: g.setColor(selectHighlight);
300: else
301: g.setColor(highlight);
302: g.drawLine(1, 0, 1, 4);
303: }
304:
305: g.translate(-x, -y);
306: }
307:
308:
322: protected void paintLeftTabBorder(int tabIndex, Graphics g, int x, int y,
323: int w, int h, int btm, int rght, boolean isSelected)
324: {
325: g.translate(x, y);
326: int bottom = h - 1;
327: int right = w - 1;
328:
329:
330: int tabCount = tabPane.getTabCount();
331: int currentRun = getRunForTab(tabCount, tabIndex);
332: int firstIndex = tabRuns[currentRun];
333:
334:
335: if (tabIndex != firstIndex && tabIndex > 0 && tabsOpaque)
336: {
337: Color c;
338: if (tabPane.getSelectedIndex() == tabIndex - 1)
339: c = selectColor;
340: else
341: c = getUnselectedBackground(tabIndex - 1);
342: g.setColor(c);
343: g.fillRect(2, 0, 4, 3);
344: g.drawLine(2, 3, 2, 3);
345: }
346:
347:
348: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
349: if (isOcean)
350: {
351: g.setColor(isSelected ? selectHighlight : MetalLookAndFeel.getWhite());
352: }
353: else
354: {
355: g.setColor(isSelected ? selectHighlight : highlight);
356: }
357:
358: g.drawLine(1, 6, 6, 1);
359:
360: g.drawLine(1, 6, 1, bottom);
361:
362: g.drawLine(6, 1, right, 1);
363: if (tabIndex != firstIndex)
364: {
365: if (isOcean)
366: {
367: g.setColor(MetalLookAndFeel.getWhite());
368: }
369: g.drawLine(1, 0, 1, 4);
370: }
371:
372:
373: Color oceanSelectedBorder =
374: UIManager.getColor("TabbedPane.borderHightlightColor");
375: if (isOcean && isSelected)
376: {
377: g.setColor(oceanSelectedBorder);
378: }
379: else
380: {
381: g.setColor(darkShadow);
382: }
383:
384:
385: g.drawLine(1, 5, 6, 0);
386:
387: g.drawLine(6, 0, right, 0);
388:
389: int lastIndex = lastTabInRun(tabCount, currentRun);
390: if (tabIndex == lastIndex)
391: {
392: g.drawLine(0, bottom, right, bottom);
393: }
394:
395: if (isOcean)
396: {
397: if (tabPane.getSelectedIndex() == tabIndex - 1)
398: {
399: g.drawLine(0, 5, 0, bottom);
400: g.setColor(oceanSelectedBorder);
401: g.drawLine(0, 0, 0, 5);
402: }
403: else if (isSelected)
404: {
405: g.drawLine(0, 5, 0, bottom);
406: if (tabIndex != 0)
407: {
408: g.setColor(darkShadow);
409: g.drawLine(0, 0, 0, 5);
410: }
411: }
412: else if (tabIndex != firstIndex)
413: {
414: g.drawLine(0, 0, 0, bottom);
415: }
416: else
417: {
418: g.drawLine(0, 6, 0, bottom);
419: }
420: }
421: else
422: {
423: if (tabIndex != firstIndex)
424: {
425: g.drawLine(0, 0, 0, bottom);
426: }
427: else
428: {
429: g.drawLine(0, 6, 0, bottom);
430: }
431: }
432:
433: g.translate(-x, -y);
434: }
435:
436:
450: protected void paintRightTabBorder(int tabIndex, Graphics g, int x, int y,
451: int w, int h, int btm, int rght, boolean isSelected)
452: {
453: g.translate(x, y);
454: int bottom = h - 1;
455: int right = w - 1;
456:
457: int tabCount = tabPane.getTabCount();
458: int currentRun = getRunForTab(tabCount, tabIndex);
459: int firstIndex = tabRuns[currentRun];
460:
461:
462: if (tabIndex != firstIndex && tabIndex > 0 && tabsOpaque)
463: {
464: Color c;
465: if (tabPane.getSelectedIndex() == tabIndex - 1)
466: c = UIManager.getColor("TabbedPane.tabAreaBackground");
467: else
468: c = getUnselectedBackground(tabIndex - 1);
469: g.fillRect(right - 5, 0, 5, 3);
470: g.fillRect(right - 2, 3, 2, 2);
471: }
472:
473:
474: g.setColor(isSelected ? selectHighlight : highlight);
475:
476:
477: g.drawLine(right - 6, 1, right - 1, 6);
478:
479: g.drawLine(0, 1, right - 6, 1);
480:
481: if (! isSelected)
482: {
483: g.drawLine(0, 1, 0, bottom);
484: }
485:
486:
487: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
488: Color oceanSelectedBorder =
489: UIManager.getColor("TabbedPane.borderHightlightColor");
490: if (isOcean && isSelected)
491: {
492: g.setColor(oceanSelectedBorder);
493: }
494: else
495: {
496: g.setColor(darkShadow);
497: }
498:
499:
500: int lastIndex = lastTabInRun(tabCount, currentRun);
501: if (tabIndex == lastIndex)
502: {
503: g.drawLine(0, bottom, right, bottom);
504: }
505:
506: if (isOcean && tabPane.getSelectedIndex() == tabIndex - 1)
507: {
508: g.setColor(oceanSelectedBorder);
509: }
510: g.drawLine(right - 6, 0, right, 6);
511:
512: g.drawLine(0, 0, right - 6, 0);
513:
514: if (isOcean && isSelected)
515: {
516: g.drawLine(right, 6, right, bottom);
517: if (tabIndex != firstIndex)
518: {
519: g.setColor(darkShadow);
520: g.drawLine(right, 0, right, 5);
521: }
522: }
523: else if (isOcean && tabPane.getSelectedIndex() == tabIndex - 1)
524: {
525: g.setColor(oceanSelectedBorder);
526: g.drawLine(right, 0, right, 6);
527: g.setColor(darkShadow);
528: g.drawLine(right, 6, right, bottom);
529: }
530: else if (tabIndex != firstIndex)
531: {
532: g.drawLine(right, 0, right, bottom);
533: }
534: else
535: {
536: g.drawLine(right, 6, right, bottom);
537: }
538: g.translate(-x, -y);
539: }
540:
541:
555: protected void paintBottomTabBorder(int tabIndex, Graphics g, int x, int y,
556: int w, int h, int btm, int rght, boolean isSelected)
557: {
558: int bottom = h - 1;
559: int right = w - 1;
560:
561: int tabCount = tabPane.getTabCount();
562: int currentRun = getRunForTab(tabCount, tabIndex);
563:
564: if (shouldFillGap(currentRun, tabIndex, x, y))
565: {
566: g.translate(x, y);
567: g.setColor(getColorForGap(currentRun, x, y));
568: g.fillRect(1, bottom - 4, 3, 5);
569: g.fillRect(4, bottom - 1, 2, 2);
570: g.translate(-x, -y);
571: }
572:
573: g.translate(x, y);
574:
575:
576: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
577: Color oceanSelectedBorder =
578: UIManager.getColor("TabbedPane.borderHightlightColor");
579: if (isOcean && isSelected)
580: {
581: g.setColor(oceanSelectedBorder);
582: }
583: else
584: {
585: g.setColor(darkShadow);
586: }
587:
588: g.drawLine(1, bottom - 5, 6, bottom);
589:
590: g.drawLine(6, bottom, right, bottom);
591:
592: int lastIndex = lastTabInRun(tabCount, currentRun);
593: if (tabIndex == lastIndex)
594: {
595: g.drawLine(right, 0, right, bottom);
596: }
597:
598: if (isOcean && isSelected)
599: {
600: g.drawLine(0, 0, 0, bottom - 5);
601: if ((currentRun == 0 && tabIndex != 0)
602: || (currentRun > 0 && tabIndex != tabRuns[currentRun - 1]))
603: {
604: g.setColor(darkShadow);
605: g.drawLine(0, bottom - 5, 0, bottom);
606: }
607: }
608: else
609: {
610: if (isOcean && tabIndex == tabPane.getSelectedIndex()+ 1)
611: {
612: g.setColor(oceanSelectedBorder);
613: }
614: if (tabIndex != tabRuns[runCount- 1])
615: {
616: g.drawLine(0, 0, 0, bottom);
617: }
618: else
619: {
620: g.drawLine(0, 0, 0, bottom - 6);
621: }
622: }
623:
624:
625: g.setColor(isSelected ? selectHighlight : highlight);
626:
627: g.drawLine(1, bottom - 6, 6, bottom - 1);
628:
629: g.drawLine(1, 0, 1, bottom - 6);
630:
631: int firstIndex = tabRuns[currentRun];
632: if (tabIndex == firstIndex && tabIndex != tabRuns[runCount - 1])
633: {
634: if (tabPane.getSelectedIndex() == tabRuns[currentRun + 1])
635: {
636: g.setColor(selectHighlight);
637: }
638: else
639: {
640: g.setColor(highlight);
641: }
642: g.drawLine(1, bottom - 4, 1, bottom);
643: }
644:
645: g.translate(-x, -y);
646: }
647:
648:
661: protected void paintTabBackground(Graphics g, int tabPlacement,
662: int tabIndex, int x, int y, int w, int h, boolean isSelected)
663: {
664: if (isSelected)
665: g.setColor(selectColor);
666: else
667: g.setColor(getUnselectedBackground(tabIndex));
668:
669: switch (tabPlacement)
670: {
671: case LEFT:
672: g.fillRect(x + 5, y + 1, w - 5, h - 1);
673: g.fillRect(x + 2, y + 4, 3, h - 4);
674: break;
675: case BOTTOM:
676: g.fillRect(x + 2, y, w - 2, h - 3);
677: g.fillRect(x + 5, y + h - 4, w - 5, 3);
678: break;
679: case RIGHT:
680: g.fillRect(x, y + 1, w - 4, h - 1);
681: g.fillRect(x + w - 4, y + 5, 3, h - 5);
682: break;
683: case TOP:
684: default:
685: g.fillRect(x + 4, y + 2, w - 4, h - 2);
686: g.fillRect(x + 2, y + 5, 2, h - 5);
687: }
688: }
689:
690:
700: protected boolean shouldPadTabRun(int tabPlacement, int run)
701: {
702:
703:
704: return run < this.runCount - 1;
705: }
706:
707:
711: protected void installDefaults()
712: {
713: super.installDefaults();
714: selectColor = UIManager.getColor("TabbedPane.selected");
715: selectHighlight = UIManager.getColor("TabbedPane.selectHighlight");
716: tabAreaBackground = UIManager.getColor("TabbedPane.tabAreaBackground");
717: tabsOpaque = UIManager.getBoolean("TabbedPane.tabsOpaque");
718: minTabWidth = 0;
719: }
720:
721:
730: protected Color getColorForGap(int currentRun, int x, int y)
731: {
732: int index = tabForCoordinate(tabPane, x, y);
733: int selected = tabPane.getSelectedIndex();
734: if (selected == index)
735: return selectColor;
736: return tabAreaBackground;
737: }
738:
739:
749: protected boolean shouldFillGap(int currentRun, int tabIndex, int x, int y)
750: {
751:
752: return false;
753: }
754:
755:
758: protected void paintHighlightBelowTab()
759: {
760: int selected = tabPane.getSelectedIndex();
761: int tabPlacement = tabPane.getTabPlacement();
762: Rectangle bounds = getTabBounds(tabPane, selected);
763:
764: hg.setColor(selectColor);
765: int x = bounds.x;
766: int y = bounds.y;
767: int w = bounds.width;
768: int h = bounds.height;
769:
770: if (tabPlacement == TOP)
771: hg.fillRect(x, y + h - 2, w, 30);
772: else if (tabPlacement == LEFT)
773: hg.fillRect(x + w - 1, y, 20, h);
774: else if (tabPlacement == BOTTOM)
775: hg.fillRect(x, y - h + 2, w, 30);
776: else if (tabPlacement == RIGHT)
777: hg.fillRect(x - 18, y, 20, h);
778: else
779: throw new AssertionError("Unrecognised 'tabPlacement' argument.");
780: hg = null;
781: }
782:
783:
791: protected boolean shouldRotateTabRuns(int tabPlacement,
792: int selectedRun)
793: {
794:
795: return false;
796: }
797:
798: protected int calculateMaxTabHeight(int tabPlacement)
799: {
800:
801: return super.calculateMaxTabHeight(tabPlacement);
802: }
803:
804:
814: protected int getTabRunOverlay(int tabPlacement)
815: {
816: int overlay = 0;
817: if (tabPlacement == LEFT || tabPlacement == RIGHT)
818: {
819: int maxHeight = calculateMaxTabHeight(tabPlacement);
820: overlay = maxTabHeight / 2;
821: }
822: return overlay;
823: }
824:
825:
836: protected void paintContentBorderTopEdge(Graphics g, int tabPlacement,
837: int selectedIndex, int x, int y,
838: int w, int h)
839: {
840: Color oceanSelectedBorder =
841: UIManager.getColor("TabbedPane.borderHightlightColor");
842: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
843: if (isOcean)
844: {
845: g.setColor(oceanSelectedBorder);
846: }
847: else
848: {
849: g.setColor(selectHighlight);
850: }
851:
852: Rectangle rect = selectedIndex < 0 ? null :
853: getTabBounds(selectedIndex, calcRect);
854:
855:
856:
857:
858: if (tabPlacement != TOP || selectedIndex < 0
859: || rect.y + rect.height + 1 < y || rect.x < x ||rect.x > x + w)
860: {
861: g.drawLine(x, y, x + w - 2, y);
862: if (isOcean && tabPlacement == TOP)
863: {
864: g.setColor(MetalLookAndFeel.getWhite());
865: g.drawLine(x, y + 1, x + w - 2, y + 1);
866: }
867: }
868: else
869: {
870: boolean isLast = isLastTabInRun(selectedIndex);
871: if (isLast)
872: {
873: g.drawLine(x, y, rect.x + 1, y);
874: }
875: else
876: {
877: g.drawLine(x, y, rect.x, y);
878: }
879:
880: int right = x + w - 1;
881: if (rect.x + rect.width < right - 1)
882: {
883: if (isLast)
884: {
885: g.drawLine(rect.x + rect.width - 1, y, right - 1, y);
886: }
887: else
888: {
889: g.drawLine(rect.x + rect.width, y, right - 1, y);
890: }
891: }
892: else
893: {
894: g.setColor(shadow);
895: g.drawLine(x + w - 2, y, x + w - 2, y);
896: }
897:
898:
899: if (isOcean)
900: {
901: g.setColor(MetalLookAndFeel.getWhite());
902: if (isLast)
903: {
904: g.drawLine(x, y + 1, rect.x + 1, y + 1);
905: }
906: else
907: {
908: g.drawLine(x, y + 1, rect.x, y + 1);
909: }
910:
911: if (rect.x + rect.width < right - 1)
912: {
913: if (isLast)
914: {
915: g.drawLine(rect.x + rect.width - 1, y + 1, right - 1,
916: y + 1);
917: }
918: else
919: {
920: g.drawLine(rect.x + rect.width, y + 1, right - 1, y + 1);
921: }
922: }
923: else
924: {
925: g.setColor(shadow);
926: g.drawLine(x + w - 2, y + 1, x + w - 2, y + 1);
927: }
928: }
929: }
930: }
931:
932:
943: protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement,
944: int selectedIndex, int x, int y,
945: int w, int h)
946: {
947: g.setColor(darkShadow);
948:
949:
950:
951:
952: Rectangle rect = selectedIndex < 0 ? null :
953: getTabBounds(selectedIndex, calcRect);
954: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
955: Color oceanSelectedBorder =
956: UIManager.getColor("TabbedPane.borderHightlightColor");
957: if (tabPlacement != BOTTOM || selectedIndex < 0 || rect.y - 1 > h
958: || rect.x < x || rect.x > x + w)
959: {
960: if (isOcean && tabPlacement == BOTTOM)
961: {
962: g.setColor(oceanSelectedBorder);
963: }
964: g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
965: }
966: else
967: {
968: boolean isLast = isLastTabInRun(selectedIndex);
969: if (isOcean)
970: {
971: g.setColor(oceanSelectedBorder);
972: }
973:
974: int bottom = y + h - 1;
975: int right = x + w - 1;
976: if (isLast)
977: {
978: g.drawLine(x, bottom, rect.x, bottom);
979: }
980: else
981: {
982: g.drawLine(x, bottom, rect.x - 1, bottom);
983: }
984:
985: if (rect.x + rect.width < x + w - 2)
986: {
987: if (isLast)
988: {
989: g.drawLine(rect.x + rect.width - 1, bottom, right, bottom);
990: }
991: else
992: {
993: g.drawLine(rect.x + rect.width, bottom, right, bottom);
994: }
995: }
996: }
997: }
998:
999:
1010: protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement,
1011: int selectedIndex, int x, int y,
1012: int w, int h)
1013: {
1014: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
1015: Color oceanSelectedBorder =
1016: UIManager.getColor("TabbedPane.borderHightlightColor");
1017: Rectangle rect = selectedIndex < 0 ? null :
1018: getTabBounds(selectedIndex, calcRect);
1019:
1020: if (isOcean)
1021: {
1022: g.setColor(oceanSelectedBorder);
1023: }
1024: else
1025: {
1026: g.setColor(selectHighlight);
1027: }
1028:
1029:
1030:
1031:
1032: if (tabPlacement != LEFT || selectedIndex < 0
1033: || rect.x + rect.width + 1 < x || rect.y < y || rect.y > y + h)
1034: {
1035: g.drawLine(x, y + 1, x, y + h - 2);
1036: if (isOcean && tabPlacement == LEFT)
1037: {
1038: g.setColor(MetalLookAndFeel.getWhite());
1039: g.drawLine(x, y + 1, x, y + h - 2);
1040: }
1041: }
1042: else
1043: {
1044: g.drawLine(x, y, x, rect.y + 1);
1045: if (rect.y + rect.height < y + h - 2)
1046: {
1047: g.drawLine(x, rect.y + rect.height + 1, x, y + h + 2);
1048: }
1049: if (isOcean)
1050: {
1051: g.setColor(MetalLookAndFeel.getWhite());
1052: g.drawLine(x + 1, y + 1, x + 1, rect.y + 1);
1053: if (rect.y + rect.height < y + h - 2)
1054: {
1055: g.drawLine(x + y, rect.y + rect.height + 1, x + 1, y + h + 2);
1056: }
1057: }
1058: }
1059:
1060: }
1061:
1062:
1073: protected void paintContentBorderRightEdge(Graphics g, int tabPlacement,
1074: int selectedIndex, int x, int y,
1075: int w, int h)
1076: {
1077: g.setColor(darkShadow);
1078: Rectangle rect = selectedIndex < 0 ? null :
1079: getTabBounds(selectedIndex, calcRect);
1080: boolean isOcean = MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme;
1081: Color oceanSelectedBorder =
1082: UIManager.getColor("TabbedPane.borderHightlightColor");
1083:
1084:
1085:
1086:
1087: if (tabPlacement != RIGHT || selectedIndex < 0 || rect.x - 1 > w
1088: || rect.y < y || rect.y > y + h)
1089: {
1090: if (isOcean && tabPlacement == RIGHT)
1091: {
1092: g.setColor(oceanSelectedBorder);
1093: }
1094: g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
1095: }
1096: else
1097: {
1098: if (isOcean)
1099: {
1100: g.setColor(oceanSelectedBorder);
1101: }
1102: g.drawLine(x + w - 1, y, x + w - 1, rect.y);
1103:
1104: if (rect.y + rect.height < y + h - 2)
1105: {
1106: g.drawLine(x + w - 1, rect.y + rect.height, x + w - 1, y + h - 2);
1107: }
1108: }
1109: }
1110:
1111:
1118: private boolean isLastTabInRun(int tabIndex)
1119: {
1120: int count = tabPane.getTabCount();
1121: int run = getRunForTab(count, tabIndex);
1122: int lastIndex = lastTabInRun(count, run);
1123: return tabIndex == lastIndex;
1124: }
1125:
1126:
1138: private Color getUnselectedBackground(int tabIndex)
1139: {
1140: Color bg = tabPane.getBackgroundAt(tabIndex);
1141: Color unselectedBackground =
1142: UIManager.getColor("TabbedPane.unselectedBackground");
1143: if (bg instanceof UIResource && unselectedBackground != null)
1144: bg = unselectedBackground;
1145: return bg;
1146: }
1147: }