javafx-8

Hot to update dynamically font size

人盡茶涼 提交于 2019-12-11 02:12:55
问题 I have this css file which sets the default font size and type in JavaFX application: .root { -fx-font: 13px Tahoma; } scene.getStylesheets().add(getClass().getResource("/styles/Styles.css").toExternalForm()); I want to update the size and the font type from the Java code dynamically of the root component (all components). How I can do this? Note: This code updates the Font type and size of all components into the JavaFX application. 回答1: Please consider taking a look at the official JavaFX

Long running and blocking javafx task progress bar update

我只是一个虾纸丫 提交于 2019-12-11 02:07:53
问题 I have a task that can be long running, and it's blocking. I must wait for this task to complete to display results on the GUI. I know how long this task will take, so I want to notify user with a progress bar, how much time is left. All the examples on the internet are like this: Task<Integer> task = new Task<Integer>() { @Override protected Integer call() throws Exception { int iterations; for (iterations = 0; iterations < 1000; iterations++) { updateProgress(iterations, 1000); // Now block

Setting the tab spacing/size visualization for a JavaFX TextArea

帅比萌擦擦* 提交于 2019-12-11 02:04:21
问题 I am using JavaFX 8 and specifically the TextArea control. In that control I can enter free form text including "tab" characters. When I enter a tab, the data is spaced in units of 8 characters. For example. In the following, the ! character is where I enter a tab: 1234567890123456789012345678901234567890 ! Data here ABC! Data here !! Data Here My puzzle is how to change the tab spacing/sizing for the visual so that instead of the tab size being 8 characters it will only be 4 characters. To

In JavaFX, is binding an alternative to action-listener?

前提是你 提交于 2019-12-11 01:59:54
问题 I was wondering if in JavaFX, binding can be an alternative to action listener/events ? Can we handle all actions with binding instead of event handling ? 回答1: No, binding is not an alternative to event handlers. You could bind event properties to different event handlers, but then you would be using both technologies, not one or the other. Generally you use binding for synchronizing data values and event handlers for running code on some event. As an alternative to a bind call to set the

Unexpected ArrayIndexOutOfBoundsException in JavaFX application, refering to no array

こ雲淡風輕ζ 提交于 2019-12-11 01:31:42
问题 I have the following code: public void setContent(Importer3D importer) { if (DEBUG) { System.out.println("Initialization of Mesh's arrays"); } coords = importer.getCoords(); texCoords = importer.getTexCoords(); faces = importer.getFaces(); if (DEBUG) { System.out.println("Applying Mesh's arrays"); } mesh = new TriangleMesh(); mesh.getPoints().setAll(coords); mesh.getTexCoords().setAll(texCoords); mesh.getFaces().setAll(faces); if (DEBUG) { System.out.println("Initialization of the material");

How to check and uncheck all items when checking or unckeck some of the items

蓝咒 提交于 2019-12-11 00:34:16
问题 JavaFX CheckComboBox How to check and uncheck all items when checking or unckeck some of the items. Check all when ckeck item All Uncheck all when unckeck item All ObservableList<String> list = FXCollections.observableArrayList("All","Item 1", "Item 2", "Item 3", "Item 4"); checkBoxCombo.getItems().addAll(list); checkBoxCombo.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() { public void onChanged(ListChangeListener.Change<? extends String> c) { if(checkBoxCombo

Set maximum size for JavaFX ImageView

一世执手 提交于 2019-12-10 23:43:13
问题 I resize the image view according to the scene but image keep resizing even if the scene is bigger than image original size. I have set ImageView.maxWidth(originalImageWidth) but it did not work. I resize the ImageView by binding it's size to the the scene size. 回答1: This would work Pane root = new VBox(); //or other Pane sub-class ImageView bg = new ImageView(...); bg.setPreserveRatio(false); bg.fitWidthProperty().bind(root.widthProperty()); bg.fitHeightProperty().bind(root.heightProperty())

JavaFX Swing Browser Very Slow

喜夏-厌秋 提交于 2019-12-10 23:36:08
问题 I'm trying to call something like a JFrame to authenticate a user using O-Auth. I implemented all background need for authentication, tested with default browing calling: Desktop.getDesktop().browse(java.net.URI.create(url)); Using the default browser everythings work as it shoud. Then I tried to create my owh webview to call within my application. Looking around I found the oracle implementation Oracle JavaFX+Swing example. The Oracle implementation works but is very slow. I copied and

Why does JavaFX add extra spacing between letters when using the Text component and how do I fix it?

给你一囗甜甜゛ 提交于 2019-12-10 23:14:17
问题 I'm trying to use the text component of JavaFX to do some nice headline typography in my application. How ever the letters in the text are not spaced evenly. For example in the word " visiting ", the " iting " part seems disconnected from the first part. In the sample image I'm using Arial but this kind of bad spacing happens with every font I tried. This only happens when "gray" anti-aliasing is used ( -fx-font-smoothing-type: gray; ). One obvious solution would be to change -fx-font

JavafX 8 3D Z Order. Overlapping shape behaviour is wrong.

给你一囗甜甜゛ 提交于 2019-12-10 21:54:50
问题 I have a JavaFX 3D scene with a bunch of boxes and spheres added at random locations. It seems like the depth order is all wrong and I'm not sure why. I have tried to use myNode.setDepthTest(DepthTest.ENABLE) but that doesn't seem to help. I've attached an application which should demonstrate the problem. Any idea what I might be doing wrong here? Any help much appreciated. import javafx.application.Application; import javafx.application.ConditionalFeature; import javafx.application.Platform;