Was marked as duplicate, but still: my question does not refer to override annotations in general, but specifically in fxml controllers.
I am pretty new to java and trying to build a fxml application. I want to add an @Override annotation to a java fxml controller, but I am getting the error message "error: method does not override or implement a method from a supertype", and I cannot figure the origin of the mistake.
The same annotation can be used without any problem to the main java document, so I don't why it is not possible in the controller. The function only is effective once used with the @Override annotation, so commenting it out makes the function useless.
Is is impossible to use additional @Overrides in the controller, or is it a matter of handling them correctly?
public class Main_FXMLController implements Initializable {
private Button button;
@FXML
private void handleButtonAction(ActionEvent event) throws IOException {
System.out.println("You clicked me!");
Platform.exit();
}
// I am trying to add to @Override annotation here, but it returns " method does not override or implement a method from a supertype"
@Override
private static void test () {
System.out.println("Test");
}
@Override
public void initialize(URL url, ResourceBundle rb) {
}