javafx-8

How to localize JavaFX FileChooser dialog?

只愿长相守 提交于 2019-11-30 09:50:14
问题 Is there an option to localize JavaFX FileChooser dialog? In Swing JFileChooser localization was pretty simple (over UIManager ). But i can't find similar functionality in JavaFX. 回答1: I don't think you can. From the FileChooser Javadocs: Provides support for standard platform file dialogs. These dialogs have look and feel of the platform UI components which is independent of JavaFX. Since these are native File Chooser dialogs, the text displayed in them will be controlled by the locale of

Get value from Date picker

喜夏-厌秋 提交于 2019-11-30 09:37:41
I want to get the value from JavaFX datepicker and store the value as Date Object: final DatePicker datePicker = new DatePicker(LocalDate.now()); Date date = datePicker.getValue(); grid.add(datePicker, 1, 9); Can you tell me how I can convert LocalDate to Date ? As the name implies, LocalDate does not store a timezone nor the time of day. Therefore to convert to an absolute time you must specify the timezone and time of day. There is a simple method to do both, atStartOfDay(ZoneId). Here I use the default time zone which is the local timezone of the computer. This gives you an Instant object

Prevent JavaFX thread from dying with JFXPanel Swing interop?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 09:35:34
I'm embedding several JFXPanels into a Swing app and the JavaFX thread dies when the JFXPanels are no longer visible. This is problematic because creating another JFXPanel after the JavaFX thread dies will not start another JavaFX thread and thus the JFXPanel will be blank. From what I can tell the JFXPanel ctor starts the JavaFX thread by calling: PlatformImpl.startup(new Runnable() { @Override public void run() { // No need to do anything here } }); Later on once the JFXPanel has a parent component its addNotify method is called which calls registerFinishListener which registers a

How to prevent closing of AutoCompleteCombobox popupmenu on SPACE key press in JavaFX

拈花ヽ惹草 提交于 2019-11-30 09:22:05
问题 I have created a AutoCompleteCombobox in JavaFX with the help of code mentioned on https://github.com/jesuino/javafx-combox-autocomplete/blob/master/src/main/java/org/fxapps/ComboBoxAutoComplete.java But issue is that combobox popup closes when user presses SPACE key. I want to continue filtering with space character and prevent popup from closing. I have handled all three events (key press, key release, key typed) on combobox but no solutions. I think it is being caused by key press event on

JavaFX FilteredList, filtering based on property of items in the list

瘦欲@ 提交于 2019-11-30 09:21:54
问题 I have a case where I need to filter a ObservableList<Item> based on some properties of the items (i.e. the condition is internal and not external). I found out that javafx has FilteredList so I tried it. I could set the predicate and filtering works, until the property value that determines the filtering changes. Setting the predicate is done now like following: list.setPredicate(t -> !t.filteredProperty().get()) Since the predicate returns boolean and not BooleanProperty, the changes to

When to use translate and when relocate - What is the difference between translate and layout coordinates?

你说的曾经没有我的故事 提交于 2019-11-30 09:11:29
When to use translate and when relocate in order to move a node? In the end of the day it seems they do the same thing (visually); move the node; the first by doing a translation on the origin (the x, y stays the same), the second by changing the x, y coords. So suppose i want to move a node in a specific point in the screen.. should i use node.relocate(x,y) or node.setTranslateX(x), node.setTranslateY(y)? To demostrate what I mean I have made a sample program you can play with: A rectangle on the screen, whose position is determined by 4 sliders (2 of them controlling the layout x, y the

How can I make a TextArea stretch to fill the content, expanding the parent in the process?

*爱你&永不变心* 提交于 2019-11-30 08:26:38
So I have a TextArea and as the user pastes paragraphs into it, or just writes in it, I want it to expand vertically to reveal all the available text. I.e. not to use a scrollbar in the text field itself... much like what happens on many web pages. Many users, myself included, don't like to be forced to edit in a small window. Exactly how Facebook status updates box works. I've tried myTextArea.autoSize() wrapped in an myTextArea.textProperty().addListener(new ChangeListener()....); but that doesn't work. I think it's happy autosizing to its current size. The left, right & top anchors are set

General Exception handling in JavaFX 8

醉酒当歌 提交于 2019-11-30 08:00:32
问题 Given the controller of a Scene calls business code which raises an Exception. How can I handle those kind of Exceptions in a general fashion? I tried the Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler) method but it is not invoked so I believe that the Exceptions are catched somewhere inside the JavaFX framework. What could I do to handle this Exceptions or at least show some useful information to the user? 回答1: As of JavaFX 8, Thread.setDefaultUncaughtExceptionHandler(..

Is JavaFX 8 going to implement text field validation support?

白昼怎懂夜的黑 提交于 2019-11-30 07:04:35
JavaFX 2 does not provide validation support (masks, input filtering and so on...). It is difficult to adopt a technology that does not offer basic functionalities. I am trying to implement my own validators, but that is a big pain. Are there any news in JavaFX 8 about validation? I was trying to find new features, but I don't know where to search, it is difficult to find exactly what will be the changes in JavaFX 8. I need to know about it, because I was considering JavaFX for a new application. Answer No, JavaFX 8 will not implement high level validation support. Opinion I think it unlikely

Manually typing in text in JavaFX Spinner is not updating the value (unless user presses ENTER)

[亡魂溺海] 提交于 2019-11-30 07:04:07
问题 It seems that the Spinner control does not update a manually typed-in value until the user explicitly presses enter. So, they could type in a value (not press enter) exit the control, and submit the form, and the value displayed in the spinner is NOT the value of the Spinner, it is the old value. My idea was to add a listener to the lost focus event, but I can't see a way to gain access to the typed-in value? spinner.focusedProperty().addListener((observable, oldValue, newValue) -> { //if