/* * Our focus model is synthetic and only non-simple window * may become natively focusable window. */ private boolean isNativelyFocusableWindow() { if (peer == null) { return false; } return !peer.isSimpleWindow() && target.getFocusableWindowState(); }
public void pack() { if (w != null) { // circumvention for bug 1924630 : this throws a NullPointerException // with the combination Metal-lnf / java 1.5 / screen menu bar / laf window deco // / floating palettes. We have to make sure the window is focusable // during pack(): final boolean wasFocusable = w.getFocusableWindowState(); if (!wasFocusable) { w.setFocusableWindowState(true); } w.pack(); if (!wasFocusable) { w.setFocusableWindowState(false); } } else if (jif != null) { // bug in swing?? // when using undecorated windows plus metal-lnf plus lnf-window-deco // try { jif.pack(); } catch( NullPointerException e ) {} jif.pack(); } else { throw new IllegalStateException(); } }
private static void setWindowFocusable(@NotNull Window window, boolean value) { if (value != window.getFocusableWindowState()) { window.setFocusableWindowState(value); } }