javafx

Java FX : How to call method from controller to another controller [closed]

天大地大妈咪最大 提交于 2020-07-31 06:06:31
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 13 hours ago . Improve this question I woudlike to call method from another controller to enable/disable some Toggle Button. Dashboard_controller : // ENABLE BUTTON // public void setEnableBtn1() { btn1.setDisable(false); } public void setDisableBtn1() { btn1.setDisable(true); } My another controller : private

Error: Java FX Packager: Can not build artifact - fx: deploy is not available in this JDK

被刻印的时光 ゝ 提交于 2020-07-30 04:29:30
问题 I have since 3 months problems with my javafx application, the problem is that I can't build my javafx application. When I build this error occurs: Error: Java FX Packager: Can not build artifact - fx: deploy is not available in this JDK I am using Java SE 14.0.1. My steps: create JavaFX add Java SE 14.0.1 as JDK add artifact build How can I fix the error? I want my javafx application to be runnable on mac, windows and linux. Is there a way to do this? 回答1: This error message is pretty clear,

How to display only the filename in a JavaFX TreeView?

你说的曾经没有我的故事 提交于 2020-07-30 04:20:16
问题 So i have figured out how to get all the files and directories and add them to the treeview but it shows me the complete file path: C/user/file.txt i just want the file or folder name and not the path. The code to create the list is as follows: private TreeItem<File> buildFileSys(File dir, TreeItem<File> parent){ TreeItem<File> root = new TreeItem<>(dir); root.setExpanded(false); File[] files = dir.listFiles(); for (File file : files) { if (file.isDirectory()) { buildFileSys(file,root); }

javafx HBox中三个控件位置实验

雨燕双飞 提交于 2020-07-29 11:35:30
javafx的fxml做实验: <VBox alignment="CENTER" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"> 随窗体尺寸变化而适应 <children> <Label text="Label" /> <HBox spacing="5.0"> hbox中的三个子控件label/passwordfiled/label的间距为5.0 <children> <Label mnemonicParsing="false" text="leftg" wrapText="true" HBox.hgrow="SOMETIMES"> wraptext=true表示可以有多行显示 hbox.ghrow=sometimes表示窗体尺寸变化时在其它控件没有always(总是变化)变化之后的情况下,有多余的空间就跟随变化 <HBox.margin> <Insets right="10.0" /> 这个label的外围与其它控件之间留有10.0的空隙间距 </HBox.margin></Label> <PasswordField HBox.hgrow="ALWAYS" />当窗体尺寸变化时这个控件总是首先变化点有相应的空间 <Label alignment="CENTER_RIGHT" mnemonicParsing=

【50】Kotlin的应用场景

两盒软妹~` 提交于 2020-07-29 05:25:52
Kotlin Script 后缀kts -gradle脚本。 java 虚拟机应用 -web应用,完美支持 -JavaFx,完美支持 前端开发 -1.1开始正式支持Kotlin-javaScript android 应用开发 -Kotlin目前的主要战场 Native 程序 -直接编译Kotllin代码为机器码,不依赖Jvm -支持与c代码交互 -技术预览版功能有限,前途无量。 来源: oschina 链接: https://my.oschina.net/u/4340449/blog/4321555

javafx内部控件自动拉伸设置

北战南征 提交于 2020-07-28 22:09:48
1、使用HBOX和VBox包含控件,这样内部控件就有VGrow和HGrow属性,就可以进行自动拉伸的设置。 2、AnchorPane控件包含的内部控件可以使用AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"让内部控件拉伸到外部控件。 <AnchorPane fx:id="anchorpane" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="641.0" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.joe.readwritemacs.controller.WriteReadMacViewController"> <children> <VBox fx:id="vbox" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="52.0" prefWidth=

running JavaFX application after jpackage

微笑、不失礼 提交于 2020-07-28 04:15:10
问题 I have some really noob question. I tried to create installation for my test app with jpackage in OpenJDK 14. Here is what I did: first, created custom JRE with jlink --module-path "C:\Java\javafx-sdk-14\lib" --add-modules javafx.controls,javafx.fxml --output hello\myjre and that was successful. I copied arguments from my Eclipse from Run Configurations. After that made installation with jpackage jpackage --name HelloFX --input hello --main-jar HelloFX.jar --runtime-image hello\myjre That

JavaFx HBox VBox 布局利用Priority实现布局自适应

ⅰ亾dé卋堺 提交于 2020-07-28 04:01:26
一:相关类和方法 1: javafx.scene.layout.Priority,一个枚举类,用于确定给定节点的增长(或缩小)优先级。比如:一个HBox布局,里面有三个控件,当屏幕宽度是800时,刚好把屏幕占满,但是当屏幕扩大到1200时,这个Priority规定了这三个控件如何处理增加的400宽度。共有三个取值: ALWAYS:布局区域将始终尝试增长(或缩小),共享那些空间; SOMETIMES:如果没有控件设置为ALWAYS,或者其它控件没有处理完变化的控件,设置为SOMETIMES的控件将和其它控件分享这些区域。 NEVER:控件不会参与处理变化的空间。 2. HBox.setHgrow(Node child, Priority value),HBox.getHgrow(Node child); VBox.setVgrow(Node child, Priority value),VBox.getVgrow(Node child); 3. 注意事项 如果HBox里面所有的控件都设置成ALWAYS,那么这些控件需要设置maxWidth="Infinity",否则会不起作用。 二:实例 1. main.xml <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.text.*?> <?import javafx

IDEA通过Maven打包JavaFX工程(OpenJFX11)

元气小坏坏 提交于 2020-07-27 14:49:24
1 概述 最近研究JFX,写出来了但是打包不了,这。。。尴尬。。。 IDEA的文档 说只支持Java8打成jar包: 尝试过直接使用Maven插件的package,不行,也尝试过Build Artifacts,也不行,各种奇奇怪怪的问题。包括下图中的 Error....fx:deploy is not available in this JDK 不过幸好文档末尾提到可以使用一些 第三方工具 : 因此记录一下使用IDEA打包JFX11工程的过程。 2 环境 IDEA 2020.1 OpenJDK 11 OpenJFX 11 只需安装IDEA与JDK即可,JFX可以在pom.xml中引入。 3 创建工程 选择Maven,选择Create from archetype,然后Add Archetype并填上GroupId: org.openjfx 与ArtifactId: javafx-maven-archetypes 还有version: 0.0.1 下一步自定义,这里为了方便就直接默认了。 然后修改archetypeArtifactId为 javafx-archetype-fxml 完成即可。 4 检查文件 Maven同步完后,检查项目目录下的module-info.java与pom.xml,其中pom.xml不应该是下图这样的: 而应该是这样的,包含了javafx

JavaFX获取屏幕尺寸

断了今生、忘了曾经 提交于 2020-07-27 08:20:50
1 awt Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); double width = screenSize.getWidth(); double height = screenSize.getHeight(); 2 javafx Rectangle2D screenRectangle = Screen.getPrimary().getBounds(); double width = screenRectangle.getWidth(); double height = screenRectangle.getHeight(); 来源: oschina 链接: https://my.oschina.net/u/4231975/blog/4296578