我希望在Eclipse中使用gridbaglayout单击“提交”按钮时,显示诸如警报框之类的消息。
我已经完成了网格窗格的工作,这是完美的。我不确定在gridbaglayout中可以将哪种类型的消息视为警报消息。
button.addActionListener {
public void actionPerformed(ActionEvent e) {
if(nameField.getText().isEmpty()) {
showAlert(Alert.AlertType.ERROR, grid.getScene().getWindow(), "Form Error!", "Please enter your name");
return;
}
if(emailField.getText().isEmpty()) {
showAlert(Alert.AlertType.ERROR, grid.getScene().getWindow(), "Form Error!", "Please enter your email id");
return;
}
if(detailedField.getText().isEmpty()) {
showAlert(Alert.AlertType.ERROR, grid.getScene().getWindow(), "Form Error!", "Please enter a password");
return;
}
showAlert(Alert.AlertType.CONFIRMATION, grid.getScene().getWindow(), "Save Successful!","Congratulations!!! " + nameField.getText() + "\n" +" File has Submitted Successfully!!");
showAlert(Alert.AlertType.CONFIRMATION, grid.getScene().getWindow(), "Save Successful!","Congratulations!!! " + nameField.getText() + "\n" + " File has Email Successfully!!");
showAlert(Alert.AlertType.CONFIRMATION, grid.getScene().getWindow(), "Save Successful!","Congratulations!!! " + nameField.getText() + "\n" + " File has Print Successfully!!");
}
};