if(e.getSource() == submitBtn)
{
if(aRB.isSelected())
regPrice = 2.50;
else
if(bRB.isSelected())
regPrice = 5.00;
else
if(cRB.isSelected())
regPrice = 7.50;
else
if(dRB.isSelected())
regPrice = 9.75;
int creatCount=0;
int treaCount=0;
int keyCount=0;
if(keySelct.isSelected())
{
keyCount++;
}
if(creatSelct.isSelected())
{
creatCount++;
}
if(treaSelct.isSelected())
{
treaCount++;
}
subtotal = regPrice + (creatCount+treaCount+keyCount)*1.25;
double fee = round(subtotal);
display.setText("<html><font size=\"5\" face=\"Boopee\">"
+ "So, " + user + ", aka " + alias + "<br> your registration fees are only: <br><br>"
+ currencyFormatter.format(regPrice) + "-- Basic Registration Fee<br>"
+ currencyFormatter.format((creatCount+treaCount+keyCount)*1.25)+ "-- At $1.25 per feature for " + (creatCount+treaCount+keyCount) + " Extra Game Features of<br>"
+ "     " + creatCount + " Creature(s)<br>"
+ "     " + treaCount + " Treasure(s)<br>"
+ "     " + keyCount + " Key(s)<br><br> "
+ "=========<br>"
+ currencyFormatter.format(subtotal)+ "-- Subtotal<br>"
+ currencyFormatter.format(fee) + "-- Rounded ESCAPE Service Fee of 10%<br>"
+ "=========<br>"
+ currencyFormatter.format(fee+subtotal)+ "-- Total ESCAPE Registration Fee </font></html>");
featFrame.setVisible(false);
computeFrame.setVisible(true);
}
I am having issues with my JCheckBoxes. The part of code above belongs to a part of an ActionListener class. What happens is the following: There is a JFrame that has 4 JRadioButtons and 3 JCheckBoxes. A user must choose 1 radioButton to indicate their age (which indicates the cost of playing) and must select whether they want extra features such as a treasure, creature or key (which is where the check boxes come in play). My radio buttons work perfectly, but my check boxes are not, it is as if they are never selected. I've tried setting the starting values different to zero and they still do not change after clicking the checkboxes.
Aucun commentaire:
Enregistrer un commentaire