本文整理匯總了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;
}
}