Browse Source

无jira任务 代码质量

newui
vito 1 year ago
parent
commit
487ad36098
  1. 2
      designer-base/src/main/java/com/fine/theme/light/ui/FineCombinationButtonUI.java
  2. 6
      designer-base/src/main/java/com/fine/theme/light/ui/FineTemplateTabPaneUI.java
  3. 3
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  4. 24
      designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java

2
designer-base/src/main/java/com/fine/theme/light/ui/FineCombinationButtonUI.java

@ -15,6 +15,8 @@ import java.beans.PropertyChangeEvent;
import static com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
/**
* 双组件按钮UI
*
* @author vito
* @since 11.0
* Created on 2023/12/21

6
designer-base/src/main/java/com/fine/theme/light/ui/FineTemplateTabPaneUI.java

@ -39,7 +39,7 @@ public class FineTemplateTabPaneUI extends PanelUI {
private MultiTemplateTabPane tabPane;
private static final String ELLIPSIS = "...";
private static final int iconTextGap = 4;
private static final int ICON_TEXT_GAP = 4;
private static final int LEADING_WIDTH = 0;
private static final int TRAILING_WIDTH = 34;
@ -283,7 +283,7 @@ public class FineTemplateTabPaneUI extends PanelUI {
private int calculateStringMaxLength() {
return tabPane.getTabWidth()
- tabInsets.left - tabInsets.right
- iconTextGap * 2
- ICON_TEXT_GAP * 2
- fileIcon.getIconWidth() - closeIcon.getIconWidth();
}
@ -340,7 +340,7 @@ public class FineTemplateTabPaneUI extends PanelUI {
int ascent = fm.getAscent();
int gap = (tabHeight - tabInsets.top - tabInsets.bottom - ascent) / 2;
double y = tabInsets.top + ascent + gap;
return new Point2D.Double(x + iconWidth + tabInsets.left + iconTextGap, y);
return new Point2D.Double(x + iconWidth + tabInsets.left + ICON_TEXT_GAP, y);
}

3
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -112,6 +112,9 @@ public class MultiTemplateTabPane extends JPanel {
return UI_CLASS_ID;
}
/**
* 单例
*/
public static MultiTemplateTabPane getInstance() {
if (THIS == null) {
THIS = new MultiTemplateTabPane();

24
designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java

@ -1,10 +1,8 @@
package com.fr.design.gui.ibutton;
import com.fr.design.constants.UIConstants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import java.awt.BorderLayout;
@ -18,6 +16,14 @@ import static com.fine.theme.utils.FineClientProperties.STYLE_PRIMARY;
import static com.fine.theme.utils.FineClientProperties.setStyle;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE;
/**
* 双按钮组件
*
* @author vito
* @since 11.0
* <p>
* created by vito on 2023/12/28
**/
public class UICombinationButton extends JPanel {
private static final String UI_CLASS_ID = "CombinationButtonUI";
@ -146,18 +152,4 @@ public class UICombinationButton extends JPanel {
protected void showPopWindow(JPopupMenu menu) {
GUICoreUtils.showPopupMenu(menu, this, 0, getY() + getHeight() - 3);
}
public static void main(String... args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(null);
UICombinationButton bb = new UICombinationButton("123455", UIConstants.ARROW_DOWN_ICON);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
}
Loading…
Cancel
Save