64 |
import javax.swing.JTabbedPane; |
import javax.swing.JTabbedPane; |
65 |
import javax.swing.JViewport; |
import javax.swing.JViewport; |
66 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
67 |
|
import javax.swing.LookAndFeel; |
68 |
import javax.swing.SwingConstants; |
import javax.swing.SwingConstants; |
69 |
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
|
import javax.swing.UIDefaults; |
|
70 |
import javax.swing.UIManager; |
import javax.swing.UIManager; |
71 |
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
72 |
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
354 |
for (int i = 0; i < tabCount; i++) |
for (int i = 0; i < tabCount; i++) |
355 |
{ |
{ |
356 |
width = calculateTabWidth(tabPlacement, i, fm); |
width = calculateTabWidth(tabPlacement, i, fm); |
|
|
|
357 |
if (runWidth + width > max) |
if (runWidth + width > max) |
358 |
{ |
{ |
359 |
runWidth = tabAreaInsets.left + insets.left |
runWidth = tabAreaInsets.left + insets.left |
1181 |
*/ |
*/ |
1182 |
private class ScrollingViewport extends JViewport implements UIResource |
private class ScrollingViewport extends JViewport implements UIResource |
1183 |
{ |
{ |
1184 |
|
// TODO: Maybe remove this inner class. |
1185 |
} |
} |
1186 |
|
|
1187 |
/** |
/** |
1536 |
*/ |
*/ |
1537 |
protected void installDefaults() |
protected void installDefaults() |
1538 |
{ |
{ |
1539 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
LookAndFeel.installColorsAndFont(tabPane, "TabbedPane.background", |
1540 |
|
"TabbedPane.foreground", |
1541 |
tabPane.setFont(defaults.getFont("TabbedPane.font")); |
"TabbedPane.font"); |
|
tabPane.setForeground(defaults.getColor("TabbedPane.foreground")); |
|
|
tabPane.setBackground(defaults.getColor("TabbedPane.background")); |
|
1542 |
tabPane.setOpaque(false); |
tabPane.setOpaque(false); |
1543 |
|
|
1544 |
highlight = defaults.getColor("TabbedPane.highlight"); |
highlight = UIManager.getColor("TabbedPane.highlight"); |
1545 |
lightHighlight = defaults.getColor("TabbedPane.lightHighlight"); |
lightHighlight = UIManager.getColor("TabbedPane.lightHighlight"); |
1546 |
|
|
1547 |
shadow = defaults.getColor("TabbedPane.shadow"); |
shadow = UIManager.getColor("TabbedPane.shadow"); |
1548 |
darkShadow = defaults.getColor("TabbedPane.darkShadow"); |
darkShadow = UIManager.getColor("TabbedPane.darkShadow"); |
1549 |
|
|
1550 |
focus = defaults.getColor("TabbedPane.focus"); |
focus = UIManager.getColor("TabbedPane.focus"); |
1551 |
|
|
1552 |
textIconGap = defaults.getInt("TabbedPane.textIconGap"); |
textIconGap = UIManager.getInt("TabbedPane.textIconGap"); |
1553 |
tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay"); |
tabRunOverlay = UIManager.getInt("TabbedPane.tabRunOverlay"); |
1554 |
|
|
1555 |
tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets"); |
tabInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabInsets"); |
1556 |
selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets"); |
selectedTabPadInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabPadInsets"); |
1557 |
tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); |
tabAreaInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabAreaInsets"); |
1558 |
contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); |
contentBorderInsets = UIManager.getInsets("TabbedPane.tabbedPaneContentBorderInsets"); |
1559 |
|
|
1560 |
calcRect = new Rectangle(); |
calcRect = new Rectangle(); |
1561 |
tabRuns = new int[10]; |
tabRuns = new int[10]; |
1735 |
// we WANT to paint the outermost run first and then work our way in. |
// we WANT to paint the outermost run first and then work our way in. |
1736 |
int tabCount = tabPane.getTabCount(); |
int tabCount = tabPane.getTabCount(); |
1737 |
int currRun = 1; |
int currRun = 1; |
1738 |
|
|
1739 |
|
if (tabCount > runCount) |
1740 |
|
runCount = tabCount; |
1741 |
|
|
1742 |
if (tabCount < 1) |
if (tabCount < 1) |
1743 |
return; |
return; |
1744 |
|
|
1745 |
if (runCount > 1) |
if (runCount > 1) |
1746 |
currRun = 0; |
currRun = 0; |
1747 |
for (int i = 0; i < runCount; i++) |
for (int i = 0; i < runCount; i++) |
1748 |
{ |
{ |
1749 |
int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1; |
int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1; |
1858 |
SwingConstants.CENTER, |
SwingConstants.CENTER, |
1859 |
SwingConstants.CENTER, |
SwingConstants.CENTER, |
1860 |
SwingConstants.CENTER, |
SwingConstants.CENTER, |
1861 |
SwingConstants.CENTER, tabRect, |
SwingConstants.RIGHT, tabRect, |
1862 |
iconRect, textRect, textIconGap); |
iconRect, textRect, textIconGap); |
1863 |
|
|
1864 |
int shiftX = getTabLabelShiftX(tabPlacement, tabIndex, isSelected); |
int shiftX = getTabLabelShiftX(tabPlacement, tabIndex, isSelected); |