keyboardfocusmanager

Change JavaFX Tab-Button orderring of TextFields from “Left to Right” to “Right to Left” by fxml file [duplicate]

[亡魂溺海] 提交于 2020-01-16 18:34:09
问题 This question already has answers here : JavaFX: How to change the focus traversal policy? (9 answers) Closed 4 years ago . Before asking, i should say that the answer of can be found maybe in JavaFX: How to change the focus traversal policy?, but i don't looking for any java code, i would like a way by editing the Fxml file There is a FXML file that has some TextFields in it and i would like to change focus traversal policy of my TextField : I mean, At the beginning of the application the

Find the Parent RichTextBox from the Focused Hyperlink Within

旧巷老猫 提交于 2020-01-06 21:00:58
问题 The Setting: I have a RichTextBox containing a hyperink and a DropDownButton somewhere else in my UI. Now when I click the button's DropDown open and afterwards click somewhere else on my UI, the DropDown is implemented to close, and check if it still owns the keyboardfocus so it can set its ToggleButton to focused again after the DropDown collapsed as intended. The Problem: When clicking inside my RichTextBox I will face an InvalidOperationException caused by my method to check focus

How can I make a JTextField fire it's ActionEvent when KeyEvent.VK_ENTER is redispatched to it?

本秂侑毒 提交于 2019-12-24 03:31:59
问题 I am playing around with the KeyboardFocusManager and my own custom KeyEventDispatcher that redispathes all KeyEvent s to one particular JTextField , regardless of focus within the JFrame. This works like a charm as far as textual input is concerned but I also want the JTextField to post its text to a JTextArea when a KeyEvent.VK_ENTER is redispatched to it. For some reason it just won't do this. I've set an actionListener on the JTextField which will be fired on if I have the cursor in the

Check whether shift key is pressed

允我心安 提交于 2019-12-11 03:06:18
问题 I'm programming an application which should, when started, check whether the shift key is pressed. For that I have created a small class which is responsible for that: import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; import java.awt.event.KeyEvent; public class KeyboardListener { private static boolean isShiftDown; static { KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher( new KeyEventDispatcher() { public boolean dispatchKeyEvent(KeyEvent e

How do you solve this LostFocus/LostKeyboardFocus issue?

喜欢而已 提交于 2019-11-30 09:00:51
Ok, I have a control that has an IsEditing property which for argument's sake has a default template that is normally a text block, but when IsEditing is true, it swaps in a textbox for in-place editing. Now when the control loses focus, if it's still editing, it's supposed to drop out of editing mode and swap back in the TextBlock template. Pretty straight forward, right? Think of the behavior of renaming a file in Windows Explorer or on your desktop (which is the same thing I know...) That's the behavior we want. The issue is you can't use the LostFocus event because when you switch to

How do you solve this LostFocus/LostKeyboardFocus issue?

a 夏天 提交于 2019-11-29 12:47:46
问题 Ok, I have a control that has an IsEditing property which for argument's sake has a default template that is normally a text block, but when IsEditing is true, it swaps in a textbox for in-place editing. Now when the control loses focus, if it's still editing, it's supposed to drop out of editing mode and swap back in the TextBlock template. Pretty straight forward, right? Think of the behavior of renaming a file in Windows Explorer or on your desktop (which is the same thing I know...) That

How to request focus synchronously in Swing?

僤鯓⒐⒋嵵緔 提交于 2019-11-28 12:42:43
When I call component.requestFocusInWindow() , Swing enqueues asynchronous FOCUS_GAINED and FOCUS_LOST events rather than synchronously transferring focus. As a workaround, it appears that DefaultKeyboardFocusManager is trying to simulate synchronously switching focus by delaying the dispatch of keyboard events until focus events have finished dispatching. But it appears that this isn’t working properly. Question: Is there any way to change focus synchronously in Swing? Is DefaultKeyboardFocusManager really trying to simulate synchronous focus, and is it seriously buggy? Is there a focus

How to request focus synchronously in Swing?

牧云@^-^@ 提交于 2019-11-27 07:13:17
问题 When I call component.requestFocusInWindow() , Swing enqueues asynchronous FOCUS_GAINED and FOCUS_LOST events rather than synchronously transferring focus. As a workaround, it appears that DefaultKeyboardFocusManager is trying to simulate synchronously switching focus by delaying the dispatch of keyboard events until focus events have finished dispatching. But it appears that this isn’t working properly. Question: Is there any way to change focus synchronously in Swing? Is