Browse Source

Pull request #13525: REPORT-107973 修改 东区按钮边框、滑块高度、主题配置按钮宽度

Merge in DESIGN/design from ~LEO.QIN/design:newui to newui

* commit '597b22721502eecfc8561527ad98007868dc909a':
  REPORT-107973 修改 东区按钮边框、滑块高度、主题配置按钮宽度
newui
Leo.Qin-覃宇攀 10 months ago
parent
commit
b5a9afdfca
  1. 3
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  2. 21
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  3. 11
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

3
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -6,7 +6,6 @@ import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.ui.FlatLineBorder;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -413,7 +412,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
leftPane.add(item.getButton()); leftPane.add(item.getButton());
} }
leftPane.setBorder(new FlatLineBorder(new Insets(0,1,0,1), UIManager.getColor("East.border"))); leftPane.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 1, UIManager.getColor("East.border")));
replaceLeftPane(leftPane); replaceLeftPane(leftPane);
} }

21
designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
@ -12,7 +11,6 @@ import com.fr.design.gui.itextfield.UINumberField;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -69,7 +67,7 @@ public class JFormSliderPane extends JPanel {
initSlider(); initSlider();
initDownUpButton(); initDownUpButton();
initShowValField(); initShowValField();
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 2));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
@ -123,10 +121,15 @@ public class JFormSliderPane extends JPanel {
} }
private void initShowValField() { private void initShowValField() {
showValField = new UINumberField(); showValField = new UINumberField() {
@Override
public Dimension getPreferredSize() {
int width = FineUIUtils.getAndScaleInt("FormSliderPane.showValueWidth", 40);
int height = FineUIUtils.getAndScaleInt("FormSliderPane.showValueHeight", 20);
return new Dimension(width, height);
}
};
showValField.setValue(showValue); showValField.setValue(showValue);
Dimension dimension = new Dimension(UIManager.getInt("FormSliderPane.showValueWidth"), UIManager.getInt("FormSliderPane.showValueHeight"));
showValField.setPreferredSize(FineUIScale.scale(dimension));
showValField.addKeyListener(new KeyListener() { showValField.addKeyListener(new KeyListener() {
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
@ -293,5 +296,11 @@ public class JFormSliderPane extends JPanel {
public void addValueChangeListener(ChangeListener changeListener){ public void addValueChangeListener(ChangeListener changeListener){
this.slider.addChangeListener(changeListener); this.slider.addChangeListener(changeListener);
} }
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
return new Dimension(size.width, FineUIUtils.getAndScaleInt("Component.defaultHeight", 24));
}
} }

11
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -115,8 +115,6 @@ import javax.swing.JOptionPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Arrays; import java.util.Arrays;
@ -1610,14 +1608,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
protected UIButton createTemplateThemeButton() { protected UIButton createTemplateThemeButton() {
UIButton button = new UIButton(new LazyIcon("template_theme")) { UIButton button = new UIButton(new LazyIcon("template_theme"));
@Override
public Dimension getPreferredSize() {
FontMetrics metrics = getFontMetrics(getFont());
int width = Math.min(metrics.stringWidth(getText()) + PREDEFINED_ICON_WIDTH, 100);
return new Dimension(width, 20);
}
};
button.setToolTipText(getTemplateTheme().getName()); button.setToolTipText(getTemplateTheme().getName());
button.setText(getTemplateTheme().getName()); button.setText(getTemplateTheme().getName());
button.setName(getTemplateTheme().getName()); button.setName(getTemplateTheme().getName());

Loading…
Cancel
Save