PR #1510 Feedback: set min height, use AppServices url handling

This commit is contained in:
David Cavaceci 2024-10-07 09:59:58 -05:00
parent bf457620db
commit 2aac365039

View file

@ -132,6 +132,7 @@ public class TitledDescriptionPane extends TitledPane {
contentBox.setAlignment(Pos.TOP_LEFT); contentBox.setAlignment(Pos.TOP_LEFT);
contentBox.setPadding(new Insets(10, 30, 10, 30)); contentBox.setPadding(new Insets(10, 30, 10, 30));
contentBox.setPrefWidth(400); // Set preferred width for wrapping contentBox.setPrefWidth(400); // Set preferred width for wrapping
contentBox.setMinHeight(60);
// Define the regex pattern to match URLs // Define the regex pattern to match URLs
String urlPattern = "(\\[https?://\\S+])"; String urlPattern = "(\\[https?://\\S+])";
@ -211,13 +212,7 @@ public class TitledDescriptionPane extends TitledPane {
Hyperlink hyperlink = new Hyperlink(url); Hyperlink hyperlink = new Hyperlink(url);
hyperlink.setMaxWidth(400); // Set maximum width for wrapping hyperlink.setMaxWidth(400); // Set maximum width for wrapping
hyperlink.setWrapText(true); // Ensure text wrapping in the hyperlink hyperlink.setWrapText(true); // Ensure text wrapping in the hyperlink
hyperlink.setOnAction(e -> { hyperlink.setOnAction(_ -> AppServices.get().getApplication().getHostServices().showDocument(url));
try {
java.awt.Desktop.getDesktop().browse(new java.net.URI(url));
} catch (Exception ex) {
// TODO: handle failure to launch link
}
});
return hyperlink; return hyperlink;
} }
} }