单选按钮的使用–JRadioButton
java里的jradiobutton值如何得到
JRadioButton jrb = new JRadioButton(String text, Icon icon, boolean selected);
创建一个具有指定的文本、图像和选择状态的单选按钮。
if(jrb.isSelected()){
//
}
很多组建都可以这样判断的
JRadioButton jrb = new JRadioButton(String text, Icon icon, boolean selected);
创建一个具有指定的文本、图像和选择状态的单选按钮。
if(jrb.isSelected()){
//
}
很多组建都可以这样判断的
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Test extends JPanel //implements ActionListener { private ButtonGroup bg; private JRadioButton b1,b2,b3,b4; private JComboBox c1; private JTextField t1; private ActionHandler h1;public void init() { setLayout(new FlowLayout()); String[]s={“Serif”,”SansSerif”,”Monospaced”,”Dialog”}; Font font=new Font(c1.getItemAt(0).toString(),Font.PLAIN,14); public void updateFont() t1.setFont(new Font(fontName,fontStyle,fontSize)); ttf.updateFont(); |
http://blog.sina.com.cn/s/articlelist_2072187723_3_1.html