javafx

JavaFX WebView doesn't execute JavaScript

旧街凉风 提交于 2020-01-05 21:12:30
问题 I am on Windows 8. I have a JavaFX app that creates a simple window with a webview control and loads the local file "test.html". "test.html" contains javascript (a simple "alert("hello");<(script>"). However, the javascript is ignored. What rendering engine does webview in JavaFX use? I have Firefox and IE installed. The latter executes JS contained in local files only if the users accepts to do so. So my assumption is that webview uses IE due to some configuration of my OS. Is this possible?

How can I set a graphic for a TreeItem in FXML?

醉酒当歌 提交于 2020-01-05 19:01:43
问题 I'm trying to configure the root node of my TreeView in FXML: <TreeView fx:id="treeView" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS"> <TreeItem expanded="false" value="Root" fx:id="rootItem" graphic="/icons/icon_folder.png" /> </TreeView> There is a property called graphic which takes a Node , and not a String as I have supplied above. How do I give it a node in FXML that would represent the image stored in my resource at icons/icon_folder.png? In Java, I can do the following:

How can I set a graphic for a TreeItem in FXML?

断了今生、忘了曾经 提交于 2020-01-05 19:00:18
问题 I'm trying to configure the root node of my TreeView in FXML: <TreeView fx:id="treeView" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS"> <TreeItem expanded="false" value="Root" fx:id="rootItem" graphic="/icons/icon_folder.png" /> </TreeView> There is a property called graphic which takes a Node , and not a String as I have supplied above. How do I give it a node in FXML that would represent the image stored in my resource at icons/icon_folder.png? In Java, I can do the following:

JavaFX - Concurrency and updating label

扶醉桌前 提交于 2020-01-05 13:12:21
问题 I've got problem with these piece of code. I want to make an application, which constatnly displays randomized values in labels as long as the Toggle Button is pressed. That's what I created, it works but window after a few seconds is lagging horrible. What am I doing wrong? Here is code of class, which generate random values: public class ValueMaker{ private StringPropterty x, y, z; private Random generator; private boolean isStarted = false; private int randomizedX(){ return generator

TranslateTransition does not change (X,Y) co-ordinates

无人久伴 提交于 2020-01-05 13:07:14
问题 While learning the javafx.animation API, I tried the following code, which simply draws a rectangle at (100,100) and translates it to (200,200) in 2 seconds. import javafx.animation.TranslateTransition; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; import javafx.util.Duration; import javafx.event.ActionEvent; import

Java FX Null Pointer Exception when using Media Player at javafx.scene.media.MediaPlayer.init

末鹿安然 提交于 2020-01-05 11:34:49
问题 There are no null fields in the Media block that launch the MediaPlayer I have researched this extensively and have found nothing to explain this error. I am building a Java Swing application for a class project and am attempting to use the JFX panel and media player to host and play several mp4 videos. I have successfully got it working one time through however when I come back to the window again I run into the error. java.lang.NullPointerException at com.sun.media.jfxmediaimpl.platform

Java FX Null Pointer Exception when using Media Player at javafx.scene.media.MediaPlayer.init

风流意气都作罢 提交于 2020-01-05 11:30:08
问题 There are no null fields in the Media block that launch the MediaPlayer I have researched this extensively and have found nothing to explain this error. I am building a Java Swing application for a class project and am attempting to use the JFX panel and media player to host and play several mp4 videos. I have successfully got it working one time through however when I come back to the window again I run into the error. java.lang.NullPointerException at com.sun.media.jfxmediaimpl.platform

Wrapping a GridPane in a ScrollPane or programatically modifying it. Most efficient approach?

痞子三分冷 提交于 2020-01-05 10:32:47
问题 In a game I have a GridPane displaying the Tiles of the world in square cells. The player can, using the keyboard, move what is displayed by a column\row. The approaches I've thought of are: Having the GridPane change programmatically the displayed tiles by moving everything by x steps on player input. Wrapping the GridPane in a ScrollPane and tying the ScrollPane's scroll to Keyboard input. My question is, assuming that things that are off-sight but on the same map are always loaded, what

JavaFX print the same XYChart.Series in two charts

假如想象 提交于 2020-01-05 08:54:11
问题 Starting from this question JavaFX LineChart Hover Values I modified the Gist in the first answer https://gist.github.com/jewelsea/4681797 into this public class TestCharts extends Application { ObservableList<XYChart.Data<Integer, Integer>> _serie; @SuppressWarnings("unchecked") @Override public void start(Stage stage) { LineChart lineChart = new LineChart(new NumberAxis(), new NumberAxis()); XYChart.Series serie = new XYChart.Series( "Test", getTestValues() ); lineChart.getData().add(serie)

How to make scrolling of wide content smoooth with JavaFx?

回眸只為那壹抹淺笑 提交于 2020-01-05 08:50:52
问题 I'm developing gant chart with JavaFx. My main content is placed inside of ScrollPane. I have zoom option which is changing content width. This is performance related to content size: zoom: x1 - 2880px // smooth scrolling x2 - 5760px // smooth scrolling x3 - 8640px // smooth scrolling x4 - 11520px // bad/jumps x5 - 14410px // very bad/ not smooth at all x6 - ... // :-/ Is it possible to fix it some how? Which way to go ... I don't have any idea how to start or even is it possible to fix it :-