Question: I am using scenebuilder and the the toggle group is really screwing me up. I am trying to see if the user selects line, circle

I am using scenebuilder and the the toggle group is really screwing me up. I am trying to see if the user selects line, circle or rectangle, but I cannot because it keeps coming up that my toggle group reads in a null value. I will post the code below, I know that there is definitely something wrong with it.

package assign3draw;

import javafx.scene.control.TextField; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control.ToggleGroup; import javafx.event.ActionEvent; //import javafx.beans.value.ObservableValue; import javafx.collections.ObservableList; import javafx.collections.FXCollections; import javafx.scene.control.ComboBox; import javafx.scene.layout.Pane; import javafx.scene.control.ColorPicker; import java.util.*; public class Assign3DrawController{ private enum Shape {Line, Circle, Rectangle}; private String[] ShadeType= { "Full", "Light", "Empty"}; private ObservableListShadeList = FXCollections.observableArrayList(ShadeType); private Shape ShapeSelected = Shape.Line;

@FXML private ColorPicker ColorColorPicker;

@FXML private ComboBox ShadeComboBox;

@FXML private TextField Input4;

@FXML private TextField Input3;

@FXML private TextField Input2;

@FXML private TextField Input1;

@FXML private Label InputName4;

@FXML private Label InputName3;

@FXML private Label InputName2;

@FXML private Label InputName1;

@FXML private RadioButton RectangleRadioButton;

@FXML private ToggleGroup ShapeToggleGroup;

@FXML private RadioButton CircleRadioButton;

@FXML private RadioButton LineRadioButton;

@FXML private Pane displayPane;

@FXML void ClickedDraw(ActionEvent event) {

}

@FXML void ColorChosen(ActionEvent event) {

}

@FXML void ShadeChosen(ActionEvent event) {

}

@FXML void ShapeChosen(ActionEvent event) { ShapeSelected = (Shape)ShapeToggleGroup.getSelectedToggle().getUserData(); System.out.println(ShapeSelected);

}

}

I am using scenebuilder and the the toggle group is really screwing

. Awayn.haat.hcr | Assign3Draw.fxml Choose Shape Line Rectangle Circle First Point x Second Point x Choose Shading/Color Draw . Awayn.haat.hcr | Assign3Draw.fxml Choose Shape Line Rectangle Circle First Point x Second Point x Choose Shading/Color Draw

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!