if((e.getSource() == jBook)) {
String name = jlbName.getText();
String date = jlbDateProduce.getText();
String time = jr1.getText();
int number = (Integer.parseInt(jtfNoOfTicket.getText().trim()));
String total = jlbTotal.getText();
String price = jlbPrice.getText();
//Passing
ticketReservation frame = new ticketReservation(
name, date, time, price, total, String.valueOf(number));
}
I have to calculate the total in another class, but can't I change the string back to double?
string java double
If you use Double.parseDouble(), change the String to double.
String text = "12.34";
double value = Double.parseDouble(text);
double total = Double.parseDouble(jlbTotal.getText());
double price = Double.parseDouble(jlbPrice.getText());
I think you can do it like this.
© 2024 OneMinuteCode. All rights reserved.