javafx

How do you refresh JavaFX scene from inside an button action?

最后都变了- 提交于 2021-01-20 12:07:45
问题 I'm making a sorting algorithm visualizer and i want the UI to update in real time to show how it works, step by step. But the UI only updates when the sort() method is done, I want it to update when updateHeight() is done the sort() method is initiated by an onAction @FXML public void sort() throws InterruptedException { minHeight = RectHeight[0]; counter = 0; minIndex = 0; temp = 0; for(int i=1;i<RectList.size();i++){ System.out.println(RectList.size()); System.out.println(counter); sort2()

How do you refresh JavaFX scene from inside an button action?

泄露秘密 提交于 2021-01-20 12:06:45
问题 I'm making a sorting algorithm visualizer and i want the UI to update in real time to show how it works, step by step. But the UI only updates when the sort() method is done, I want it to update when updateHeight() is done the sort() method is initiated by an onAction @FXML public void sort() throws InterruptedException { minHeight = RectHeight[0]; counter = 0; minIndex = 0; temp = 0; for(int i=1;i<RectList.size();i++){ System.out.println(RectList.size()); System.out.println(counter); sort2()

How do you refresh JavaFX scene from inside an button action?

不羁岁月 提交于 2021-01-20 12:06:39
问题 I'm making a sorting algorithm visualizer and i want the UI to update in real time to show how it works, step by step. But the UI only updates when the sort() method is done, I want it to update when updateHeight() is done the sort() method is initiated by an onAction @FXML public void sort() throws InterruptedException { minHeight = RectHeight[0]; counter = 0; minIndex = 0; temp = 0; for(int i=1;i<RectList.size();i++){ System.out.println(RectList.size()); System.out.println(counter); sort2()

Change one color [global] color during runtime in javafx

半城伤御伤魂 提交于 2021-01-07 07:51:45
问题 As far as I understand you can define "color variables" in the css. Let's say, I have a color called "default-background-color", and I set all backgrounds to be this color. -default-background-color: #d0d0d0; [...] .button{ -fx-background-color: -default-background-color } Then, during runtime, I want to change this color to be something else, so that all backgrounds change to my new color. How is this achieved without reloading a new css file? 回答1: You can change set the style

Bindings not updating properly

[亡魂溺海] 提交于 2021-01-07 02:48:29
问题 Yet another binding issue from me. I already know that bindings are lazy, so they don't update when they don't need to, but this case is weird. The code below gives me the following output: minWidth calculation [150.0] minHeight calculation [150.0] minWidth calculation [0.0] minWidth calculation [0.0] minHeight calculation [0.0] minHeight calculation [0.0] It looks like Bindings.select() doesn't trigger binding calculation when when ClassTwo changes width or height . I think so, because when

JNI error occurred after converting jar to exe launch4j

本小妞迷上赌 提交于 2021-01-05 07:28:20
问题 I created JAR file of my JavaFX application. JAR file is working perfectly fine without any error. But when i converted jar into exe using launch4j and tried to open exe file file it gives two errors: Java Virtual Machine Launcher Error: A JNI error has occurred, please check your installation and try again. Java Virtual Machine Launcher A Java Exception has occurred. Here is the log: Exception in thread "main" java.lang.UnsupportedClassVersionError: Main has been compiled by a more recent

JNI error occurred after converting jar to exe launch4j

ぐ巨炮叔叔 提交于 2021-01-05 07:27:26
问题 I created JAR file of my JavaFX application. JAR file is working perfectly fine without any error. But when i converted jar into exe using launch4j and tried to open exe file file it gives two errors: Java Virtual Machine Launcher Error: A JNI error has occurred, please check your installation and try again. Java Virtual Machine Launcher A Java Exception has occurred. Here is the log: Exception in thread "main" java.lang.UnsupportedClassVersionError: Main has been compiled by a more recent

JavaFX Image from resources folder

一曲冷凌霜 提交于 2021-01-03 12:31:18
问题 For some reason I keep getting an NPE in a gradle javafx project. My folder structure is very basic. I have a package with my java files in the main/java folder. I also have my resources in the main/resources folder. When I try to load image.png it gives me an NPE. public static Image createImage(Object context, String url) { Image m = null; InputStream str = null; URL _url = context.getClass().getResource(url); try { m = new Image(_url.getPath()); } catch (NullPointerException e) { e

JavaFX Image from resources folder

不想你离开。 提交于 2021-01-03 12:30:59
问题 For some reason I keep getting an NPE in a gradle javafx project. My folder structure is very basic. I have a package with my java files in the main/java folder. I also have my resources in the main/resources folder. When I try to load image.png it gives me an NPE. public static Image createImage(Object context, String url) { Image m = null; InputStream str = null; URL _url = context.getClass().getResource(url); try { m = new Image(_url.getPath()); } catch (NullPointerException e) { e

JavaFX Image from resources folder

喜夏-厌秋 提交于 2021-01-03 12:30:00
问题 For some reason I keep getting an NPE in a gradle javafx project. My folder structure is very basic. I have a package with my java files in the main/java folder. I also have my resources in the main/resources folder. When I try to load image.png it gives me an NPE. public static Image createImage(Object context, String url) { Image m = null; InputStream str = null; URL _url = context.getClass().getResource(url); try { m = new Image(_url.getPath()); } catch (NullPointerException e) { e