Hey guys i am making a money converter but i cant seem to see what is the problem for all the gates that i put in. Ii even put testers in. I got my problem but i dont know how to fix it. I am trying my best
Excuse my English its not the best
Here is my GUI
/* package fase3; /** * * @author Jigsaw */ public class Converter extends javax.swing.JFrame { /** Creates new form Converter */ public Converter() { initComponents(); } Driver dr = new Driver(); double num =0; double numout = 0; double blah = 0; int EurotoSA = 0; int USAtoSA = 0; int SAtoEuro = 0; int EurotoUSA = 0; int USAtoEuro = 0; int SAtoUSA = 0; ( I removed all this coding cause i got this right nothing to do with what my problem is ) private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { num = Integer.parseInt(jTextField1.getText()); dr.getNum(num); numout = dr.setNum(blah); jLabel1.setText("Test 1 : " + dr.numD); jLabel2.setText("Test 2 : " + dr.SAtoEuro); jTextField2.setText ("" +numout); } private void SouthAfricanOUTActionPerformed(java.awt.event.ActionEvent evt) { } private void SouthAfricaINActionPerformed(java.awt.event.ActionEvent evt) { SouthAfricanOUT.setEnabled(false); EuropeOUT.setSelected(true); if(SouthAfricaIN.isSelected() && EuropeOUT.isSelected()){ SAtoEuro = 1; SAtoUSA = 0; USAtoSA = 0; USAtoEuro = 0; EurotoUSA = 0; EurotoSA = 0; dr.gate1(SAtoEuro); } if(SouthAfricaIN.isSelected() && AmericaOUT.isSelected()){ SAtoEuro = 0; SAtoUSA = 1; USAtoSA = 0; USAtoEuro = 0; EurotoUSA = 0; EurotoSA = 0; dr.gate1(SAtoEuro); } } private void AmericaINActionPerformed(java.awt.event.ActionEvent evt) { } private void EuropeINActionPerformed(java.awt.event.ActionEvent evt) { } private void AmericaOUTActionPerformed(java.awt.event.ActionEvent evt) { } private void EuropeOUTActionPerformed(java.awt.event.ActionEvent evt) { } private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) { new Help().setVisible(true); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Converter().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JRadioButton AmericaIN; private javax.swing.JRadioButton AmericaOUT; private javax.swing.JRadioButton EuropeIN; private javax.swing.JRadioButton EuropeOUT; private javax.swing.JRadioButton SouthAfricaIN; private javax.swing.JRadioButton SouthAfricanOUT; private javax.swing.ButtonGroup buttonGroup1; private javax.swing.ButtonGroup buttonGroup2; private javax.swing.ButtonGroup buttonGroup3; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JMenu jMenu1; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; // End of variables declaration }
Here my driver class this is where the math goes.
package fase3; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Jigsaw */ public class Driver { double num = 0; double numD = 0; double USAtoSAcur = 7.022; double USAtoEUROcur = 1.393; double SAtoEUROcur = 9.785; int EurotoSA = 0; int USAtoSA = 0; int SAtoEuro = 0; int EurotoUSA = 0; int USAtoEuro = 0; int SAtoUSA = 0; public double getNum(double inNum) { num = inNum; return num; } public int gate1(int StoE){ SAtoEuro = StoE; return SAtoEuro; } public void Cu1(){ if (SAtoEuro == 1){ numD = num*SAtoEUROcur; } } public double setNum(double numOUT) { numOUT = numD; return numOUT; } }
Also another thing i made another frame that helps dummies like a tutorial. But if you press on the X top right it closes my whole program. How do i make it so that it only closes that frame and not the whole program?