On 2017-04-06, Oleksandr Gavenko wrote:

> Commonly recommended:
>
>   Style "sun-awt-X11-*" Lenience
>
> make Fvwm border decoration colors as if window is active (defined Alt+F4
> close proper window) but application ignore/doesn't receive keyboard input.
>
> Direct click inside window (not on decoration!) bring keyboard focus to
> application.
>
> Most common annoyances are:
>
> * loosing keyboard focus in main application after closing popup dialog box
>   (like closing search box in editor)
> * not getting keyboard focus after 'WindowList' (Alt+TAB)

Here is the same problem:

  http://kristiannielsen.livejournal.com/19682.html

In order to get keyword input focus you need to click inside app...

Have anyone tried to solve Java GUI focus problem?

To reproduce problem compile and run:

  $ javac X.java
  $ java X

  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;

  public class X
  {
      public static void main(String[] args) {
          final JFrame frame = new JFrame("FrameDemo");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

          JEditorPane editorPane = new JEditorPane();
          JScrollPane editorScrollPane = new JScrollPane(editorPane);
          
editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
          editorScrollPane.setPreferredSize(new Dimension(250, 145));
          editorScrollPane.setMinimumSize(new Dimension(10, 10));

          frame.add(editorScrollPane);

          frame.setPreferredSize(new Dimension(200, 150));

          frame.pack();
          frame.setVisible(true);
      }
  }


If you switch focus to Java window via Alt+TAB (WindowList) or by clicking to
window decorations cursor in editor field isn't appear. Only manual click is
necessary to allow typing from keyboard...

-- 
http://defun.work/


Reply via email to