Component c = getComponent();
Container host = getContainer();
if (host != null &&
isVisible != ((JTextComponent)host).isEditable()) {
isVisible = ((JTextComponent)host).isEditable();
preferenceChanged(null, true, true);
host.repaint();
}
/*
* Note: we cannot tweak the visible state of the
* component in createComponent() even though it
* gets called after the setParent() call where
* the value of the boolean is set. This
* because, the setComponentParent() in the
* superclass, always does a setVisible(false)
* after calling createComponent(). We therefore
* use this flag in the paint() method to
* setVisible() to true if required.
*/
if (isVisible) {
super.paint(g, allocation);
}
else {
setSize(0, 0);
}
if (c != null) {
c.setFocusable(isVisible);
}