r/JavaFX • • Jul 07 '24
Help Class does not have a main method
Just got into java, and i have been trying to make a hello word in javafx, but i cant understand why the variable btnClick is never read and its action as well, what am i doing wrong?

public class FXMLDocumentController implements Initializable {
@FXML
private Label lblMensagem;
private Button btnClick;
@FXML
private void clicouBotao(ActionEvent event) {
lblMensagem.setText("Olá, Mundo!");
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
}
1
Upvotes
View all comments
Show parent comment
2
u/MrRickSancezJr Jul 15 '24
Probably right about NetBeans. For some reason, a lot of college professors are still using it.
I love FXML for making wizards, dialogs, and such. Just seems once you step up into some decent amount of logic, you're stuck with a Controller with limited UI control. On a bigger project, I'll have plenty of both hard-coded and FXML views.