vito
1 year ago
5 changed files with 57 additions and 1 deletions
@ -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…
Reference in new issue