Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
Cómo escribir en un archivo Txt usando la instrucción If Else dentro de un botón

Solucionado el problema, gracias por toda la ayuda c:

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Para realizar un seguimiento de iceCream seleccionado, simplemente agregue el nuevo campo iceCream . Y asígnele un valor una vez que esté seleccionado. Haz lo mismo con tus toppingsCost :

 public class FXMLDocumentController implements Initializable { private String iceCream; private double toppingsCost; .... private void handleButtonSaving(ActionEvent event) { if(vanilla.isSelected()) { iceCream = "Vanilla"; System.out.println(iceCream); } if(chocolate.isSelected()) { iceCream = "Chocolate"; System.out.println(iceCream); } ... private void handleButtonCalculateCost(ActionEvent event) { double myTotal = 0.0; myTotal += retrieveIceCreamCost(); toppingsCost = retrieveToppingsCost(); myTotal += toppingsCost; ...
over 4 years ago · Santiago Trujillo Report

0

Considere cómo se agrupan los RadioButton por un ToggleGroup . En codigo:

 final ToggleGroup icecream = new ToggleGroup(); RadioButton rb1 = new RadioButton("Vanilla"); rb1.setToggleGroup(icecream); rb1.setSelected(true); RadioButton rb2 = new RadioButton("Chocolate"); rb2.setToggleGroup(icecream); RadioButton rb3 = new RadioButton("Strawberry"); rb3.setToggleGroup(icecream);

Puede manejar toda la selección mediante el componente ToggleGroup.

 RadioButton selected = (RadioButton) icecream.getSelectedToggle(); ObservableList<Toggle> radioButtons = icecream.getToggles();

Escribir la etiqueta del botón de radio selected (digamos "Vanilla") y luego leer "Vanilla" y recorrer todos los radioButtons de radio para seleccionar el correspondiente no es demasiado circunstancial.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!