javafx

class is not public in my package and cannot be accessed from outside package

柔情痞子 提交于 2021-02-11 16:57:54
问题 I am using the following ControlFX project. Hence, created a Dialogs.java class in my package and pasted the code from there. Since I am not Inside the package org.controlsfx.dialog , I have to do the following: import org.controlsfx.dialog.LightweightDialog; And I am getting the following error as shown in the image below: When I went inside the package org.controlsfx.dialog and opened, LightweightDialog.class , I wasn't able to make the class public. How should I overcome this situation?

JavaFX setOnEndOfMedia on next MediaPlayer

断了今生、忘了曾经 提交于 2021-02-11 15:37:32
问题 I have List<MediaPlayer> that is populating by private List<MediaPlayer> players() { for (String file : path.list((dir1, name) -> { if (name.endsWith(SUPPORTED_VIDEO_FILE_EXTENSIONS)){ return true; } return false; })) { players.add(createPlayer(Paths.get(path + "/" + file).toUri().toString())); System.out.println(Paths.get(path + "/" + file).toUri().toString()); } return players; } In my case size of List<MediaPlayer> is 3. Than i use it there if (currentNumOfVideo == -1) { currentNumOfVideo

JavaFX - How to select one shape to do animation?

独自空忆成欢 提交于 2021-02-11 15:35:59
问题 I have the following circle and I can play animation on it: Suppose I want to add another shape, such as a rectangle. How I can select between the shapes (circle/rectangle) through a mouse-click to do the animation on the shape being selected. Could someone please give me some guidelines/examples as to how I would go about this. Thank you! Program Code: import javafx.animation.PathTransition; import javafx.application.Application; import static javafx.application.Application.launch; import

How to fix NSInternalInconsistencyException in TornadoFX when running on macOS 10.14?

两盒软妹~` 提交于 2021-02-11 15:19:33
问题 I'm using TornadoFX and I've recently upgraded to macOS 10.14. The problem is that I get this error whenever I open a dialog and focus another application window: 2019-01-23 13:32:31.270 java[9369:78410] *** Assertion failure in -[NSEvent _initWithCGEvent:eventRef:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1671.20.108/AppKit.subproj/NSEvent.m:1969 2019-01-23 13:32:46.218 java[9369:78410] unrecognized type is 4294967295 2019-01-23 13:32:46.218 java[9369:78410] ***

Can't load javaFX Image

我只是一个虾纸丫 提交于 2021-02-11 15:11:08
问题 I'm having some troubles to load images in javaFX from the controller. I put some images in the src/ folder and even in a folder img/ but still getting "Invalid URL or resource not found". My directory is like src/ package/ javaFXcontroller.java img/ image.png So I'm doing Image img = new Image("./img/image.png"); But I can't retrieve the image "java.lang.IllegalArgumentException: Invalid URL or resource not found" Thanks for your help 回答1: For those who may encounter the same problem, just

Can't load javaFX Image

左心房为你撑大大i 提交于 2021-02-11 15:07:37
问题 I'm having some troubles to load images in javaFX from the controller. I put some images in the src/ folder and even in a folder img/ but still getting "Invalid URL or resource not found". My directory is like src/ package/ javaFXcontroller.java img/ image.png So I'm doing Image img = new Image("./img/image.png"); But I can't retrieve the image "java.lang.IllegalArgumentException: Invalid URL or resource not found" Thanks for your help 回答1: For those who may encounter the same problem, just

Delay between Preloader and Stage shown

别等时光非礼了梦想. 提交于 2021-02-11 12:52:24
问题 I have a program that uses a simple preloader while the init() method creates the main gui. Everything works fine but after the init() method completes and the preloader disappears, there's a noticeable delay before the main stage shows up. I say noticeable because it can be as much as 7 seconds, enough for a user to get confused. I tried to put as little as possible in the start() method: public void start(Stage stage) { /*Scene*/ scene = new Scene(root, 1200, 700); stage.setScene(scene);

Unable to control elements of another fxml file through another controller

99封情书 提交于 2021-02-11 12:29:05
问题 I am working on a project which deals with multiple fxml and corresponding controller files. I need to somehow get access to an fxml element defined in say A.fxml from the controller of B.fxml and use it. I am not allowed to show the actual code. However, for this purpose, I have built a simple application with two FXMLs and their corresponding controllers. This application has Button.fxml with ButtonController.java and ProgressIndicator.fxml with ProgressIndicatorController.java Upon

JAVAFX media : Serious optimization problem

浪子不回头ぞ 提交于 2021-02-11 12:15:51
问题 the program is a system that shows media: images, videos and keeps alternating between them. the problem is the use of increasing memory: after the programming running for 30 minutes, it consumes 1.2gb of ram I do not have much idea of what I can do, I believe that the reason for the increasing memory consumption would be recursion (the function calls itself) or the fact that every time it gives a picture it creates a thread, and when it video it uses the technically 'correct' which is a

JavaFX:how to resize the stage when using webview

依然范特西╮ 提交于 2021-02-11 09:58:13
问题 for example: public class WebViewTest extends Application { @Override public void start(Stage primaryStage) throws Exception { final WebView view = new WebView(); final WebEngine webEngine = view.getEngine(); Scene scene = new Scene(view, 600, 600); primaryStage.setScene(scene); primaryStage.show(); Platform.runLater(() -> { webEngine.getLoadWorker().progressProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number