textbender.o.awt
Class ComponentSizePreference

java.lang.Object
  extended by ComponentSizePreference

@ThreadRestricted(value="AWT event dispatch")
public final class ComponentSizePreference
extends Object

Preference storage for component size. Stores under keys "width" and "height".


Field Summary
protected  Component component
           
 
Constructor Summary
ComponentSizePreference(Component c, Preferences preferences)
          Creates a ComponentSizePreference.
 
Method Summary
 Preferences preferences()
          Returns the preference node used for storage.
 void restore(Dimension defaultSize)
          Restores the preferred size, and begins automatically storing changes.
 void restore(int defaultWidth, int defaultHeight)
          Restores the preferred size, and begins automatically storing changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

component

protected final Component component
Constructor Detail

ComponentSizePreference

public ComponentSizePreference(Component c,
                               Preferences preferences)
Creates a ComponentSizePreference. Begins to automatically store changes only after you call restore().

There is currently no way to remove it from the component. Create one only per component, or they will accumulate.

Parameters:
c - component whose size to store and restore
preferences - per preferences()
Method Detail

preferences

public Preferences preferences()
Returns the preference node used for storage.


restore

public void restore(Dimension defaultSize)
Restores the preferred size, and begins automatically storing changes. Normally, called once only; subsequent calls should have no effect.

Parameters:
defaultSize - in case no stored preference available

restore

public void restore(int defaultWidth,
                    int defaultHeight)
Restores the preferred size, and begins automatically storing changes. Normally, called once only; subsequent calls should have no effect.

Parameters:
defaultWidth - in case no stored preference available
defaultHeight - in case no stored preference available