Browse Source
Merge in DESIGN/design from ~LEVY.XIE/design:newui to newui * commit '4b8e6b7e8d433f1696f2db285043ac8507728bfc': REPORT-107972 设计器样式翻新-按钮边距恢复 REPORT-107972 设计器样式翻新-按钮组布局更新、补充StoryBooknewui
Levy.Xie-解安森
12 months ago
14 changed files with 362 additions and 238 deletions
@ -0,0 +1,37 @@
|
||||
package com.fine.theme.light.ui; |
||||
|
||||
import com.fine.theme.icon.LazyIcon; |
||||
import com.formdev.flatlaf.ui.FlatCheckBoxUI; |
||||
|
||||
import javax.swing.AbstractButton; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.plaf.ComponentUI; |
||||
|
||||
/** |
||||
* 提供 {@link javax.swing.JCheckBox} 的UI类 |
||||
* |
||||
* @author Levy.Xie |
||||
* @since 11.0 |
||||
* Created on 2023/12/14 |
||||
*/ |
||||
public class FineCheckBoxUI extends FlatCheckBoxUI { |
||||
|
||||
public static ComponentUI createUI(JComponent c) { |
||||
return new FineCheckBoxUI(false); |
||||
} |
||||
|
||||
protected FineCheckBoxUI(boolean shared) { |
||||
super(shared); |
||||
} |
||||
|
||||
@Override |
||||
public void installDefaults(AbstractButton b) { |
||||
super.installDefaults(b); |
||||
b.setIcon(new LazyIcon("checkbox_unchecked")); |
||||
b.setSelectedIcon(new LazyIcon("checkbox_checked")); |
||||
b.setRolloverIcon(new LazyIcon("checkbox_hovered")); |
||||
b.setDisabledIcon(new LazyIcon("checkbox_unchecked").disabled()); |
||||
b.setDisabledSelectedIcon(new LazyIcon("checkbox_checked").disabled()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.fr.design.gui.storybook; |
||||
|
||||
import com.fine.theme.icon.LazyIcon; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ibutton.UITabGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.mainframe.theme.edit.ui.TabbedPane; |
||||
import com.fr.stable.ArrayUtils; |
||||
|
||||
|
||||
import javax.swing.*; |
||||
|
||||
import static com.fine.swing.ui.layout.Layouts.*; |
||||
|
||||
/** |
||||
* Tab按钮组 |
||||
* |
||||
* @author Levy.Xie |
||||
* @since 11.0 |
||||
* Created on 2023/12/14 |
||||
*/ |
||||
public class ButtonTabStoryBoard extends StoryBoard { |
||||
public ButtonTabStoryBoard() { |
||||
super("切换按钮组"); |
||||
add( |
||||
cell(new UILabel("单行文字按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(new UIButtonGroup<>(new String[]{"按钮1", "按钮2", "按钮3"})), |
||||
cell(new UILabel("单行图标按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(new UIButtonGroup<>(iconArray())), |
||||
cell(new UILabel("选中切换图标按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(new UIButtonGroup<>(iconArrayWithWhite())), |
||||
cell(new UILabel("多行按钮-偶数场景-6按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(new UITabGroup(sixTextArray())), |
||||
cell(new UILabel("多行按钮-奇数场景-5按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(new UITabGroup(fiveTextArray())), |
||||
cell(new UILabel("多行按钮-奇数场景-7按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(new UITabGroup(sevenTextArray())), |
||||
flex() |
||||
); |
||||
} |
||||
|
||||
private static Icon[] iconArray() { |
||||
return ArrayUtils.toArray( |
||||
new LazyIcon("edit"), |
||||
new LazyIcon("preview"), |
||||
new LazyIcon("connection") |
||||
); |
||||
} |
||||
|
||||
private Icon[][] iconArrayWithWhite() { |
||||
return ArrayUtils.toArray( |
||||
ArrayUtils.toArray(new LazyIcon("edit"), new LazyIcon("copy")), |
||||
ArrayUtils.toArray(new LazyIcon("preview"), new LazyIcon("save")) |
||||
); |
||||
} |
||||
|
||||
private String[] fiveTextArray() { |
||||
return ArrayUtils.toArray("按钮1", "按钮2", "按钮3", "按钮4", "按钮5"); |
||||
} |
||||
|
||||
private String[] sevenTextArray() { |
||||
return ArrayUtils.toArray("按钮1", "按钮2", "按钮3", "按钮4", "按钮5", "按钮6", "按钮7"); |
||||
} |
||||
|
||||
private String[] sixTextArray() { |
||||
return ArrayUtils.toArray("按钮1", "按钮2", "按钮3", "按钮4", "按钮5", "按钮6"); |
||||
} |
||||
} |
@ -0,0 +1,58 @@
|
||||
package com.fr.design.gui.storybook; |
||||
|
||||
|
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
|
||||
import java.awt.*; |
||||
|
||||
import static com.fine.swing.ui.layout.Layouts.*; |
||||
import static com.fine.swing.ui.layout.Layouts.row; |
||||
|
||||
/** |
||||
* 复选按钮 |
||||
* |
||||
* @author Levy.Xie |
||||
* @since 11.0 |
||||
* Created on 2023/12/14 |
||||
*/ |
||||
public class CheckBoxStoryBoard extends StoryBoard { |
||||
|
||||
public CheckBoxStoryBoard() { |
||||
super("复选按钮"); |
||||
add( |
||||
cell(new UILabel("水平布局")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
row(10, |
||||
cell(new UICheckBox("测试1")), |
||||
cell(new UICheckBox("测试2")), |
||||
cell(new UICheckBox("测试3")) |
||||
), |
||||
fix(5), |
||||
cell(new UILabel("垂直布局")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
column(5, |
||||
cell(new UICheckBox("测试1")), |
||||
cell(new UICheckBox("测试2")), |
||||
cell(new UICheckBox("测试3")) |
||||
), |
||||
fix(5), |
||||
cell(new UILabel("禁用状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
row(10, |
||||
cell(getDisabledStatus(new UICheckBox("测试"))), |
||||
cell(getDisabledSelectedStatus(new UICheckBox("测试"))) |
||||
), |
||||
flex() |
||||
); |
||||
} |
||||
|
||||
private Component getDisabledStatus(UICheckBox c) { |
||||
c.setEnabled(false); |
||||
return c; |
||||
} |
||||
|
||||
private Component getDisabledSelectedStatus(UICheckBox c) { |
||||
c.setSelected(true); |
||||
c.setEnabled(false); |
||||
return c; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,43 @@
|
||||
package com.fr.design.gui.storybook; |
||||
|
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.stable.ArrayUtils; |
||||
|
||||
import java.awt.*; |
||||
|
||||
import static com.fine.swing.ui.layout.Layouts.cell; |
||||
import static com.fine.swing.ui.layout.Layouts.flex; |
||||
|
||||
/** |
||||
* 下拉选择框 |
||||
* |
||||
* @author Levy.Xie |
||||
* @since 11.0 |
||||
* Created on 2023/12/14 |
||||
*/ |
||||
public class ComboBoxStoryBoard extends StoryBoard { |
||||
|
||||
public ComboBoxStoryBoard() { |
||||
super("下拉选择框"); |
||||
|
||||
add( |
||||
cell(new UILabel("普通状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(new UIComboBox( |
||||
ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4") |
||||
)), |
||||
cell(new UILabel("禁用状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), |
||||
cell(getDisabledStatus()), |
||||
flex() |
||||
); |
||||
} |
||||
|
||||
private Component getDisabledStatus() { |
||||
UIComboBox box = new UIComboBox( |
||||
ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4") |
||||
); |
||||
box.setEnabled(false); |
||||
return box; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue