Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
How To Write To Txt File Using If Else Statement Within a Button

Fixed the problem, thanks for all the help c:

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

To track iceCream selected, simply add new field iceCream. And assign a value to it once it's selected. Do the same with you 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 Relatório

0

Consider how RadioButtons are grouped by a ToggleGroup. In code:

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);

You can handle all selection by the ToggleGroup component.

RadioButton selected = (RadioButton) icecream.getSelectedToggle();

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

Writing the selected radio button's label (say "Vanilla") and later reading "Vanilla" and looping through all radioButtons to select the matching one is not too circumstantial.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda