Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void cbshitActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- String stype = cbshit.getSelectedItem().toString();//declaring it in a variable so it will be easy to call this shit
- double TF = Double.parseDouble(otf.getText());
- double LF = Double.parseDouble(olf.getText());
- double MF = Double.parseDouble(omf.getText());
- double EF = Double.parseDouble(oef.getText());
- double MandanasDiscount[] = {(TF - (TF / 100 * 20)),(LF - (LF / 100 * 20)),(MF - (MF / 100 * 20)),(EF - (EF / 100 * 20))};
- double VilmaDiscount[] = {(TF - (TF / 100 * 15)),(LF - (LF / 100 * 15)),(MF - (MF / 100 * 15)),(EF - (EF / 100 * 15))};
- double PGSDiscount[] = {(TF - (TF / 100 * 10)),(LF - (LF / 100 * 10)),(MF - (MF / 100 * 10)),(EF - (EF / 100 * 10))};
- double SFWDiscount[] = {(TF - (TF / 100 * 5)),(LF - (LF / 100 * 5)),(MF - (MF / 100 * 5)),(EF - (EF / 100 * 5))};
- switch(stype)
- {
- case "Mandanas":
- if(otf.getText() != "")
- {
- if(TF > 0)
- {
- ftf.setText("" + MandanasDiscount[0]);
- }
- else if(TF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- ftf.setText("" + TF);
- }
- }
- if(olf.getText() != "")
- {
- if(LF > 0)
- {
- flf.setText("" + MandanasDiscount[1]);
- }
- else if(LF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- flf.setText("" + LF);
- }
- }
- if(omf.getText() != "")
- {
- if(MF > 0)
- {
- fmf.setText("" + MandanasDiscount[2]);
- }
- else if(MF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fmf.setText("" + MF);
- }
- }
- if(oef.getText() != "")
- {
- if(EF > 0)
- {
- fef.setText("" + MandanasDiscount[3]);
- }
- else if(EF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fef.setText("" + EF);
- }
- }
- break;
- case "Vilma":
- if(otf.getText() != "")
- {
- if(TF > 0)
- {
- ftf.setText("" + VilmaDiscount[0]);
- }
- else if(TF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- ftf.setText("" + TF);
- }
- }
- if(olf.getText() != "")
- {
- if(LF > 0)
- {
- flf.setText("" + VilmaDiscount[1]);
- }
- else if(LF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- flf.setText("" + LF);
- }
- }
- if(omf.getText() != "")
- {
- if(MF > 0)
- {
- fmf.setText("" + VilmaDiscount[2]);
- }
- else if(MF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fmf.setText("" + MF);
- }
- }
- if(oef.getText() != "")
- {
- if(EF > 0)
- {
- fef.setText("" + VilmaDiscount[3]);
- }
- else if(EF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fef.setText("" + EF);
- }
- }
- break;
- case "PGS":
- if(otf.getText() != "")
- {
- if(TF > 0)
- {
- ftf.setText("" + PGSDiscount[0]);
- }
- else if(TF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- ftf.setText("" + TF);
- }
- }
- if(olf.getText() != "")
- {
- if(LF > 0)
- {
- flf.setText("" + PGSDiscount[1]);
- }
- else if(LF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- flf.setText("" + LF);
- }
- }
- if(omf.getText() != "")
- {
- if(MF > 0)
- {
- fmf.setText("" + PGSDiscount[2]);
- }
- else if(MF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fmf.setText("" + MF);
- }
- }
- if(oef.getText() != "")
- {
- if(EF > 0)
- {
- fef.setText("" + PGSDiscount[3]);
- }
- else if(EF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fef.setText("" + EF);
- }
- }
- break;
- case "SFW":
- if(otf.getText() != "")
- {
- if(TF > 0)
- {
- ftf.setText("" + SFWDiscount[0]);
- }
- else if(TF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- ftf.setText("" + TF);
- }
- }
- if(olf.getText() != "")
- {
- if(LF > 0)
- {
- flf.setText("" + SFWDiscount[1]);
- }
- else if(LF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- flf.setText("" + LF);
- }
- }
- if(omf.getText() != "")
- {
- if(MF > 0)
- {
- fmf.setText("" + SFWDiscount[2]);
- }
- else if(MF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fmf.setText("" + MF);
- }
- }
- if(oef.getText() != "")
- {
- if(EF > 0)
- {
- fef.setText("" + SFWDiscount[3]);
- }
- else if(EF < 0)
- {
- JOptionPane.showMessageDialog(null,"You are not allow to input negative values","Error",WIDTH);
- }
- else
- {
- fef.setText("" + EF);
- }
- }
- break;
- default:
- ftf.setText("" + TF);
- flf.setText("" + LF);
- fmf.setText("" + MF);
- fef.setText("" + EF);
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement