javafx

How to listen resize event of Stage in JavaFX?

风格不统一 提交于 2020-01-09 07:41:04
问题 I want to perform some functionality on resize event of form (or Scene or Stage whatever it is). But how can I detect resize event of form in JavaFX? 回答1: You can listen to the changes of the widthProperty and the heightProperty of the Stage : stage.widthProperty().addListener((obs, oldVal, newVal) -> { // Do whatever you want }); stage.heightProperty().addListener((obs, oldVal, newVal) -> { // Do whatever you want }); Note: To listen to both width and height changes, the same listener can be

How to combine scatter chart with line chart to show line of regression? JavaFX

会有一股神秘感。 提交于 2020-01-09 07:23:06
问题 I've created a scatter chart with two sets of data; the first set is the actual data (x = year and y = pence) and the second set produces the same points but for the line of regression. However the problem I'm having is that both sets of data are shown as scatter points. I want to show the first set as scatter points and have the second set on the same graph but showing as a line. I've been at it for a long time but I can't figure out a way to do this. the scatter chart code is shown on

JavaFX Exception in thread “main” java.lang.NoClassDefFoundError: javafx/application/Application

大兔子大兔子 提交于 2020-01-09 06:46:28
问题 I'm getting this error Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Ap plication at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java

What is the best way to display millions of images in Java?

十年热恋 提交于 2020-01-09 04:22:33
问题 You see that ? Each brick of each house is an image of 16x16 pixels. What you can see here a version based on simple JavaFX, with some Imageview moved on X and Y to give the effect of "construction". I just adapt this to Swing using paintComponent . The problem: - With JavaFX: my computer has trouble. What you see on the picture took 2 seconds to load and it is then moving very slow and jerky. - With Swing : I do not know how to adapt each block according to brightness, shadows, etc.. So it

How to draw 10000 circles in Random locations using JavaFX?

倾然丶 夕夏残阳落幕 提交于 2020-01-07 17:47:39
问题 I'm trying to draw 10,000 circles in JavaFX but it seems like its not working and I'm not even able to draw a single circle. Actually it trows me an error: This is the code that I currently have: public class RandomCircles extends Application { private Random randomNumbers; private int count; private final double MAX_X = 600; private final double MAX_Y = 300; private final int FINAL_CIRCLES = 10000; public void start(Stage primaryStage){ Circle initCircle = new Circle(); initCircle.setStroke

How to draw 10000 circles in Random locations using JavaFX?

本秂侑毒 提交于 2020-01-07 17:47:05
问题 I'm trying to draw 10,000 circles in JavaFX but it seems like its not working and I'm not even able to draw a single circle. Actually it trows me an error: This is the code that I currently have: public class RandomCircles extends Application { private Random randomNumbers; private int count; private final double MAX_X = 600; private final double MAX_Y = 300; private final int FINAL_CIRCLES = 10000; public void start(Stage primaryStage){ Circle initCircle = new Circle(); initCircle.setStroke

How to draw 10000 circles in Random locations using JavaFX?

梦想的初衷 提交于 2020-01-07 17:47:04
问题 I'm trying to draw 10,000 circles in JavaFX but it seems like its not working and I'm not even able to draw a single circle. Actually it trows me an error: This is the code that I currently have: public class RandomCircles extends Application { private Random randomNumbers; private int count; private final double MAX_X = 600; private final double MAX_Y = 300; private final int FINAL_CIRCLES = 10000; public void start(Stage primaryStage){ Circle initCircle = new Circle(); initCircle.setStroke

How to multi-thread in JavaFX [duplicate]

天大地大妈咪最大 提交于 2020-01-07 08:55:30
问题 This question already has answers here : How to avoid Not on FX application thread; currentThread = JavaFX Application Thread error? (7 answers) Closed 11 months ago . I have created a class called threads with a run() method that is supposed to print a rectangle. I cannot add this thread to the Pane because .add() does not accept threads. How can I successfully upload this thread onto my JavaFX screen? (The idea behind this is that each rectangle generated will be like a new monster, in

Combinate .jar library with my .jar

不打扰是莪最后的温柔 提交于 2020-01-07 08:31:54
问题 I have a project in javaFX and I'm using ControllerFX Library , the problem here in the .jar file it's necessery to keep .jar file of the library with my .jar project. is there a way to combine .jar of library with .jar of project using intellij idea ? does Maven help in this situation? (I don't know exactly what maven can do) thanks for answers 回答1: The jars that you use with your project are called as the dependent jars . You can bundle them while creating a jar of your own project.