Skip to content

Commit c5ad858

Browse files
feat: add ControlsFX controls (require --add-opens)
1 parent e11c662 commit c5ad858

2 files changed

Lines changed: 22 additions & 11 deletions

File tree

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ plugins {
88
}
99

1010
dependencies {
11+
// ControlsFX
12+
implementation ('org.controlsfx:controlsfx:11.0.0-RC2') {
13+
exclude group: 'org.openjfx', module: '*'
14+
}
1115

1216
// Math
1317
implementation 'com.udojava:EvalEx:2.4'
@@ -57,6 +61,12 @@ applicationName = 'hello-fx'
5761
application {
5862
// mainClassName = "com.example.hellofx.Launcher"
5963
// applicationName = 'hello-fx'
64+
applicationDefaultJvmArgs = [
65+
"--add-opens=javafx.base/com.sun.javafx.event=ALL-UNNAMED",
66+
"--add-opens=javafx.base/com.sun.javafx.collections=ALL-UNNAMED",
67+
"--add-opens=javafx.base/com.sun.javafx.runtime=ALL-UNNAMED",
68+
// XXX many more necessary depending on control
69+
]
6070
}
6171

6272
runtime {

src/main/java/com/example/hellofx/HelloFX.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.poi.xwpf.usermodel.XWPFDocument;
2525
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
2626
import org.apache.poi.xwpf.usermodel.XWPFRun;
27+
import org.controlsfx.control.HyperlinkLabel;
2728
import org.w3c.dom.Document;
2829
import org.xml.sax.SAXException;
2930
import org.xmlunit.builder.DiffBuilder;
@@ -297,20 +298,20 @@ Tab getTabControlsFX() {
297298
BorderPane bp = new BorderPane();
298299
t.setContent(bp);
299300

300-
// HyperlinkLabel hyperlinkLabel = new HyperlinkLabel("[Link]");
301-
// hyperlinkLabel.setOnAction(event -> {
302-
// Hyperlink link = (Hyperlink)event.getSource();
303-
// final String str = link == null ? "" : link.getText();
304-
// if ("Link".equals(str)) {
305-
// Project p = new Project();
306-
// p.setInformation("test");
307-
// System.out.println("Link clicked: " + p.toString());
308-
// }
309-
// });
301+
HyperlinkLabel hyperlinkLabel = new HyperlinkLabel("[Link]");
302+
hyperlinkLabel.setOnAction(event -> {
303+
Hyperlink link = (Hyperlink)event.getSource();
304+
final String str = link == null ? "" : link.getText();
305+
if ("Link".equals(str)) {
306+
Project p = new Project();
307+
p.setInformation("test");
308+
System.out.println("Link clicked: " + p.toString());
309+
}
310+
});
310311
// Center
311312
bp.setCenter(getTableView());
312313
// Bottom
313-
// bp.setBottom(hyperlinkLabel);
314+
bp.setBottom(hyperlinkLabel);
314315

315316
return t;
316317
}

0 commit comments

Comments
 (0)