我刚刚创建了一个应用程序,它采用简单的披萨顺序/ w顶部,然后在文本字段中显示顺序。但是,我不确定如何告诉程序选择了什么, 然后添加所选内容 。我尝试了不同的方法,但我没有得到我希望的结果。
有人可以提供帮助吗?
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void pSmallActionPerformed(java.awt.event.ActionEvent evt) {
int Small;
Small = 8;
}
private void pLargeActionPerformed(java.awt.event.ActionEvent evt) {
int Large;
Large = 12;
}
private void totalFieldActionPerformed(java.awt.event.ActionEvent evt) {
}
private void pMedActionPerformed(java.awt.event.ActionEvent evt) {
int Med;
Med = 10;
}
private void pChkActionPerformed(java.awt.event.ActionEvent evt) {
boolean jCheckBox1ActionPerformed = false;
if (jCheckBox1ActionPerformed) {
int pep;
pep = 1;
} else {
}
}
private void sChkActionPerformed(java.awt.event.ActionEvent evt) {
boolean jCheckBox1ActionPerformed = false;
if (jCheckBox1ActionPerformed) {
int sus;
sus = 1;
} else {
}
}
private void mChkActionPerformed(java.awt.event.ActionEvent evt) {
boolean jCheckBox1ActionPerformed = false;
if (jCheckBox1ActionPerformed) {
int mus;
mus = 1;
} else {
}
}
private void oChkActionPerformed(java.awt.event.ActionEvent evt) {
boolean jCheckBox1ActionPerformed = false;
if (jCheckBox1ActionPerformed) {
int oin;
oin = 1;
} else {
}
}
private void Test(java.awt.event.MouseEvent evt) {
int Large = 12;
int Med = 10;
int Small = 8;
int mus = 1;
int oin = 1;
int pep = 1;
int sus = 1;
Integer.toString (Large);
Integer.toString (Med);
Integer.toString (Small);
Integer.toString (mus);
Integer.toString (oin);
Integer.toString (pep);
Integer.toString (sus);
int total = Small + Large + Med + pep + sus + mus + oin;
String total2 = String.valueOf(total);
totalField.setText(total2);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(pizzaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(pizzaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(pizzaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(pizzaMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new pizzaMenu().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
public javax.swing.JCheckBox mChk;
public javax.swing.JCheckBox oChk;
public javax.swing.JCheckBox pChk;
public javax.swing.JRadioButton pLarge;
public javax.swing.JRadioButton pMed;
public javax.swing.JRadioButton pSmall;
public javax.swing.JCheckBox sChk;
public javax.swing.JTextField totalField;
// End of variables declaration
}