我读了这篇https://bugs.openjdk.java.net/browse/JDK-8102128但是我还没有在JavaFX 8的Api中找到一些东西.在TableView中有什么方法可以防止重新排序?
有谁知道如何将工具提示添加到TableView中的列标题?
有很多地方解释了如何将工具提示添加到数据单元格,但我没有找到将工具提示添加到标题的方法.
使用ScenicView工具,我可以看到标题是TableColumnHeader对象中的标签,但似乎它不是公共对象.
有什么建议 ?
何时使用翻译和重新定位以移动节点?在一天结束时,似乎他们做了同样的事情(视觉上); 移动节点; 第一个是通过对原点进行平移(x,y保持不变),第二个是通过改变x,y坐标.所以假设我想在屏幕的特定点移动一个节点..我应该使用node.relocate(x,y)还是node.setTranslateX(x),node.setTranslateY(y)?
为了说明我的意思,我制作了一个你可以玩的示例程序:屏幕上的一个矩形,其位置由4个滑块确定(其中2个控制布局x,y其他两个控制转换x,y).
/* imports are missing */
public class TransReloc extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
Group root = new Group();
Rectangle rect = new Rectangle(100, 50, Color.BLUE);
root.getChildren().add(rect);
VBox controlGroup = new VBox();
Slider relocX = new Slider(-100, 100, 0 );
Slider relocY = new Slider(-100, 100, 0 );
Slider transX = new Slider(-100, 100, 0 );
Slider transY = new Slider(-100, 100, 0 );
rect.layoutXProperty().bind(relocX.valueProperty());
rect.layoutYProperty().bind(relocY.valueProperty());
rect.translateXProperty().bind(transX.valueProperty());
rect.translateYProperty().bind(transY.valueProperty());
controlGroup.getChildren().addAll(relocX, relocY, transX, transY); …Run Code Online (Sandbox Code Playgroud) 我正在使用SceneBuilder 8.0.0和JavaFX 8.
我有一个Button btn和一个Label lbl附加到AnchorPane ap.
当应用程序启动,btn并lbl连接到ap.
如何删除其中一个节点?(我只知道删除所有节点的clear()方法
ap).谢谢.
我想在JavaFX(8)中从WebView创建SnapShot/Screenshot/Image.
这个WebView不需要是可见的(在我的例子中).
我的问题:当WebView 不可见(或未添加到任何可见容器)时,
是否可以(以任何方式)从WebView创建屏幕截图/图像?
看看我的示例代码,当WebView(或它的父ScrollPane)可见= false时,
屏幕截图将不起作用(分别是emtpy/blank).
示例代码:
package test;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.SnapshotResult;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javafx.util.Duration;
public class JavaFXApplication extends Application
{
@Override
public void start(Stage primaryStage)
{
ImageView webviewPreviewImage = new ImageView();
Label waitLabel = new Label("Please wait...");
WebView webView = new WebView();
webView.setMaxHeight(480d);
webView.setMinHeight(480d);
webView.setMaxWidth(640d); …Run Code Online (Sandbox Code Playgroud) 我已经在这里问了一个类似的问题,但似乎不清楚,因为我在项目中有很多代码而无法在此处发布所以请不要将其标记为重复.
因此,我决定创建一个新项目,其中只有一个标签,以使代码小而干净,并消除我得到的错误的其他潜在嫌疑人.
所以这是我的Java源代码
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Group root = new Group();
Label label = new Label("Sample Label");
label.setId("sampleLabel");
root.getChildren().add(label);
Scene scene = new Scene(root, 300, 275);
scene.getStylesheets().add(getClass().getResource("applicationStyles.css").toExternalForm());
primaryStage.setTitle("Hello World");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的css文件
/**/
@font-face {
font-family:'Roboto';
src:url("Roboto-Thin.ttf");
}
#sampleLabel{
-fx-font-family: Roboto ;
}
Run Code Online (Sandbox Code Playgroud)
这是我在Intellij Idea中遇到的错误
Dec 02, …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Ubuntu 20.10 上安装 OpenJDK 8 和 OpenJFX 8。
在 Ubuntu 上安装 openJFX 8 一直有点棘手,但我曾经能够使用这个 SO 答案中的提示来做到这一点:https : //stackoverflow.com/a/56166582/2423283以前工作得很好(我认为我使用的是 Ubuntu 19.something),但最近似乎已8u161-b12-1ubuntu2被删除。
有关更多背景信息,我正在通过自动化管道中的 docker 文件安装它。以下是 Dockerfile 的相关部分:
FROM my.company.internal.registry:443/ubuntu:latest
RUN apt -y update && \
apt -y install \
openjdk-8-jdk \
openjfx=8u161-b12-1ubuntu2 \
libopenjfx-java=8u161-b12-1ubuntu2 \
libopenjfx-jni=8u161-b12-1ubuntu2
Run Code Online (Sandbox Code Playgroud)
这曾经运行得很好,但现在我得到:
E: Version '8u161-b12-1ubuntu2' for 'openjfx' was not found
E: Version '8u161-b12-1ubuntu2' for 'libopenjfx-java' was not found
E: Version '8u161-b12-1ubuntu2' for 'libopenjfx-jni' was not found
Run Code Online (Sandbox Code Playgroud)
我试着改变我ubuntu:latest要ubuntu:19:10在我 …
我正在将JavaFX2应用程序移植到JavaFX8上,我注意到JavaFX8上的文本渲染得很糟糕,在JavaFX2中它们很好.请参见下面的截图.

当字体变小时,此问题非常明显.标签1使用24px,标签2和3是13px.
我试过用
System.setProperty("prism.text", "t2k");
System.setProperty("prism.lcdtext", "true");
Run Code Online (Sandbox Code Playgroud)
结果略胜一筹.我的问题是我设置错误或者JavaFX8的行为是什么?
更新:玩了更多设置后
System.setProperty("prism.lcdtext", "true");
Run Code Online (Sandbox Code Playgroud)
似乎已经"修复"了这个问题

我遇到了一个我自己无法解决的问题,因为我刚刚开始使用JAVA FX.我得到一个令人讨厌的javafx.fxml.LoadException :,但我完全像一个向导,但我不能让我的Main运行.这是异常输出:
apr 07, 2014 4:06:37 EM application.Main start
ALLVARLIG: null
javafx.fxml.LoadException:
/C:/Users/Jakob/Dropbox/java_kurser/Project%20Timeline/bin/application/LoginGUI.fxml
at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at application.Main.start(Main.java:21)
at com.sun.javafx.application.LauncherImpl$8.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$7.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$6$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(Unknown Source)
at com.sun.glass.ui.win.WinApplication$4$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: ParseError …Run Code Online (Sandbox Code Playgroud) 我想sceneBuilder用于一个javaFx应用程序.我有一个Package被调用的testPac内部,我有文件夹,如图1所示;
我有一个fxml文件,它controller在view文件夹中.现在,我不知道我必须在控制器盒内使用什么sceneBuilder.view文件夹的内容如图2所示.