javafx

FXML - Text Field Moves To The Right Upon Button Click

狂风中的少年 提交于 2019-12-25 04:51:34
问题 I am trying to make a program about managing reservations in a restaurant, but I have an enduring glitch that I have not been able to fix so far. Look at these pieces of code: Customer.fxml <?xml version="1.0" encoding="UTF-8"?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> <GridPane xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10" prefWidth="300" prefHeight="300"> <padding> <Insets top=

RxJava + JavaFX Property

回眸只為那壹抹淺笑 提交于 2019-12-25 04:42:45
问题 I have a method called rxToProperty() that turns an Observable into a JavaFX Property . public static <T> ReadOnlyObjectProperty<T> rxToProperty(Observable<T> obs) { ReadOnlyObjectWrapper<T> property = new ReadOnlyObjectWrapper<>(); obs.onBackpressureLatest().serialize().subscribe(v -> { synchronized(property) { property.set(v); } }); return property.getReadOnlyProperty(); } How do I ensure that the returned Property is always up-to-date especially when it is bound to controls in JavaFX? I

JavaFX TextArea with listener gives: “java.lang.IllegalArgumentException: The start must be <= the end”

旧街凉风 提交于 2019-12-25 04:42:12
问题 I am getting the exception when trying to change text in the text property listener. The exception is exactly the same is this question. I used TextArea instead of TextField, but I think the source of the bug is the same. It's in the "TextInputControl.java". It seems to be Java 8's bug. @FXML private TextArea ta; ta.setText("12-"); // pre-set text ta.textProperty().addListener((observable, oldValue, newValue) -> { ta.setText("1"); // changed text }); This causes the exception on my machine. I

DataFormatException: incorrect header check in java.util.zip.InflaterInputStream

白昼怎懂夜的黑 提交于 2019-12-25 04:28:09
问题 I use javafx WebView in my project and it began crash at one website. Through debug i understood, that when page receives part of js-code server uses header "Content-Encoding:deflate", ignoring my request headers. Main problem in inflate method of InflaterInputStream. java.util.zip.ZipException: incorrect header check at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164) I reproduced this error in simple method: public byte[] makeTestRequest(String url) throws Exception {

How to populate TableView from list of String[] in javaFX?

只谈情不闲聊 提交于 2019-12-25 04:12:19
问题 I'm trying to dynamically populate a TableView with arrays of strings taht I have inside of a list (I guess there are better ways to handle information, but its is what I was given to do...), so I create a tableView, create all the columns and stuff, but I'm lost at the moment of populating the tableview. The list has all the string arrays inside and everything seems to work, there is no missplaced data on any array or anything like that, and when I run the project, the column names appear as

How to get ScrollPane max vvalue

与世无争的帅哥 提交于 2019-12-25 04:11:40
问题 I can get current vvalue with following code: s1.vvalueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { println("s1.vvalue:${s1.vvalue.inspect()}") System.out.println(new_val.intValue()); } }); How to listen ScrollPane is scrolled to the end?(how to get max vvalue?) 回答1: Much better than hard-coding 1.0 , call ScrollPane.getVMax() . If the value changes in the future, your application might not

Why is my Thread making my JavaFX Application lag?

旧城冷巷雨未停 提交于 2019-12-25 03:55:31
问题 I'm trying to make an JavaFX application that tracks the movement of my mouse for this im using this code in the controller class: new Thread(new Runnable() { @Override public void run() { while (Main.running) { Platform.runLater(new Runnable() { @Override public void run() { try { label.setText(MouseInfo.getPointerInfo().getLocation().toString()); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } }).start(); But it couses my application to lag big time.

JavaFX borderpane.setCenter replaces entire scene

↘锁芯ラ 提交于 2019-12-25 03:39:53
问题 I'm trying to load a FXML into a FXML. The main FXML has a borderpane, and the second contains a VBox. I load both of these with the FXMLLoader. When I try to set the center of the boarderpane, the entire screen gets replaced with the second FXML. Here is the code BorderPane riskAnalysis = new BorderPane((BorderPane) FXMLLoader.load(getClass().getResource("./proposaldevelopment/riskAnalysis.fxml"))); VBox center = new VBox((VBox) FXMLLoader.load(getClass().getResource("./proposaldevelopment

How to set style for first level child in treetableview

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 03:37:18
问题 I want to set the top border just for all the first child so that for one child the data looks in one row. but I'm unable to set the id for those rows. I tried the following code but it didn't help. final PseudoClass firstRowClass = PseudoClass.getPseudoClass("first-child"); devWorkTabBenchtable.setRowFactory(new Callback<TreeTableView<DevWorkTabBench>, TreeTableRow<DevWorkTabBench>>() { @Override public TreeTableRow<DevWorkTabBench> call(TreeTableView<DevWorkTabBench> param) { TreeTableRow

how to generate button(picture) based on checkboxes selection in javafx

五迷三道 提交于 2019-12-25 03:16:13
问题 My question is how to generate buttons, set with car pictures, based on the checkboxes and/or radio buttons selected by a user in javafx? I'm simulating a car dealership website with car pictures. The user should be able to filter the pictures displayed by clicking checkboxes and/or radio buttons selection. I'm first creating all the picture buttons with a for each loop. I could use if and if/else statements to filter through the pictures but there would be duplicates. I've heard of