public void hierarchyChanged(final HierarchyEvent e) { if (e.getComponent() == PCanvas.this) { if (getParent() == null) { removeInputSources(); } else if (isEnabled()) { installInputSources(); } } } });
/** * Override setEnabled to install/remove canvas input sources as needed. * * @param enabled new enable status of the Pcanvas */ public void setEnabled(final boolean enabled) { super.setEnabled(enabled); if (isEnabled() && getParent() != null) { installInputSources(); } else { removeInputSources(); } }