javafx

How to load both html and javascript into webengine from loadContent()?

旧街凉风 提交于 2020-01-10 03:56:09
问题 Could someone provide some suggestions on how to load the following onto webviewer from loadContent()? http://jsbin.com/aqupun/6/edit I was trying to do something like this, but it doesn't seem to work. Thanks! Scanner sc1 = new Scanner(new File("src/web/web.html")); String webStr = sc1.useDelimiter("\\Z").next(); Scanner sc2 = new Scanner(new File("src/web/data.js")); String dataStr = sc2.useDelimiter("\\Z").next(); Scanner sc3 = new Scanner(new File("src/web/cytoscape.min.js")); String

JavaFX webview, get document height

时光总嘲笑我的痴心妄想 提交于 2020-01-10 03:07:07
问题 How can I get the document height for a webview control in JavaFx? 回答1: You can get the height of a document displayed in a WebView using the following call: webView.getEngine().executeScript( "window.getComputedStyle(document.body, null).getPropertyValue('height')" ); A complete app to demonstrate the call usage: import javafx.application.Application; import javafx.beans.value.*; import javafx.scene.Scene; import javafx.scene.web.*; import javafx.stage.Stage; import org.w3c.dom.Document;

JAVAFX ListView chatting

我怕爱的太早我们不能终老 提交于 2020-01-09 12:05:22
问题 I need to insert values in list view in one by one like chatting. now my code is @FXML private ListView<String> messageList; private ObservableList<String> messages = FXCollections.observableArrayList(); messageList.setItems(messages); 回答1: This may be similar to what you are asking. Main: import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class ChatApp extends Application { @Override

JAVAFX ListView chatting

醉酒当歌 提交于 2020-01-09 12:04:59
问题 I need to insert values in list view in one by one like chatting. now my code is @FXML private ListView<String> messageList; private ObservableList<String> messages = FXCollections.observableArrayList(); messageList.setItems(messages); 回答1: This may be similar to what you are asking. Main: import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class ChatApp extends Application { @Override

JAVAFX ListView chatting

末鹿安然 提交于 2020-01-09 12:04:44
问题 I need to insert values in list view in one by one like chatting. now my code is @FXML private ListView<String> messageList; private ObservableList<String> messages = FXCollections.observableArrayList(); messageList.setItems(messages); 回答1: This may be similar to what you are asking. Main: import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class ChatApp extends Application { @Override

Scale at pivot point in an already scaled node

孤街醉人 提交于 2020-01-09 09:05:52
问题 I'm trying to create an application with a zoomable/pannable canvas. Features : zoom in/out with mouse wheel at pivot points drag nodes around on the canvas with left mouse button drag the entire canvas with right mouse button The zooming at the pivot point works as long as you start the zooming at scale 1. Position the mouse over a grid point and scroll the mouse wheel. The pivot point will remain where you started zooming. Problem : When you zoom in, then move the mouse to another point and

Scale at pivot point in an already scaled node

不打扰是莪最后的温柔 提交于 2020-01-09 09:05:14
问题 I'm trying to create an application with a zoomable/pannable canvas. Features : zoom in/out with mouse wheel at pivot points drag nodes around on the canvas with left mouse button drag the entire canvas with right mouse button The zooming at the pivot point works as long as you start the zooming at scale 1. Position the mouse over a grid point and scroll the mouse wheel. The pivot point will remain where you started zooming. Problem : When you zoom in, then move the mouse to another point and

JavaFX - Many Static FXML Controllers

瘦欲@ 提交于 2020-01-09 07:59:05
问题 A JavaFX application exists and the application is starting from the Main.class file which extends Application : public class Main extends Application { /** * Keep a reference to the main Stage */ public static Stage stage; /** * MainScene Controller */ public static MainScene mainSceneController; /** * The Capture Window of the application */ public static CaptureWindow captureWindowController; /** * Settings Scene Controller */ public static SettingsController settingsController; @Override

Java vs JavaFX Script vs FXML. Which is better way of programming in JavaFX?

拥有回忆 提交于 2020-01-09 07:47:08
问题 I am new to JavaFX and I come across 2-3 ways of designing UI in JavaFX. Simple Java file which is same methodology we used in Swing JavaFX Script which I don't know FXML which is xml based file for UI designing Which of these is better? and why? 回答1: Just to put some light, javafx script was used prior to javafx 2.0 and is no longer in use ! You can use this approach, if you are more familiar with the coding UI in java. But, I personally dislike the approach, since it makes the code complex

IndexOutOfBoundsException while updating a ListView in JavaFX

我的未来我决定 提交于 2020-01-09 07:45:30
问题 I got a problem with an IndexOutOfBoundsException while I want to update a ListView in JavaFX. What I need to do I have a ListView with elements that correspond to a small simulation. With a click on one list-element the graphical simulation updates based on the click a element of the ListView . Afterwards the ListView needs a update and other elements will be shown. That means all old elements will be removed and only the new ones will be shown. My code looks like that: public void init() {