@Override public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) { if (isShowing()) { controller.addControllerListener(this); update(); } else { controller.removeControllerListener(this); } } }
/** Adds this StateWaiter as a ControllerListener of the Controller */ private void addAsListener() { if (!listening) { controller.addControllerListener(this); listening = true; } }