Browse Source
Merge in DESIGN/design from ~VITO/c-design:newui to newui * commit 'c6603812176cc42ea77dcb62aa1c71b80dbaf381': 无jira任务 代码质量 无jira任务 漏了 REPORT-99485 fix:UIHeadGroup在切换主题时无法应用UI new: storybook自动搜索故事 fix: button放开高度限制newui
vito-刘恒霖
1 year ago
10 changed files with 196 additions and 129 deletions
@ -0,0 +1,74 @@
|
||||
package com.fine.theme.light.ui; |
||||
|
||||
import com.fine.theme.utils.FineUIUtils; |
||||
import com.formdev.flatlaf.ui.FlatUIUtils; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.plaf.ComponentUI; |
||||
import javax.swing.plaf.PanelUI; |
||||
import java.awt.Color; |
||||
import java.awt.Dimension; |
||||
import java.awt.Graphics; |
||||
|
||||
import static com.formdev.flatlaf.ui.FlatStylingSupport.Styleable; |
||||
|
||||
/** |
||||
* HeadGroup 的UI类 |
||||
* |
||||
* @author vito |
||||
* @since 11.0 |
||||
* Created on 2023/12/15 |
||||
*/ |
||||
public class FineHeadGroupUI extends PanelUI { |
||||
|
||||
@Styleable(dot = true) |
||||
protected Color background; |
||||
|
||||
@Styleable(dot = true) |
||||
protected int arc; |
||||
|
||||
/** |
||||
* 创建UI |
||||
* |
||||
* @param c 组件 |
||||
* @return ComponentUI |
||||
*/ |
||||
public static ComponentUI createUI(JComponent c) { |
||||
return new FineHeadGroupUI(); |
||||
} |
||||
|
||||
@Override |
||||
public void installUI(JComponent c) { |
||||
super.installUI(c); |
||||
background = FineUIUtils.getUIColor("HeadGroup.background", "desktop"); |
||||
arc = FineUIUtils.getUIInt("HeadGroup.arc", "Component.arc"); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void uninstallUI(JComponent c) { |
||||
super.uninstallUI(c); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getMinimumSize(JComponent component) { |
||||
return new Dimension(0, 0); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getMaximumSize(JComponent component) { |
||||
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); |
||||
} |
||||
|
||||
@Override |
||||
public void update(Graphics g, JComponent c) { |
||||
paintBackground(g, c); |
||||
paint(g, c); |
||||
} |
||||
|
||||
protected void paintBackground(Graphics g, JComponent c) { |
||||
FlatUIUtils.setRenderingHints(g); |
||||
g.setColor(background); |
||||
g.fillRoundRect(0, 0, c.getWidth(), c.getHeight(), arc, arc); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.gui.storybook; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
/** |
||||
* @author vito |
||||
* @since 11.0 |
||||
* Created on 2023/12/15 |
||||
*/ |
||||
|
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Target(ElementType.TYPE) |
||||
@Inherited |
||||
public @interface Story { |
||||
} |
Loading…
Reference in new issue