Browse Source

REPORT-107972 设计器样式翻新-UIComboBox翻新

newui
Levy.Xie-解安森 12 months ago
parent
commit
da6ad1d677
  1. 59
      designer-base/src/main/java/com/fine/theme/light/ui/FineRoundBorder.java

59
designer-base/src/main/java/com/fine/theme/light/ui/FineRoundBorder.java

@ -0,0 +1,59 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatRoundBorder;
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
import com.fr.design.event.HoverAware;
import javax.swing.UIManager;
import java.awt.Color;
import java.awt.Component;
import java.awt.Paint;
/**
* 通用的Border类具备hoverclick禁用等多种状态
*
* @author Levy.Xie
* @since 11.0
* Created on 2023/12/06
*/
public class FineRoundBorder extends FlatRoundBorder {
@Styleable(dot = true)
protected Color borderColor = UIManager.getColor("defaultBorderColor");
@Styleable(dot = true)
protected Color disabledBorderColor = UIManager.getColor("defaultBorderColor");
@Styleable(dot = true)
protected Color highlightBorderColor = UIManager.getColor("defaultHighlightBorderColor");
@Styleable(dot = true)
protected Color focusColor = UIManager.getColor("defaultBorderFocusShadow");
@Styleable(dot = true)
protected int focusWidth = UIManager.getInt("defaultBorderFocusWidth");
@Override
protected Paint getBorderColor(Component c) {
if (isEnabled(c)) {
if (c instanceof HoverAware && ((HoverAware) c).isHovered()) {
return getHoverBorderColor();
} else {
return isFocused(c) ? focusedBorderColor : borderColor;
}
}
return disabledBorderColor;
}
@Override
protected Color getFocusColor(Component c) {
return focusColor;
}
@Override
protected int getFocusWidth(Component c) {
return focusWidth;
}
protected Color getHoverBorderColor() {
return highlightBorderColor;
}
}
Loading…
Cancel
Save