nfrankel
01/08/2021, 5:09 AMSwingPanel
to use the faithful JTable
• how do you bind the tab key to jump to another field?gildor
01/08/2021, 6:28 AMxetra11
01/08/2021, 7:19 AMnfrankel
01/08/2021, 7:27 AMJTable
is legacy but the effort to use it is pretty low compared to a custom implementationxetra11
01/08/2021, 7:34 AMnfrankel
01/08/2021, 7:38 AMgildor
01/08/2021, 7:58 AMxetra11
01/08/2021, 8:11 AMjim
01/08/2021, 12:08 PMLogan Knight
01/08/2021, 12:59 PMTextField(
modifier = Modifier.onKeyEvent {
println(it)
false
},
)
jim
01/08/2021, 1:21 PMfocusModifier
? I think it might do what you want, rather than trying to write your own. Although focusModifier
does use onKeyEvent
so I'm not sure if that'll get you any further since my best guess/assumption would be that TextField
is perhaps consuming the tab input?
cc @Ralston Da Silva who knows more about this than I do since he wrote the focus navigation stuff IIRC. cc @Siyamed for text field related question. One of them may know more.Logan Knight
01/08/2021, 1:24 PMnfrankel
01/08/2021, 1:26 PMDominaezzz
01/08/2021, 2:57 PMDataTable
component, now it's gone. If you can find it and copy it, it'll give you a head start.nfrankel
01/08/2021, 3:16 PMLogan Knight
01/08/2021, 6:43 PMThe focus subsystem consumes focus traversal keys, such as Tab and Shift Tab. If you need to prevent the focus traversal keys from being consumed, you can call
component.setFocusTraversalKeysEnabled(false)
on the component that is firing the key events. Your program must then handle focus traversal on its own. Alternatively, you can use the KeyEventDispatcher class to pre-listen to all key events. The focus page has detailed information on the focus subsystem
Ref: https://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html
You can disable the behavior for each component. It seems that it would need to be configured in the ComposeLayer.Wrapper
which is not exposed as part of the public API and is the KeyEvent source, Then some Compose native implementation would have to manage it since Compose does not use Swing Components
accept at the top.
You can capture tab key strokes with:
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher {
println(it)
true
}
But that's of little use except on a global level. At least those are my thoughts.nfrankel
01/08/2021, 6:45 PMLogan Knight
01/08/2021, 6:46 PMjim
01/08/2021, 6:51 PMLogan Knight
01/08/2021, 8:50 PMSiyamed
01/08/2021, 8:57 PMRalston Da Silva
01/13/2021, 9:20 PMLogan Knight
01/14/2021, 6:07 PM