Browse Source

REPORT-99485 RadioButtonStoryBoard

newui
vito 1 year ago
parent
commit
643e06a71a
  1. 8
      designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java
  2. 0
      designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java
  3. 0
      designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java
  4. 0
      designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java
  5. 50
      designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java

8
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()));

0
designer-base/src/test/java/com/fr/design/gui/storybook/ButtonTabStoryBoard.java → designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java

0
designer-base/src/test/java/com/fr/design/gui/storybook/CheckBoxStoryBoard.java → designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java

0
designer-base/src/test/java/com/fr/design/gui/storybook/ComboBoxStoryBoard.java → designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java

50
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);
})
)
);
}
}
Loading…
Cancel
Save