Skip to content
Advertisement

Tag: javafx-2

JavaFX 2 set/get cursor position

How can I set/get the cursor’s position in JavaFX 2? I tired googling the answer but found nothing useful. All I can do is setting the cursor’s style. Answer You can use robot for that purpose: AWT robot: http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/Robot.html or glass robot: com.sun.glass.ui.Robot; which could be created with: com.sun.glass.ui.Application.GetApplication().createRobot(); To get the cursor position, see other post for this question

How to use FXMLLoader.load() – JavaFX 2

I am building a JavaFX application using the JavaFX Scene Builder. The interface was created in the Scene Builder and a FXML file (main.fxml) was created. To use the interface in my application I must load the FXML file using the FXMLLoader, but there is a problem because the load() method returns an Object, and to build a Scene I

Tab key navigation in JavaFX TextArea

How do I make hitting the Tab Key in TextArea navigates to the next control ? I could add a listener to cath de key pressed event, but how do I make te TextArea control to lose it focus (without knowing the next field in the chain to be focused) ? Answer This code traverse focus if pressing TAB and

RequestFocus in TextField doesn’t work

I use JavaFX 2.1 and I created GUI using FXML, in the controller of this GUI I added myTextField.requestFocus();. But I always get the focus in the other control. Answer At the time of initialize() controls are not yet ready to handle focus. You can try next trick: For tricky complex applications (like Pavel_K has in the comments) you may

Javafx Pane vs Region?

According to the documentation, both Region and Pane will resize any resizable child nodes to their preferred size, but will not reposition them. So i can’t see where the differencies between these …

Javafx 2.0 How-to Application.getParameters() in a Controller.java file

Considering the following sample. How to access to arguments/parameters of the application in the controller? Thank you. NB: I’ve tried to mix App.java and MyController.java in only one Class file, but didn’t help. App.java (simplified): MyController.java (simplified): MyView.fxml (simplified): Answer 1. The most straightforward way is to save them in the app: and read them in the controller: 2. A

Advertisement