Java Swing Synth - JRadioButton Style

来源:互联网 发布:算法的概念教案 编辑:程序博客网 时间:2024/05/22 00:25
<pre name="code" class="plain">

<style id="radioButton">        <imageIcon id="radio_off" path="images/radio_button_off.png"/>        <imageIcon id="radio_on" path="images/radio_button_on.png"/>        <property key="RadioButton.icon" value="radio_off"/>        <state value="SELECTED">            <property key="RadioButton.icon" value="radio_on"/>        </state>    </style>    <bind style="radioButton" type="region" key="RadioButton"/>    <style id="checkBox">        <imageIcon id="checkbox_off" path="images/checkbox_off.png"/>        <imageIcon id="checkbox_on" path="images/checkbox_on.png"/>        <property key="CheckBox.icon" value="checkbox_off"/>        <state value="SELECTED">            <property key="CheckBox.icon" value="checkbox_on"/>        </state>    </style>    <bind style="checkBox" type="region" key="CheckBox"/>


// JRadioButton testButtonGroup sexGroup = new ButtonGroup();JRadioButton boy = new JRadioButton("", true);JRadioButton girl = new JRadioButton("");sexGroup.add(boy);sexGroup.add(girl);JPanel sexPanel = new JPanel();sexPanel.add(boy);sexPanel.add(girl);this.add(sexPanel);JCheckBox football = new JCheckBox("足球");JCheckBox basketball = new JCheckBox("篮球");JCheckBox biker = new JCheckBox("骑行");JPanel hobbyPanel = new JPanel();hobbyPanel.add(football);hobbyPanel.add(basketball);hobbyPanel.add(biker);this.add(hobbyPanel);
1 0
原创粉丝点击