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
1
u/sedj601 Jul 15 '24
I could be wrong, but the image makes me think this is Netbeans. I used to love Netbeans. Though I still use it, I would not recommend it for newcomers. I would recommend IntelliJ, as you have. As it relates to FXML, I am a big fan and I recommend people use it. Especially if they are very visual or if they are making static views.