标签: javafx

JavaFX隐藏ScrollPane灰色边框

有没有办法在JavaFX中隐藏ScrollPane控件的灰色边框?

java javafx javafx-2

20
推荐指数
4
解决办法
1万
查看次数

ImageView上的Border-Radius和Shadow

我想在JavaFX中应用border-radius和shadow.

在CSS3中它将是:

box-shadow: rgba(0,0,0,0.8) 0 0 10px;
border-radius: 3px;
Run Code Online (Sandbox Code Playgroud)

现在我想在JavaFX中使用它,但即使是border-radius也不能在JavaFX Scene Builder中工作.这是我的问题的屏幕截图:

JavaFX截图http://rapid-img.de/images/b92e2112.jpg

在屏幕截图中,您可以看到我使用:

-fx-border-radius: 10 10 10 10;
-fx-background-radius: 10 10 10 10;
Run Code Online (Sandbox Code Playgroud)

javafx

20
推荐指数
2
解决办法
6万
查看次数

Eclipse对jfxrt.jar类的访问限制发出警告

我正在使用eclipse kepler和java SE 1.8 jdk系统库,但是当我使用任何javafx类或方法时,eclipse会发出类似的警告Access restriction: The type 'TableColumn<?,?>' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_05\jre\lib\ext\jfxrt.jar').

我已经尝试向系统库添加访问规则,以允许使用通配符访问库中的所有jar,*但警告仍然存在.我也使用maven建设项目.代码有效,但警告是唠叨,并且在我编码时影响可读性.任何帮助表示赞赏.

编辑:我也尝试@SuppressWarnings("restriction")在我的课程开头添加,但这仍然无法解决未知原因并隐藏我可能需要看到的所有其他限制警告

eclipse javafx maven java-8 eclipse-kepler

20
推荐指数
3
解决办法
2万
查看次数

加载FXML时解析"onAction"时出错

我在运行一个简单的hello world应用程序时遇到了一些问题.它抛出以下错误:

Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
    at com.sun.javafx.application.LauncherImpl$$Lambda$2/1329552164.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javafx.fxml.LoadException: Error resolving onAction='#printHello', either the event handler is not in the Namespace or there is an error in the script.
/home/willi/java/IdeaProjects/JavaFXApp/out/production/JavaFXApp/sample/sample.fxml:23

    at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
    at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:104)
    at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:606)
    at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:766)
    at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2827)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2536)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2445)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3218)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3179)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3152)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3128)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3108)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3101)
    at sample.Main.start(Main.java:13)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863) …
Run Code Online (Sandbox Code Playgroud)

java javafx javafx-8

20
推荐指数
1
解决办法
2万
查看次数

在CSS中设置TableView样式(JavaFX)

如何设置TableView中的"THIS"点?

的TableView

我的CSS代码如下:

   */*
 * Empty Stylesheet file.
 */

.root{
    -fx-background-color: #262626;
}

.table-view{
   -fx-background-color: transparent;
}

.table-view:focused{
    -fx-background-color: transparent;
}

/* Spaltenköpfe
    Struktur column-header-background -> column-header */

.table-view .column-header-background{
    -fx-background-color: linear-gradient(#131313 0%, #424141 100%);
}

.table-view .column-header-background .label{
    -fx-background-color: transparent;
    -fx-text-fill: white;
}

.table-view .column-header {
    -fx-background-color: transparent;
}

.table-view .table-cell{
    -fx-text-fill: white;
}

.table-row-cell{
    -fx-background-color: -fx-table-cell-border-color, #616161;
    -fx-background-insets: 0, 0 0 1 0;
    -fx-padding: 0.0em; /* 0 */
}

.table-row-cell:odd{
    -fx-background-color: -fx-table-cell-border-color, #424242;
    -fx-background-insets: 0, 0 0 1 0; …
Run Code Online (Sandbox Code Playgroud)

css java javafx styling tableview

20
推荐指数
1
解决办法
5万
查看次数

如何在JavaFX 8 Alert对话框中更改yes/no按钮的文本

我有这段代码:

Alert alert = 
        new Alert(AlertType.WARNING, 
            "The format for dates is year.month.day. " +
            "For example, today is " + todayToString() + ".",
             ButtonType.OK, 
             ButtonType.CANCEL);
alert.setTitle("Date format warning");
Optional<ButtonType> result = alert.showAndWait();

if (result.get() == ButtonType.OK) {
    formatGotIt = true;
}
Run Code Online (Sandbox Code Playgroud)

在上面,我要求两个标题为"是"和"否"的按钮.但是,我希望改变它们.

dialog javafx

20
推荐指数
2
解决办法
2万
查看次数

删除完成后,JavaFX将拖放目标文件夹

有关Java Oracle社区的问题(https://community.oracle.com/thread/3934986)

问题:

我已经设置了下面的代码Button,它的全名表示文件路径.所以当它Button被拖动到文件夹或桌面时(让我们说Windows),它会被用户的操作系统复制.

我想获取已完成放置的目标文件夹.

码:

button.setOnDragDetected(event -> {

        /* allow copy transfer mode */
        Dragboard db =  startDragAndDrop(TransferMode.COPY,TransferMode.LINK);

        /* put a string on dragboard */
        ClipboardContent content = new ClipboardContent();

        /*Adding a file into the ClipboardContent*/
        content.putFiles(Arrays.asList(new File(getSongPath())));

        ........//not showing this code....

        db.setContent(content);

        event.consume();

    }
Run Code Online (Sandbox Code Playgroud)

编辑:(29/09/2016)

下降完成后:

setOnDragDone(d -> {
                System.out.println(
                        "Drag Done,is drop completed?" + d.isDropCompleted() + " , is accepted?" + d.isAccepted());
                System.out.println("Accepted Mode:" + d.getAcceptedTransferMode());
                System.out.println(" Target:" + …
Run Code Online (Sandbox Code Playgroud)

java drag-and-drop javafx

20
推荐指数
1
解决办法
1161
查看次数

如何在JavaFX中从剪贴板正确获取图像?挣扎的应用程序与不挣扎的应用程序之间有什么区别?

问题

JavaFX从Windows剪贴板获取图像的默认方式,

Clipboard.getSystemClipboard().getImage();
Run Code Online (Sandbox Code Playgroud)

,似乎已损坏。

图像的透明度似乎出了点问题。设置在黑色背景上,图像看起来不错,但是设置在白色背景上,什么也没有显示。

通过将应用程序的背景从黑暗更改为明亮来显示JavaFX图像透明性问题。

您可以使用以下最小,完整,可验证的示例测试剪贴板。

环境:Windows 7,Java 8更新202

我知道的

下面,我将描述我已经知道的事情。

还有其他人问过类似的问题:

然而,没有人成为问题的核心或得到答案。

没有官方错误

我似乎在Java错误数据库中找不到与此问题有关的错误

AWT没问题

在AWT剪贴板上不会出现图像问题,但是我想要一个使用JavaFX剪贴板的解决方案。

右侧是AWT剪贴板中的图像,左侧是JavaFX剪贴板中的相同图像。

剪贴板包含多种格式

我知道Windows剪贴板包含同一事物的多个版本,只是格式不同。使用InsideClipboardFree Clipboard Viewer可以很容易地看到

InsideClipboard的屏幕快照,显示CF_DIB格式。

JavaFX Clipboard可以识别某些格式。有时,它们的名称不同。application/x-java-rawimage是Java认为的图像;在代码中,您将此称为DataFormat.IMAGE

我怀疑DIBWindows中的剪贴板格式与Java的格式匹配application/x-java-rawimage,但是在源代码中找不到这种格式的证明。

问题是广泛传播的

问题应用

对于将图像复制到剪贴板的各种应用程序,JavaFX似乎也存在相同的透明性问题:

memory clipboard javafx image bitmap

20
推荐指数
1
解决办法
374
查看次数

如何在控制器类的javafx应用程序中交换屏幕?

嘿,我在网上搜索了一段时间,但我找不到解决以下问题的方法:

在javafx中你有3个基本文件; controller-class,fxml文件和应用程序类.现在我想在控制器中做出反应点击按钮(效果非常好)并更改该点击的屏幕(你通常使用stage.setScreen()),但我没有参考舞台(你可以在应用程序类中找到).

应用程序示例:

public class JavaFXApplication4 extends Application {

@Override
public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));

    Scene scene = new Scene(root);

    stage.setScene(scene);
    stage.show();
}

/**
 * The main() method is ignored in correctly deployed JavaFX application.
 * main() serves only as fallback in case the application can not be
 * launched through deployment artifacts, e.g., in IDEs with limited FX
 * support. NetBeans ignores main().
 *
 * @param args the command line arguments
 */ …
Run Code Online (Sandbox Code Playgroud)

javafx javafx-2

19
推荐指数
2
解决办法
3万
查看次数

JavaFX css主题

是否有任何免费的,可立即使用的CSS主题来定制JavaFX应用程序的整体外观,如默认的modena.css?

很高兴在这里收集可用样式表的列表.

css user-interface themes javafx

19
推荐指数
3
解决办法
3万
查看次数