table.setRowFactory( tv -> { TableRow<MyType> row = new TableRow<>(); row.setOnMouseClicked(event ->{ boolean result = (boolean) row.getUserData(); if(result){ row.setUserData(false); //There will be your method to open new window methodToOpenNewWindow(row); }else{ Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Information"); alert.setContentText("This entity already was opened."); alert.show(); } }); return row ; });
import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.DatePicker; public class Controller implements Initializable { @FXML DatePicker lowEndDate; public void searchOKButtonClicked(ActionEvent e){ Alert alert = new Alert(AlertType.ERROR); alert.setContentText("Oops! At least one field is required to search. " + " " + lowEndDate.getValue()); alert.show(); } @Override public void initialize(URL arg0, ResourceBundle arg1) { // TODO Auto-generated method stub } }
@FXML void uploadLogsCheckboxOnAction(ActionEvent event) { if (gitHubIssue.getThrowable() != null && !uploadLogsCheckbox.isSelected()) { (new Alert(Alert.AlertType.WARNING, bundle.getString("uploadLogsExceptionInfo"), ButtonType.OK)).show(); } }
Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Some title"); Text text = new Text("some right-to-left text here"); TextFlow textFlow = new TextFlow(); textFlow.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT); textFlow.getChildren().addAll(text); alert.getDialogPane().setContent(textFlow); alert.show();
new Alert(Alert.AlertType.ERROR, bundle.getString("error")).show(); return; new Alert(Alert.AlertType.ERROR, "Something went wrong when trying to upload the issue: " + responseCode + " " + Internet.getReasonForHTTPCode(responseCode)).show(); } else { new Alert(Alert.AlertType.CONFIRMATION, bundle.getString("thanks")).show();
buttonBar.setDisable(false); alertOut.show();