Browse Source

REPORT-133897 fix:TabPane垂直布局调整

fbp/merge
Levy.Xie-解安森 3 months ago
parent
commit
2e479691f6
  1. 24
      designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java

24
designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java

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

Loading…
Cancel
Save