JAVAFX 第三方库 布局 小工具 美化 测试 UI 框架 推荐
原帖地址
https://zeroturnaround.com/rebellabs/best-javafx-libraries-for-beautiful-apps-and-clean-code/
布局
MigLayout
MigLayout基于字符串以及API类型构造简单的布局,如果你经常遇到要调整几个组件之间的margin,那么它会简化你的工作。
http://miglayout.com/
如下图,使用简单的代码就可以生成如下的布局,他们白色间隙都是自动添加的
-
JPanel panel = new JPanel(new MigLayout());
-
-
panel.add(firstNameLabel);
-
panel.add(firstNameTextField);
-
panel.add(lastNameLabel, “gap unrelated”);
-
panel.add(lastNameTextField, “wrap”);
-
panel.add(addressLabel);
-
panel.add(addressTextField, “span, grow”);
小工具
Medusa
http://github.com/HanSolo/Medusa
TilesFX
https://github.com/HanSolo/tilesfx
JSilhouette
http://github.com/aalmiray/jsilhouette
JideFX
http://github.com/jidesoft/jidefx-oss
RichTextFX
http://github.com/TomasMikula/RichTextFX
JFXtras
http://jfxtras.org/
ControlsFX
http://fxexperience.com/controlsfx
Gluon Maps
http://github.com/gluonhq/maps
OrsonCharts
http://www.object-refinery.com/orsoncharts
UI
http://github.com/jfoenixadmin/JFoenix
JFoenix
http://github.com/jfoenixadmin/JFoenix
BootstrapFX
很多人都在想能不能在JAVAFX有类似Bootstrap一样的CSS库,现在BootstrapFX就符合这个需求。
使用它只需要在scene加入它即可。如下:
-
-
public class Sampler extends Application {
-
-
public void start(Stage primaryStage) throws Exception { (1)
-
Panel panel = new Panel(“This is the title”);
-
panel.getStyleClass().add(“panel-primary”); (2)
-
BorderPane content = new BorderPane();
-
content.setPadding(new Insets(20));
-
Button button = new Button(“Hello BootstrapFX”);
-
button.getStyleClass().setAll(“btn”,“btn-danger”); (2)
-
content.setCenter(button);
-
panel.setBody(content);
-
-
Scene scene = new Scene(panel);
-
scene.getStylesheets().add(“bootstrapfx.css”); (3)
-
-
primaryStage.setTitle(“BootstrapFX”);
-
primaryStage.setScene(scene);
-
primaryStage.sizeToScene();
-
primaryStage.show();
-
}
-
}
http://github.com/aalmiray/bootstrapfx
FontawesomeFX
http://bitbucket.org/Jerady/fontawesomefx
FontawesomeFX是一款基于JAVAFX的图标库。
引入:
-
<dependency>
-
<groupId>de.jensd</groupId>
-
<artifactId>fontawesomefx</artifactId>
-
<version>8.9</version>
-
</dependency>
如何在FXML下使用?
<FontAwesomeIcon name="WARNING" />
更多使用方法查看源码
Ikonli
https://aalmiray.github.io/ikonli/
测试
TestFX
https://github.com/TestFX/TestFX
构架
Afterburner.fx
http://afterburner.adam-bien.com/
JacpFX
http://jacpfx.org/
MvvmFX
http://github.com/sialcasa/mvvmFX
Griffon
http://griffon-framework.org/
Basilisk
http://github.com/basilisk-fw/basilisk