41 * <dd> The components are placed end-to-end, 42 * starting either at coordinate 0 (the leftmost or topmost position) 43 * or at the coordinate representing the end of the allocated span 44 * (the rightmost or bottommost position). 45 * 46 * <dt> aligned 47 * <dd> The components are aligned as specified 48 * by each component's X or Y alignment value. 49 * </dl> 50 * </blockquote> 51 * 52 * <p> 53 * 54 * Each SizeRequirements object contains information 55 * about either the width (and X alignment) 56 * or height (and Y alignment) 57 * of a single component or a group of components: 58 * 59 * <blockquote> 60 * <dl> 61 * <dt> <code>minimum</code> 62 * <dd> The smallest reasonable width/height of the component 63 * or component group, in pixels. 64 * 65 * <dt> <code>preferred</code> 66 * <dd> The natural width/height of the component 67 * or component group, in pixels. 68 * 69 * <dt> <code>maximum</code> 70 * <dd> The largest reasonable width/height of the component 71 * or component group, in pixels. 72 * 73 * <dt> <code>alignment</code> 74 * <dd> The X/Y alignment of the component 75 * or component group. 76 * </dl> 77 * </blockquote> 78 * <p> 79 * <strong>Warning:</strong> 80 * Serialized objects of this class will not be compatible with 81 * future Swing releases. The current serialization support is 82 * appropriate for short term storage or RMI between applications running 83 * the same version of Swing. As of 1.4, support for long term storage 84 * of all JavaBeans™ 85 * has been added to the <code>java.beans</code> package. 86 * Please see {@link java.beans.XMLEncoder}. 87 * 88 * @see Component#getMinimumSize 89 * @see Component#getPreferredSize 90 * @see Component#getMaximumSize 91 * @see Component#getAlignmentX 92 * @see Component#getAlignmentY 93 * 94 * @author Timothy Prinzing 95 * @since 1.2 96 */ 97 @SuppressWarnings("serial") // Same-version serialization only 98 public class SizeRequirements implements Serializable { 99 100 /** 101 * The minimum size required. 102 * For a component <code>comp</code>, this should be equal to either 103 * <code>comp.getMinimumSize().width</code> or 104 * <code>comp.getMinimumSize().height</code>. 105 */ 106 public int minimum; 107 108 /** 109 * The preferred (natural) size. 110 * For a component <code>comp</code>, this should be equal to either 111 * <code>comp.getPreferredSize().width</code> or 112 * <code>comp.getPreferredSize().height</code>. 113 */ 114 public int preferred; 115 116 /** 117 * The maximum size allowed. 118 * For a component <code>comp</code>, this should be equal to either 119 * <code>comp.getMaximumSize().width</code> or 120 * <code>comp.getMaximumSize().height</code>. 121 */ 122 public int maximum; 123 124 /** 125 * The alignment, specified as a value between 0.0 and 1.0, 126 * inclusive. 127 * To specify centering, the alignment should be 0.5. 128 */ 129 public float alignment; 130 131 /** 132 * Creates a SizeRequirements object with the minimum, preferred, 133 * and maximum sizes set to zero and an alignment value of 0.5 134 * (centered). 135 */ 136 public SizeRequirements() { 137 minimum = 0; 138 preferred = 0; 139 maximum = 0; 140 alignment = 0.5f; | 41 * <dd> The components are placed end-to-end, 42 * starting either at coordinate 0 (the leftmost or topmost position) 43 * or at the coordinate representing the end of the allocated span 44 * (the rightmost or bottommost position). 45 * 46 * <dt> aligned 47 * <dd> The components are aligned as specified 48 * by each component's X or Y alignment value. 49 * </dl> 50 * </blockquote> 51 * 52 * <p> 53 * 54 * Each SizeRequirements object contains information 55 * about either the width (and X alignment) 56 * or height (and Y alignment) 57 * of a single component or a group of components: 58 * 59 * <blockquote> 60 * <dl> 61 * <dt> {@code minimum} 62 * <dd> The smallest reasonable width/height of the component 63 * or component group, in pixels. 64 * 65 * <dt> {@code preferred} 66 * <dd> The natural width/height of the component 67 * or component group, in pixels. 68 * 69 * <dt> {@code maximum} 70 * <dd> The largest reasonable width/height of the component 71 * or component group, in pixels. 72 * 73 * <dt> {@code alignment} 74 * <dd> The X/Y alignment of the component 75 * or component group. 76 * </dl> 77 * </blockquote> 78 * <p> 79 * <strong>Warning:</strong> 80 * Serialized objects of this class will not be compatible with 81 * future Swing releases. The current serialization support is 82 * appropriate for short term storage or RMI between applications running 83 * the same version of Swing. As of 1.4, support for long term storage 84 * of all JavaBeans™ 85 * has been added to the {@code java.beans} package. 86 * Please see {@link java.beans.XMLEncoder}. 87 * 88 * @see Component#getMinimumSize 89 * @see Component#getPreferredSize 90 * @see Component#getMaximumSize 91 * @see Component#getAlignmentX 92 * @see Component#getAlignmentY 93 * 94 * @author Timothy Prinzing 95 * @since 1.2 96 */ 97 @SuppressWarnings("serial") // Same-version serialization only 98 public class SizeRequirements implements Serializable { 99 100 /** 101 * The minimum size required. 102 * For a component {@code comp}, this should be equal to either 103 * {@code comp.getMinimumSize().width} or 104 * {@code comp.getMinimumSize().height}. 105 */ 106 public int minimum; 107 108 /** 109 * The preferred (natural) size. 110 * For a component {@code comp}, this should be equal to either 111 * {@code comp.getPreferredSize().width} or 112 * {@code comp.getPreferredSize().height}. 113 */ 114 public int preferred; 115 116 /** 117 * The maximum size allowed. 118 * For a component {@code comp}, this should be equal to either 119 * {@code comp.getMaximumSize().width} or 120 * {@code comp.getMaximumSize().height}. 121 */ 122 public int maximum; 123 124 /** 125 * The alignment, specified as a value between 0.0 and 1.0, 126 * inclusive. 127 * To specify centering, the alignment should be 0.5. 128 */ 129 public float alignment; 130 131 /** 132 * Creates a SizeRequirements object with the minimum, preferred, 133 * and maximum sizes set to zero and an alignment value of 0.5 134 * (centered). 135 */ 136 public SizeRequirements() { 137 minimum = 0; 138 preferred = 0; 139 maximum = 0; 140 alignment = 0.5f; |