javafx-8

how snapshot the entire scene in javafx?

前提是你 提交于 2020-01-15 09:04:49
问题 have this fully working code but i don't know how snapshot the entire scene in JAVAFX as PNG format ? i try to export pie Chart as snapshot it work but i couldn't figure how to add another chart to be snapshot also . this is my code package javaapplication5; import java.io.File; import java.io.IOException; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.embed.swing.SwingFXUtils; import javafx.scene.Group;

Why does the compiler generate unchecked warnings when using TableColumn<S, T> rather than TableColumn<S, ?> to select a cell in a JavaFX8 TableView?

≯℡__Kan透↙ 提交于 2020-01-15 01:49:08
问题 A relative Java newbie question. I'm cleaning up my code and came across two unchecked warnings (" unchecked method invocation " and " unchecked conversion ") while programmatically selecting a cell in a TableView . I was able to resolve the warnings but don't understand what caused them. This was how I initially coded the select() : TablePosition<?, ?> previousPos; //... table.getSelectionModel().select (previousPos.getRow(), previousPos.getTableColumn()); and I resolved the warnings by

JavaFX - Accelerator not working when textfield has focus

旧巷老猫 提交于 2020-01-14 13:14:14
问题 In my application I have a screen where I use Accelerators. I'm using the function key F3 to execute an operation in my application. It works fine everytime, but when I click in any TextField on this screen the function key doesn't execute. Here is the code where I set the Accelerator: scene.getAccelerators().put( new KeyCodeCombination(KeyCode.F3), new Runnable() { @Override public void run() { // do sth here } } ); When I click my textfield and then hit the F3 function key it doesn't work.

How to format a string in a TextField without changing it's value with JavaFX

南笙酒味 提交于 2020-01-14 10:43:03
问题 I am trying to change the value of a TextField for display only. Ie - when users attempt to enter phone number, they only enter the digits and when they leave the field, it displays formatted without changing the data in the field. Let's say I have a TextField for a phone number and it should allow digits only, maximum of 10 characters: 2085551212 I can handle that with a TextFormatter using a UnaryOperator . UnaryOperator<TextFormatter.Change> filter = new UnaryOperator<TextFormatter.Change>

How to format a string in a TextField without changing it's value with JavaFX

最后都变了- 提交于 2020-01-14 10:43:00
问题 I am trying to change the value of a TextField for display only. Ie - when users attempt to enter phone number, they only enter the digits and when they leave the field, it displays formatted without changing the data in the field. Let's say I have a TextField for a phone number and it should allow digits only, maximum of 10 characters: 2085551212 I can handle that with a TextFormatter using a UnaryOperator . UnaryOperator<TextFormatter.Change> filter = new UnaryOperator<TextFormatter.Change>

Remove insets in JavaFX TitledPane with CSS not working

蹲街弑〆低调 提交于 2020-01-13 11:06:13
问题 Based on a solution of James_D (How to set/remove insets in JavaFX TitledPane) that I've tried, it seems that removing insets from a JavaFX TitledPane through CSS does not work? It does update correctly in Scene Builder, but at runtime the insets remain unchanged. Even Scenic View 8.0 reports a padding of 9.6. FXML example: <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene

Remove insets in JavaFX TitledPane with CSS not working

萝らか妹 提交于 2020-01-13 11:05:09
问题 Based on a solution of James_D (How to set/remove insets in JavaFX TitledPane) that I've tried, it seems that removing insets from a JavaFX TitledPane through CSS does not work? It does update correctly in Scene Builder, but at runtime the insets remain unchanged. Even Scenic View 8.0 reports a padding of 9.6. FXML example: <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene

ScrollPane content becomes blurry after dragging

我怕爱的太早我们不能终老 提交于 2020-01-13 10:23:13
问题 JavaFX 8.0 has this bug and I don't know how to solve it. Example: http://i.imgur.com/tavh6XA.png If I drag ScrollPane, its content becomes blurry, but if I drag it back, the content restores its sharpness. If I do not modify coords, the content looks pretty well. Did anybody solve this problem? Example code: @Override public void start(Stage stage) { Pane pane = new Pane(); Scene scene = new Scene(pane, 500, 500); pane.prefWidthProperty().bind(scene.widthProperty()); pane.prefHeightProperty(

How to work with canvas and text in javafx

两盒软妹~` 提交于 2020-01-13 06:34:28
问题 I am new to JavaFX and I am trying to display a rational number. For example for the number 5/7 I want the program to show the following: Here is the code I've tried to use in order to get the result (but it shows nothing but a blank white pane): import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx

JavaFX transparent window only receives mouse events over drawn pixels

為{幸葍}努か 提交于 2020-01-13 05:53:11
问题 I'd like a Stage that is the same size as the screen which is fully transparent and receives mouse events anywhere. In the example below I get mouse events only when the mouse is over the circle. I see this issue on both Windows XP and Windows 7 using Java 8u11 import javafx.application.Application; import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle; import javafx.scene.shape