javafx

How to move items between two ListViews with change listener JavaFX

走远了吗. 提交于 2020-01-03 10:55:52
问题 I have two ListView s, allStudentsList has items already populated within it, currentStudentList has none. My aim for when the user selects an item in allStudentList is for that item be moved into currentStudentList . I have done this by placing a listener on the selection model of the allStudentList . I get an IndexOutOfBoundsException and I am not sure why this is occurring. From testing, it seems that this problem is isolated to the last 4 lines of this method yet I am not sure why.

How to programmatically simulate arrow key presses in Java FX

∥☆過路亽.° 提交于 2020-01-03 09:57:12
问题 I want to make my JFX application simulate arrow key presses (when they are registered in a TextField), but I can't figure out how to send anything other than Strings or bytes. I'm imagining something like this: static EventHandler<KeyEvent> KEY() { E = new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { if (ke.getCode().equals(KeyCode.UP)) { try { //someObject.SimulateKeyPress(KeyCode.UP); //OR //coolObject.SendKey((char)KEY_UPKEY)); } catch (Exception ex) { //Teleport

How to make ListView width fit width of its cells

旧城冷巷雨未停 提交于 2020-01-03 08:54:10
问题 I have a ListView with custom cell factory. I compute maximum over cells minWidth and set it as minWidth for entire ListView. So the ListView constrained by other regions in the layout is shrunk exactly to minWidth. But cells it holds are resized to preferred width, not minimal. As a result nodes do not fit to containing viewport and horizontal scrollbar is shown. It's nasty. I'd like to make each cell exactly fit to ListView, and get rid of scrollbar. More precise. When ListView is reduced

JavaFX combobox not refreshing the number of visible rows

左心房为你撑大大i 提交于 2020-01-03 08:45:15
问题 I'm changing the items on a combo-box dynamically. It's working perfectly, except that the number of visible rows remains fixed according to the first time the combo-box is clicked. Example: The combobox items are set to A and B. When I click the combobox, it shows 2 rows with A and B. Then I change dynamically the items to C, D and E. When I click the combobox, it shows 2 rows with C and D and a scrollbar. I already set the comboBox.setVisibleRowCount(10); but it keeps showing only 2 rows

Javafx Platform.runLater never running

六眼飞鱼酱① 提交于 2020-01-03 08:33:07
问题 I basically want to be able to launch a new Javafx window (stage) after (and inside) my LWJGL/GLFW thread starts. I am basically doing: Thread thread = new Thread(()->Platform.runLater(()->{ Stage stage = new Stage(); //Stage setup stage.show(); })); thread.start(); thread being my game thread. But it never runs and I've tried a System.out.println() inside Platform.runLater() just to check it never runs. Why does it never run and what can I do to fix it? Thanks. EDIT: Just to clarify that the

Javafx Platform.runLater never running

我是研究僧i 提交于 2020-01-03 08:32:49
问题 I basically want to be able to launch a new Javafx window (stage) after (and inside) my LWJGL/GLFW thread starts. I am basically doing: Thread thread = new Thread(()->Platform.runLater(()->{ Stage stage = new Stage(); //Stage setup stage.show(); })); thread.start(); thread being my game thread. But it never runs and I've tried a System.out.println() inside Platform.runLater() just to check it never runs. Why does it never run and what can I do to fix it? Thanks. EDIT: Just to clarify that the

javafx programmatically set arguments for virtual keyboard

人走茶凉 提交于 2020-01-03 05:36:08
问题 I have a desktop application that will be used on computers with no keyboard, input will be on a touch screen. I can get the virtual keyboard to show up on textfields fine when running from eclipse. I used these arguments -Dcom.sun.javafx.touch=true -Dcom.sun.javafx.isEmbedded=true -Dcom.sun.javafx.virtualKeyboard=none The following link shows me where to add the arguments. how to add command line parameters when running java code in Eclipse? When I make a runnable jar file the keyboard does

JavaFX : How to call the fxml files and load data into it

岁酱吖の 提交于 2020-01-03 05:16:08
问题 I am pretty new to JavaFX and I am working on a JavafX project in which I would like to load data from network into a GridPane . I am trying to figure out how I can add data which I received from the network in UI. I already have a gridpane created, and only things to load in the Pane are Name, Image. I checked some resources, but given my limited understanding in JavaFX, didn't knew what to modify for adding data in pane. Code I have : public class AccountController {

ZipException: zip END header not found in java-9

陌路散爱 提交于 2020-01-03 05:04:07
问题 util.zip.ZipException: zip END header not found exception when try to load javafx fxml view in java-9. Details My Application is a Javafx (uses fxml view ) which is built and compiled using java-8(jdk-8 64-bit) and accessed as a WebStart with jre-9(64-bit). Webpages(xhtml) are loaded and rendered in this javafx application. Also note that There are already two similar bugs reported (ie. JDK-8170276, JDK-8172872) and these two bugs mentioned that the issue is not reproducible with latest java

fill javaFX treeView from database dynamically

房东的猫 提交于 2020-01-03 04:52:06
问题 I have a table on database (code, composant, parent) where each node has a parent (a parent is also a component code), I need to fill a treeView dynamically from a select @FXML private TreeView tree;//declaration of the treeView HashMap<Integer, composant> node = new HashMap<>(); //for child nodes HashMap<Integer, composant> pere = new HashMap<>(); //for parent nodes composant c; //object from component class private void fillTree(String idSys) { String query = "SELECT * FROM composant WHERE