我想在java中做一个视觉上吸引人/用户友好的GUI.Swing在"皮肤"定制方面受到限制.我正在考虑JavaFX,但我还没有得到它,
我想以这种精神做一些事情,它建立在.NET框架之上:

原始链接:http ://www.patrickpayet.com/net/?p = 323编辑:是他们的任何入门概述示例代码,我可以阅读,以获得一般感觉需要完成的工作,以实现在截图精神?也许类似于miglayout的摇摆演示http://www.migcalendar.com/miglayout/swingdemoapp.jnlp
edit2:我发现http://download.java.net/general/openjfx/demos/tutorial.jnlp它非常基本,链接自http://www.deitel.com/ResourceCenters/Programming/JavaFX/JavaFXTutorialsandDemos/tabid/ 2187/Default.aspx的
当我将图像和文本添加到按钮时,默认情况下元素是水平设置的.如何更改此行为以获取图像下的文本?
我正在研究JavaFX应用程序,在我的场景中是显示在JavaFX中创建的密码提示,它带有两个选项的密码OK和Cancel.我已经返回了用户输入的密码.
我的密码对话框是 -
public static String showPasswordDialog(String title, String message, Stage parentStage, double w, double h) {
try {
Stage stage = new Stage();
PasswordDialogController controller = (PasswordDialogController) Utility.replaceScene("Password.fxml", stage);
passwordDialogController.init(stage, message, "/images/password.png");
if (parentStage != null) {
stage.initOwner(parentStage);
}
stage.initModality(Modality.WINDOW_MODAL);
stage.initStyle(StageStyle.UTILITY);
stage.setResizable(false);
stage.setWidth(w);
stage.setHeight(h);
stage.showAndWait();
return controller.getPassword();
} catch (Exception ex) {
return null;
}
Run Code Online (Sandbox Code Playgroud)
我的代码显示密码提示的位置如下,实际上这个提示将显示在其他UI上,所以我需要将其包含在内部Platform.runlater(),否则它会抛出Not on FX application thread.我需要这个密码提示才能显示,直到我得到正确的密码提示.如果我在runlater中显示密码,我怎样才能获得密码值.
还有其他更好的方法吗?
final String sPassword = null;
do {
Platform.runLater(new Runnable() { …Run Code Online (Sandbox Code Playgroud) 当我点击tabPane的一个标签时,我正在尝试做某些事情,我尝试过使用Action Event但它不起作用:
public void tabPressClicked (ActionEvent event){
comboBoxPresYear.setVisible(true);
lblPresYear.setVisible(true);
}
Run Code Online (Sandbox Code Playgroud)
[EDITED]
正确的方法:
tabPresentation.setOnSelectionChanged(new EventHandler<Event>() {
@Override
public void handle(Event t) {
if (tabPresentation.isSelected()) {
comboBoxPresYear.setVisible(true);
lblPresYear.setVisible(true);
}
}
});
Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用javaFX和Scene Builder,我有很多页面.我想避免复杂性,这就是我想使用Spring框架的原因.
所以,任何人都可以向我详细解释如何使用spring框架配置JavaFX?
有没有办法为一个TreeView设置两个根节点?
我发现很多例子,如果简单的TreeView,但我的情况没有有用的例子.
有没有办法在类似于ScrollPane的TableView中更改ScrollBar的策略?我只看到TableView的VirtualFlow计算可见性,但不存在手动干扰的可能性.
我需要垂直滚动条始终可见,水平从不.更改条形的可见状态不起作用.
例:
import java.time.LocalDate;
import java.time.Month;
import java.util.Set;
import javafx.application.Application;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Orientation;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.ScrollBar;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import com.sun.javafx.scene.control.skin.VirtualFlow;
public class ScrollBarInTableViewDemo extends Application {
private TableView<Data> table1 = new TableView<>(); // table with scrollbars
private TableView<Data> table2 = new TableView<>(); // table without scrollbars
private final ObservableList<Data> data =
FXCollections.observableArrayList(
new Data( LocalDate.of(2015, Month.JANUARY, 10), …Run Code Online (Sandbox Code Playgroud) 答案的示范:( 5月29日凌晨3点10分回答)
**10/7/2016** you can find the code on GitHub上
回答前的实际问题:( 5月22日19:53问)
标题可能不是太大,但我想要做的是在JavaFX中这样的事情:
例子
YouTube:
StackOverFlow(具有和自动完成):
问题: 我不需要为此编写代码.相反,我想知道如何使用JavaFX和一些想法实现这一目标.
我使用了JoséPeredaMaven方法,它在NetBeans中运行良好,但是当我尝试使用"java -jar mavenproject1-1.0-SNAPSHOT-jar-with-dependencies.jar"在外面运行时,我收到以下错误
"错误:JavaFX缺少运行时组件,并且需要运行此应用程序
"md.mavenproject1.MainApp"只是一个临时名称,而我试图解决这个问题.
我的pom文件看起来像:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>md</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mavenproject1</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>md.mavenproject1.MainApp</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>Your Organisation</name>
</organization>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11-ea+25</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11-ea+25</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>11</release>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.1.1</version>
<!-- Use newer version of ASM -->
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions> …Run Code Online (Sandbox Code Playgroud)