Focus flicker problem

Hi Beni,

I saw that in 1.1.1p4 you increased the focus transfer time.
I tried it myself in 1.1.0 and the result was that sometimes the
focus was transferred back and forth between the main window and an external window.
I can also reproduce it in 1.1.1p5a:

  1. run tutorial.common.guide.MultipleDockables with eclipse theme
  2. put 4 on top of 3
    3a. pull one of them outside of the main window
    or
    3b. drag 3 and 4 outside, put them on one stack, pull one of them into the main window
    You may need to repeat it a few times (3a, 3b, 3a, 3b, … ).
    The important part is that the two dockables are together on a stack and one of them goes
    out of the main window (or goes back into the main window).

The focus is rapidly changed between the main window and the external window - flickering effect.

I was thinking of a different solution to the focus problem.
Instead of making sure that the focus is transferred from the tab/min|max|ext button to the content of the dockable,
maybe it’s better to make sure the the tabs and buttons never get focus in the first place?
For example JInternalFrame has BasicInternalFrameTitlePane which contains max, min, close buttons.
Those buttons are NoFocusButtons - normal JButtons with disabled focus.

    private class NoFocusButton extends JButton {
        private String uiKey;
        public NoFocusButton(String uiKey, String opacityKey) {
            setFocusPainted(false);
            setMargin(new Insets(0,0,0,0));
            this.uiKey = uiKey;
            
            Object opacity = UIManager.get(opacityKey);
            if (opacity instanceof Boolean) {
                setOpaque(((Boolean)opacity).booleanValue());
            }
        }
	public boolean isFocusTraversable() { return false; }
	public void requestFocus() {};
        public AccessibleContext getAccessibleContext() {
            AccessibleContext ac = super.getAccessibleContext();
            if (uiKey != null) {
                ac.setAccessibleName(UIManager.getString(uiKey));
                uiKey = null;
            }
            return ac;
        }
    }; 

kind regards,
Maciej Modelski

But if they are not focusable you can’t use the keyboard to cycle through them :-/

The flickering is a problem (unfortunately the way you describe it I did never observe on my machine). But in any case, there will be focusable Components inside and outside the frame - the Components your application puts onto the Dockable. So I’m not entirely convinced that your solution would help. Maybe temporarily disabling the focus could be a solution (e.g. after clicking a button).

What I will certainly try during the weekend, is to make the focus system intelligent enough to ignore requests that are cancelled out by younger requests.