SWT version: getOppositeComponent when changing focus

In Swing, you can get "another component involved in this focus change": getOppositeComponent . There seems to be no similar call in SWT, does anyone have a workaround or fix for this?

TIA

+3
source share
1 answer

There is no equivalent in SWT, but you can try using the following lists for both components:

public class OppositeAwareFocusListener implements FocusListener {
  Widget opposite;
  public void focusGained(FocusEvent e) {
    ..
  }
  public void focusLost(FocusEvent e) {
    this.opposite = e.widget;
  }
}
+2
source

Source: https://habr.com/ru/post/1725003/


All Articles