swing - How to create a common static focusable window in Java? -
i creating transliterating tool in java. it's complete. here screenshot.
i using jwindow
dropdown, which must focusable reason. as, user can write in 1 input @ 1 time. i've created window
static, text components use same instance instead of creating new one.
problem occurs, when work in more 1 window. works fine unless both window showing on screen. when owner window of dropdown window closed, dropdown window not focusable anymore.
as javadoc of jwindow(window owner)
constructor says:
creates window specified owner window. window not focusable unless owner showing on screen. if owner null, shared owner used , window not focusable.
so, how can create static, focusable window, shared components in different windows.
don't use jwindow.
instead can use non decorated jdialog. won't have focus problem.
edit:
you can prevent dialog getting focus when make visible using code like:
dialog.setwindowfocusablestate(false); dialog.setvisible(true); dialog.setwindowfocusablestate(true);
Comments
Post a Comment