本文整理汇总了Java中javax.swing.JRadioButton.getText方法的典型用法代码示例。如果您正苦于以下问题:Java JRadioButton.getText方法的具体用法?Java JRadioButton.getText怎么用?Java JRadioButton.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JRadioButton
的用法示例。
在下文中一共展示了JRadioButton.getText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.JRadioButton; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae)
{
JRadioButton radio = (JRadioButton)ae.getSource();
String s = radio.getText();
for(int i = 0; i < progetto.scelteDomandaAttualeSize(); i++)
{
if(s.equals(progetto.mostraSceltaDomandaAttuale(i)))
{
indice = i;
}
}
}
示例2: actionPerformed
import javax.swing.JRadioButton; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae)
{
JRadioButton radio = (JRadioButton)ae.getSource();
String s = radio.getText();
for(int i = 0; i < progetto.scelteDomandaAttualeSize(); i++)
{
if(s.equals(progetto.mostraSceltaDomandaAttuale(i)))
indice = i;
}
}
示例3: sessionUI
import javax.swing.JRadioButton; //导入方法依赖的package包/类
protected void sessionUI() {
setSessionID();
//textfields needed for UI
JTextField sessionIDText = new JTextField(getSessionID());
sessionIDText.setEditable(false);
JTextArea sessionDescripText = new JTextArea(4,5);
sessionDescripText.setLineWrap(true);
JScrollPane scrollPane = new JScrollPane(sessionDescripText);
//Radio Button List
JRadioButton newFeature = new JRadioButton("New Feature");
JRadioButton bugFix = new JRadioButton("Bug Fix");
JRadioButton refactoring = new JRadioButton("Refactoring");
JRadioButton genComp = new JRadioButton("General Comprehension");
JRadioButton other = new JRadioButton("Other");
//Group the buttons
ButtonGroup radioList = new ButtonGroup();
radioList.add(newFeature);
radioList.add(bugFix);
radioList.add(refactoring);
radioList.add(genComp);
radioList.add(other);
//Add to a JPanel
JPanel radioPanel = new JPanel(new GridLayout(0, 1));
radioPanel.add(newFeature);
radioPanel.add(bugFix);
radioPanel.add(refactoring);
radioPanel.add(genComp);
radioPanel.add(other);
//Add everything to main JPanel
JPanel sessionPanel = new JPanel(); //main panel
sessionPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.NORTHWEST;
c.gridx = 0;
c.gridy = 0;
sessionPanel.add(new JLabel("Generated Session ID:"),c);
c.gridx++;
sessionPanel.add(sessionIDText,c);
c.gridx = 0;
c.gridy++;
sessionPanel.add(new JLabel("Session Purpose (select one):"),c);
c.gridx++;
sessionPanel.add(radioPanel,c);
c.gridx = 0;
c.gridy++;
sessionPanel.add(new JLabel("Enter the Session Description:"),c);
c.gridx++;
c.fill = GridBagConstraints.HORIZONTAL;
sessionPanel.add(scrollPane,c);
final int selection = JOptionPane.showConfirmDialog(null, sessionPanel,
"Enter the Current Session Info.",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (selection == JOptionPane.OK_OPTION) {
sessionDescrip = sessionDescripText.getText();
if (newFeature.isSelected()) {
sessionPurpose = newFeature.getText();
} else if (bugFix.isSelected()) {
sessionPurpose = bugFix.getText();
} else if (refactoring.isSelected()) {
sessionPurpose = refactoring.getText();
} else if (genComp.isSelected()) {
sessionPurpose = genComp.getText();
} else if (other.isSelected()) {
sessionPurpose = other.getText();
} else {
sessionPurpose = new String();
System.out.println("Warning! "
+ "Your Session Purpose has not been selected.");
}
hasSessionInfo = true;
}
}