Questions tagged [keyboardfocusmanager]

22 questions
12
votes
6 answers

How do you solve this LostFocus/LostKeyboardFocus issue?

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…
Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
3
votes
1 answer

How to show programmatically FocusVisualStyle?

Afters attemps I could tell that the FocusVisualStyle is only activated by the keyboard (tab and arrows keys). Try to make the FocusVisualStyle to be applied after the component is loaded, it is impossible to do, There is an easy way to get around…
J. Lennon
  • 3,311
  • 4
  • 33
  • 64
3
votes
1 answer

How to request focus synchronously in Swing?

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…
yonran
  • 18,156
  • 8
  • 72
  • 97
2
votes
3 answers

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

I am playing around with the KeyboardFocusManager and my own custom KeyEventDispatcher that redispathes all KeyEvents to one particular JTextField, regardless of focus within the JFrame. This works like a charm as far as textual input is concerned…
Oskar Lund
  • 339
  • 2
  • 11
2
votes
2 answers

Get caret position when key pressed using KeyboardFocusManager

I'm trying to get the current caret position when the "<" character is typed, using a KeyboardFocusManager. Code below. If the text field is empty when they character is typed I would expect the caret position to be 0. However, the result I actually…
2
votes
0 answers

MainWindow steals Keyboard focus from floating windows when clicked

I have some problems with focus on WPF. Even though focus is a common problem I couldn't find a solution that works for my problem. Here is the situation: I have an Editor Software where I can drag documents floating (like in Visual studio). The…
m00ni
  • 113
  • 1
  • 8
2
votes
4 answers

Check whether shift key is pressed

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…
haiyyu
  • 2,194
  • 6
  • 22
  • 34
1
vote
1 answer

How to Force Keyboard Focus on a DataGrid?

OLD TITLE: Inconsistent Actions in GridView SelectCell + Focus/Edit (GridView Reloaded Twice?) I'm developing a GridView (bound by Data) set in the Content property of an Expander. When I open the Expander, I want the third column, first element to…
Matt Starn
  • 127
  • 3
  • 11
1
vote
2 answers

Accessibility - focus order for radio selects with tool tips

I have a group of 3 radio selects each radio select has a tool tip next to it. I'm not sure what order each of these should receive keyboard focus? Should it be... 1. First radio select 2. First corresponding tool tip 3. Second radio 3. Second tool…
1
vote
1 answer

KeyBoard focus wpf : Set KeyBoard Focus to a DataGrids First row when Pressed TAB from a different UserControls TreeView

I have two UserControls One has a TreeView and another has a Button and a DataGrid. What i am trying to achieve is when Tab on a TreeViewItem should give KeyBoard Focus to the DataGrid in second UserControl. I have looked in to different posts but…
Abin
  • 2,868
  • 1
  • 23
  • 59
0
votes
1 answer

Trying to find the currently focused window using KeyboardFocusManager always results in an error message

So I am trying to get the currently focused window using KeyboardFocusManager, I made two methods to try and achieve this: public static void getWindowName() { String WindowName =…
2five
  • 135
  • 1
  • 2
  • 11
0
votes
3 answers

Enter Key work as Tab Key for every component except JButton

I am developing a Swing application, in which I want enter key work as tab key for all component of JFrame except JButton components and dialog boxes. For that I have set ENTER and TAB as default focus traversal keys. KeyStroke enter =…
0
votes
1 answer

Getting a reference to the current KeyboardFocusManager

Is there a way to get a reference to the current KeyboardFocusManager in a Swing application?
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
0
votes
1 answer

UWP key press event handled too late prevent keyboard focus action

I have an UWP app that controls my tv. I have some Buttons, Checkboxes etc. and keyboard controls/events. This combination causes problems. When check a checkbox and then press VirtualKey.Subtract the checkbox is unchecked and I don't want any…
CodingYourLife
  • 7,172
  • 5
  • 55
  • 69
0
votes
0 answers

Global event listener JAVA

I want to listen keyboard event over all control in my jframe to show new window, so far this is my code : KeyboardFocusManager.getCurrentKeyboardFocusManager() .addKeyEventDispatcher(new KeyEventDispatcher() { …
NYassuki
  • 23
  • 3
1
2