javafx-2

Is there a way to detect if Java FX is using hardware acceleration?

。_饼干妹妹 提交于 2020-01-01 12:10:37
问题 And related to that, is there a way to force Java FX to use hardware acceleration and bomb if it is unable to? 回答1: Just found out: You can run with -Dprism.verbose=true which will print what graphics pipeline it uses. "sw" or "j2d" for software and "d3d" or "es2" for hardware accelerated. 回答2: You can also try this hack @SuppressWarnings("restriction") static String getCurrentGraphicsPipeline() { return com.sun.prism.GraphicsPipeline.getPipeline().getClass().getName(); } If you get back "com

Is there a way to detect if Java FX is using hardware acceleration?

南楼画角 提交于 2020-01-01 12:10:09
问题 And related to that, is there a way to force Java FX to use hardware acceleration and bomb if it is unable to? 回答1: Just found out: You can run with -Dprism.verbose=true which will print what graphics pipeline it uses. "sw" or "j2d" for software and "d3d" or "es2" for hardware accelerated. 回答2: You can also try this hack @SuppressWarnings("restriction") static String getCurrentGraphicsPipeline() { return com.sun.prism.GraphicsPipeline.getPipeline().getClass().getName(); } If you get back "com

JavaFx - How to display SimpleStringProperty value in TableView

梦想与她 提交于 2020-01-01 12:05:57
问题 I am busy working through a tutorial and am stuck on one point. Basically launch new scene and display values from ObservableList of type Person in a table view. The person class consists of 3 SimpleStringProperty’s firsName, lastName and email. But when I run the app it seems to display the values of the SimpleStringProperty [StringProperty [value:actualvalue]] in the table and not the value of the SimpleStringProperty. If I change the Person’s class getFirstName method to return a String

Associating FXML and Controller in Guice's Module configuration

那年仲夏 提交于 2020-01-01 10:47:49
问题 In my Guice Module I want to associate FXML files and their controllers, currently it looks like this: public class GuiceModule extends AbstractModule { @Override protected void configure() { // associate controllers and fxml files bind(MainController.class).toInstance((MainController)loadController("/main.fxml")); bind(SubController.class).toInstance((SubController)loadController("/content.fxml")); } protected Object loadController(String url) { InputStream fxmlStream = null; try {

combobox jump to typed char

我怕爱的太早我们不能终老 提交于 2020-01-01 10:27:32
问题 I stumbled on (in my eyes) a silly problem. However I don't find a solution for this (maybe because of not using the right search keywords, or by making it too difficult when it can be easy..) Scenario: I have a combobox with 500 customers. I have to select a single costumer. In Swing, when the list was down and you started typing, it automatically jumps to the typed letter. E.g.: Items: Adam Dirk Freddy ... Roger Steven Z person When the combobox list is open, I just type 'R' and, in swing,

JavaFX : Use a Thread more than once

二次信任 提交于 2020-01-01 08:40:10
问题 I'm new with JavaFX and I've a little problem with a thread: I can execute it twice and I can't find why. Here is a sum-upt of my code: Task<Void> task = new Task<Void>() { @Override public Void call() throws ImageLoadedException, HomographyException, IOException { try{ System.out.println("GO !"); return null; } catch (Exception e){ e.printStackTrace(); } return null; } @Override protected void succeeded() { super.succeeded(); System.out.println("SUCCEEDED"); } }; @FXML protected void launch

How do I get the close event of a stage in JavaFX?

落爺英雄遲暮 提交于 2020-01-01 08:02:37
问题 In JavaFX, how can I get the event if a user clicks the Close Button(X) (right most top cross) a stage? I want my application to print a debug message when the window is closed. ( System.out.println("Application Close by click to Close Button(X)") ) @Override public void start(Stage primaryStage) { StackPane root = new StackPane(); root.getChildren().add(btn); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Hello World!"); primaryStage.setScene(scene); primaryStage.show(); //

How to detect keys

孤街醉人 提交于 2020-01-01 06:11:35
问题 I want to create table in which I want to configure hot key shortcuts. I have this simple table: public static final String Column1MapKey = "A"; public static final String Column2MapKey = "B"; private ObservableList<Map> generateDataInMap() { int max = 110; ObservableList<Map> allData = FXCollections.observableArrayList(); for (int i = 1; i < max; i++) { Map<String, String> dataRow = new HashMap<>(); String value1 = "A" + i; String value2 = "B" + i; dataRow.put(Column1MapKey, value1); dataRow

How to detect keys

微笑、不失礼 提交于 2020-01-01 06:11:11
问题 I want to create table in which I want to configure hot key shortcuts. I have this simple table: public static final String Column1MapKey = "A"; public static final String Column2MapKey = "B"; private ObservableList<Map> generateDataInMap() { int max = 110; ObservableList<Map> allData = FXCollections.observableArrayList(); for (int i = 1; i < max; i++) { Map<String, String> dataRow = new HashMap<>(); String value1 = "A" + i; String value2 = "B" + i; dataRow.put(Column1MapKey, value1); dataRow

JavaFX Tab positioning on mouse drag/drop

不羁的心 提交于 2020-01-01 05:20:11
问题 I have a Tabpane with multiple tabs. I want to re-position tabs by just dragging them at a particular position(just like the way we are able to arrange tabs in browser.) Is there any way i can achieve it? 回答1: We achieved it in a slightly different way.Instead of drag/drop feature we provided the move left/move right functionality on tab context menu which in turns moves the tab. We wanted to have this feature on priority so implemented it with this workaround for now. Code snippet for