javafx-8

JavaFX - DatePicker always returns null

亡梦爱人 提交于 2019-12-12 19:33:35
问题 DatePicker is not updating after change date. I was looking for an answer and i found this topic: JavaFX datepicker not updating value , but it doesn't work. My listener for DatePicker: public void datePickerListener() { this.datePicker = new DatePicker(); this.datePicker.setShowWeekNumbers(false); this.datePicker.setOnAction(event -> { LocalDate date = this.datePicker.getValue(); System.out.println("Selected date: " + date); }); } Additionally I tried get data without listener like: public

ScrollPane jumps to top when deleting nodes

旧城冷巷雨未停 提交于 2019-12-12 19:04:01
问题 I have an ScrollPane containing a TilePane which shows images. Whenever I delete one of those images the ScrollPane jumps back to the top which is quite annoying when trying to remove multiple images. Is there a way to control the scrolling behaviour? I'm running this code on Windows 7: import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ScrollPane;

Javafx tableview items prevent duplicates

六眼飞鱼酱① 提交于 2019-12-12 18:30:09
问题 I'm using javafx tableview with observableList list, I tried to prevent list from holding duplicate items. After doing some search, i figure out that an observableSet can do this job by overidding thoes methodes:equals() and hashcode(). But the problem that javaFX tableview can't hold an observable set: tableView.setItems(FXCollections.observableSet(new hashSet<T>()); I also planned to calculate the some for a columns in my tableview so, i need // After change in element T the total will

track changes of nodes bound in JavaFX

我只是一个虾纸丫 提交于 2019-12-12 17:58:19
问题 I need to track changes in absolute position and size of a node in javafx.Any change that is caused by resizing window or user manipulation,... node.boundsInLocalProperty().addListener(new ChangeListener<Bounds>() { @Override public void changed(ObservableValue<? extends Bounds> observable,Bounds oldValue, Bounds newValue) { System.err.println("Changed!"); } }); node.boundsInParentProperty().addListener(new ChangeListener<Bounds>() { @Override public void changed(ObservableValue<? extends

JavaFX get access to a Tab or TabPane from a TabContent(Node)

孤街醉人 提交于 2019-12-12 17:20:20
问题 Is there a way to get a reference to Tab or TabPane without no improvised way if you have reference to only the Node inside the Tab for eg TabPane tabPane = new TabPane(); Tab tab = new Tab(); tab.setText("new tab"); Rectangle drect = new Rectangle(200,200, Color.LIGHTSTEELBLUE); tab.setContent(drect); tabPane.getTabs().addAll(tab,new Tab("tab 2")); assume i only have reference to drect how can i get tab . I am not interested in Node.setUserData() also drect.getParent().getClass().getName()

Missing OpenFilesEvent for JavaFX on Mac

断了今生、忘了曾经 提交于 2019-12-12 17:13:39
问题 I have a JavaFX 8 desktop application and I'm creating an .app application bundle to distribute the application to Mac users. I use the Oracle “Self-Contained Application Packaging” tool to generate the bundle. The problem that I have relates to the files associated with my application. I am associating the extension .wordy with these files. If I have the application open and I double click one of these files in the Mac Finder, my application receives an OpenFilesEvent containing the path to

How to display text on several lines in TextArea

喜夏-厌秋 提交于 2019-12-12 17:12:38
问题 I tested this code to display strings on several lines: TextArea dataPane = new TextArea(); dataPane.setEditable(false); dataPane.prefWidthProperty().bind(hbox.widthProperty()); dataPane.setWrapText(true); // New line of the text exceeds the text area dataPane.setPrefRowCount(10); dataPane.setText("Testdata"); dataPane.setText("\ndata"); But as a result I get only the String data . What is the proper way to display strings on several lines in JavaFX? 回答1: Use TextArea.appendText TextArea

javafx 8 dialog and concurrency

☆樱花仙子☆ 提交于 2019-12-12 16:37:32
问题 I want to show a custom JavaFX 8 dialog to a user, capture data from the user and then close the dialog after the data is saved to the database (or shows an error message\alert). At the moment, the dialog is shown with the following code: Optional<MyType> result = dialog.showAndWait(); Followed by code: myrepository.save(result) From reading the documentation, it looks like instead I should perform this repository.save in a background Task? It looks like this code could only be executed after

What the easiest way to animate a Path as an object traverses it?

陌路散爱 提交于 2019-12-12 16:19:22
问题 Consider a rectangle traversing a long, linear path. It would be useful to figure out where the shape had gone earlier in the animation. Displaying the entire path before the shape moves is not what I want. That is easily done by adding the path to the pane. I want a trailing line behind the shape representing the path that the shape has traversed through so far. Does anyone know how to do this in Javafx? I am using Path and PathTransition to animate my object along a path. 回答1: There are

JavaFX: Mouse clipboard does not work in Unix

♀尐吖头ヾ 提交于 2019-12-12 12:05:39
问题 In Unix, as you probably know, it is common to use the mouse for copy-paste operations. I.e. text selection automatically copies it to the clipboard and clicking on the scroll pastes it where you click. I do not have clipboard problems with GUI applications that use Java 7 with Swing. But in JavaFX with Java 8 (update 45), the mouse clipboard does not work, so that: I cannot paste any text to the GUI by clicking the scroll I cannot copy any text from the GUI by just selecting it I encountered