diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java index b1a6c81762..6517967adc 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java @@ -9,9 +9,13 @@ import com.formdev.flatlaf.extras.FlatAnimatedLafChange; import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.storybook.components.ButtonStoryBoard; +import com.fr.design.gui.storybook.components.ButtonTabStoryBoard; +import com.fr.design.gui.storybook.components.CheckBoxStoryBoard; +import com.fr.design.gui.storybook.components.ComboBoxStoryBoard; import com.fr.design.gui.storybook.components.EastRegionContainer; import com.fr.design.gui.storybook.components.ExpandablePaneStoryBoard; import com.fr.design.gui.storybook.components.InputStoryBoard; +import com.fr.design.gui.storybook.components.RadioButtonStoryBoard; import com.fr.design.gui.storybook.components.SliderStoryBoard; import com.fr.design.gui.storybook.components.ToggleButtonStoryBoard; import com.fr.design.gui.storybook.components.ToolTipStoryBoard; @@ -36,7 +40,8 @@ import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.ArrayList; -import static com.fine.swing.ui.layout.Layouts.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.theme.utils.FineUIScale.scale; /** @@ -98,6 +103,7 @@ public class Storybook { components.add(new StoryBookComponent("ButtonTabGroup", new ButtonTabStoryBoard())); components.add(new StoryBookComponent("CheckBox", new CheckBoxStoryBoard())); components.add(new StoryBookComponent("ComboBox", new ComboBoxStoryBoard())); + components.add(new StoryBookComponent("RadioButton", new RadioButtonStoryBoard())); components.add(new StoryBookComponent("Input", new InputStoryBoard())); components.add(new StoryBookComponent("Slider", new SliderStoryBoard())); components.add(new StoryBookComponent("ToolTip", new ToolTipStoryBoard())); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/ButtonTabStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java similarity index 100% rename from designer-base/src/test/java/com/fr/design/gui/storybook/ButtonTabStoryBoard.java rename to designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/CheckBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java similarity index 100% rename from designer-base/src/test/java/com/fr/design/gui/storybook/CheckBoxStoryBoard.java rename to designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/ComboBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java similarity index 100% rename from designer-base/src/test/java/com/fr/design/gui/storybook/ComboBoxStoryBoard.java rename to designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java new file mode 100644 index 0000000000..a3db59e1b3 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java @@ -0,0 +1,50 @@ +package com.fr.design.gui.storybook.components; + +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.storybook.StoryBoard; + +import javax.swing.ButtonGroup; + +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + +/** + * RadioButton + * + * @author vito + * @since 11.0 + * Created on 2023/12/14 + */ +public class RadioButtonStoryBoard extends StoryBoard { + + ButtonGroup buttonGroup = new ButtonGroup(); + ButtonGroup buttonGroup1 = new ButtonGroup(); + + public RadioButtonStoryBoard() { + super("单选按钮"); + add( + cell(new UILabel("普通")).with(it -> it.setFont(labelFont.deriveFont(14f))), + row(10, + cell(new UIRadioButton("选项一")).with(it -> { + buttonGroup.add(it); + buttonGroup.setSelected(it.getModel(), true); + }), + cell(new UIRadioButton("选项二")).with(it -> buttonGroup.add(it)), + cell(new UIRadioButton("选项三")).with(it -> buttonGroup.add(it)) + ), + cell(new UILabel("禁用状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), + row(10, + cell(new UIRadioButton("选项一")).with(it -> { + buttonGroup1.add(it); + buttonGroup1.setSelected(it.getModel(), true); + }), + cell(new UIRadioButton("选项二")).with(it -> buttonGroup1.add(it)), + cell(new UIRadioButton("选项三")).with(it -> { + buttonGroup1.add(it); + it.setEnabled(false); + }) + ) + ); + } +}