package textbender.o.awt; // Copyright 2005, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Textbender Software"), to deal in the Textbender Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Textbender Software, and to permit persons to whom the Textbender Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Textbender Software. THE TEXTBENDER SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TEXTBENDER SOFTWARE OR THE USE OR OTHER DEALINGS IN THE TEXTBENDER SOFTWARE. import java.awt.Component; import java.util.prefs.Preferences; /** Preference storage for component bounds. * This is a convenience class that encapsulates together * a {@linkplain ComponentLocationPreference ComponentLocationPreference} * and a {@linkplain ComponentSizePreference ComponentSizePreference}. */ public final class ComponentBoundsPreference { /** Constructs a ComponentBoundsPreference. *

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

* * @param c component whose bounds to store and restore * @param preferences node, * per ComponentLocationPreference.{@linkplain ComponentLocationPreference#preferences() preferences}() * and ComponentSizePreference.{@linkplain ComponentSizePreference#preferences() preferences}() */ public ComponentBoundsPreference( Component c, Preferences preferences ) { location = new ComponentLocationPreference( c, preferences ); size = new ComponentSizePreference( c, preferences ); } // ------------------------------------------------------------------------------------ /** Returns the preference storage for the component's location. */ public ComponentLocationPreference location() { return location; } private final ComponentLocationPreference location; /** Returns the preference storage for the component's size. */ public ComponentSizePreference size() { return size; } private final ComponentSizePreference size; //// P r i v a t e /////////////////////////////////////////////////////////////////////// /** A slow run buffer, anywhere from 500 to 2000 ms. */ static final RunBuffer runBuffer = new RunBuffer( /*interInvocationMilliseconds*/1000 ); }