I am new to programming; take it easy. :)
I have a simple program (for training) that will not compile unless I create two TextField objects. I get an error (ava.lang.IllegalAccessException: class javafx.fxml.FXMLLoader $ ValueElement cannot access a member of class firstjavafxprogram.SampleController with modifiers "private"). And I just can't understand why these two should be publicly, but Label can be closed. Hope I posted my code correctly:
package firstjavafxprogram; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Label; import javafx.scene.control.TextField; public class SampleController implements Initializable { @FXML private Label label; public TextField txtVolts; public TextField txtAmps; @FXML private void handleButtonAction(ActionEvent event) { String labelMessage = getTheMessage(); label.setText(labelMessage); } @Override public void initialize(URL url, ResourceBundle rb) {
source share