|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.JComponent.EnableSerializationFocusListener
This class is used to give us an opportunity to uninstall the UI
before java.awt.Container.writeObject
runs.
The enableSerialization
method below adds an
instance of this class to the FocusListener
field in java.awt.Component
.
The java.awt.Component.writeObject
method,
which always runs before java.awt.Container.writeObject
,
effectively calls our writeObject
method,
which takes care of uninstalling the UI.
A FocusListener
is used (any listener would do)
because all Swing components listen for Focus
events anyway.
Yes this is a hack. Unfortunately we don't know of a better way to make the UI property transient and work correctly on JDK1.1 VMs.
Constructor Summary | |
private |
JComponent.EnableSerializationFocusListener()
|
Method Summary | |
void |
focusGained(FocusEvent e)
Invoked when a component gains the keyboard focus. |
void |
focusLost(FocusEvent e)
Invoked when a component loses the keyboard focus. |
private void |
writeObject(ObjectOutputStream s)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
private JComponent.EnableSerializationFocusListener()
Method Detail |
public void focusGained(FocusEvent e)
FocusListener
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
FocusListener
focusLost
in interface FocusListener
private void writeObject(ObjectOutputStream s) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |