Re: FVWM: Java applications don't get keyboard focus

Oleksandr Gavenko <[email protected]>
Newsgroups gmane.comp.window-managers.fvwm
Organization Oleksandr Gavenko <[email protected]>, http://defun.work/
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.