|
|
@ -143,34 +143,44 @@ public class FineTabbedPane extends Box { |
|
|
|
setMatchParentSize(true); |
|
|
|
setMatchParentSize(true); |
|
|
|
float flexRatio = (1 - headRatio) / 2; |
|
|
|
float flexRatio = (1 - headRatio) / 2; |
|
|
|
int headHeight = FlatUIUtils.getUIInt("Component.defaultHeight", 24) * tabLayout.length / 2; |
|
|
|
int headHeight = FlatUIUtils.getUIInt("Component.defaultHeight", 24) * tabLayout.length / 2; |
|
|
|
Component component = useFitTab ? row(flex(), cell(tabGroup), flex()).getComponent() : row(flex(flexRatio), cell(tabGroup).weight(headRatio), flex(flexRatio)).getComponent(); |
|
|
|
Component tabRow = useFitTab ? row(flex(), cell(tabGroup), flex()).getComponent() : row(flex(flexRatio), cell(tabGroup).weight(headRatio), flex(flexRatio)).getComponent(); |
|
|
|
|
|
|
|
Component backgroundComp = createBackGroundComp(); |
|
|
|
add( |
|
|
|
add( |
|
|
|
column( |
|
|
|
column( |
|
|
|
cell(component), |
|
|
|
cell(tabRow), |
|
|
|
flex() |
|
|
|
cell(centerPane).with(it -> it.setBorder(new ScaledEmptyBorder(10, 10, 10, 10))).weight(1) |
|
|
|
), |
|
|
|
), |
|
|
|
column( |
|
|
|
column( |
|
|
|
fix(headHeight), |
|
|
|
fix(headHeight), |
|
|
|
cell(centerPane).with(it -> it.setBorder(new ScaledEmptyBorder(headHeight + 10, 10, 10, 10))).weight(1) |
|
|
|
cell(backgroundComp).weight(1) |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
fillBackgroundColor(); |
|
|
|
fillBackgroundColor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Component createBackGroundComp() { |
|
|
|
|
|
|
|
JPanel pane = new JPanel(); |
|
|
|
|
|
|
|
pane.putClientProperty(PANEL_TYPE, ROUNDED_PANEL); |
|
|
|
|
|
|
|
pane.setBackground(getFillColor()); |
|
|
|
|
|
|
|
return pane; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initCoreComponents() { |
|
|
|
private void initCoreComponents() { |
|
|
|
cards = new CardLayout(); |
|
|
|
cards = new CardLayout(); |
|
|
|
centerPane = new JPanel(cards); |
|
|
|
centerPane = new JPanel(cards); |
|
|
|
centerPane.putClientProperty(PANEL_TYPE, ROUNDED_PANEL); |
|
|
|
|
|
|
|
tabComponents.forEach((key, value) -> { |
|
|
|
tabComponents.forEach((key, value) -> { |
|
|
|
value.setOpaque(false); |
|
|
|
value.setOpaque(false); |
|
|
|
centerPane.add(value, key); |
|
|
|
centerPane.add(value, key); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Color getFillColor() { |
|
|
|
|
|
|
|
return FineUIUtils.getUIColor("FineTabbedPane.background", "fill.gray"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void fillBackgroundColor() { |
|
|
|
private void fillBackgroundColor() { |
|
|
|
Color fillColor = FineUIUtils.getUIColor("FineTabbedPane.background", "fill.gray"); |
|
|
|
|
|
|
|
Color defaultColor = FineUIUtils.getUIColor("default.background", "Component.background"); |
|
|
|
Color defaultColor = FineUIUtils.getUIColor("default.background", "Component.background"); |
|
|
|
ColorUtils.syncBackgroundIfAbsent(centerPane, fillColor, defaultColor); |
|
|
|
ColorUtils.syncBackgroundIfAbsent(centerPane, getFillColor(), defaultColor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initListeners() { |
|
|
|
private void initListeners() { |
|
|
|