Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.forms.layout
Class ConstantSize

    java.lang.Object
      com.jgoodies.forms.layout.ConstantSize

All Implemented Interfaces:
  Size, Serializable

    public final class ConstantSize

extends Object
implements Size, Serializable

An implementation of the `Size` interface that represents constant sizes described by a value and unit, for example: 10 pixel, 15 point or 4 dialog units. You can get instances of `ConstantSize` using the factory methods and constants in the `Sizes` class. Logical constant sizes that vary with the current layout style are delivered by the `LayoutStyle` class.

This class supports different size units:

Unit | Abbreviation | Size
Millimeter | mm | 0.1 cm
Centimeter | cm | 10.0 mm
Inch | in | 25.4 mm
DTP Point | pt | 1/72 in
Pixel | px | 1/(resolution in dpi) in
Dialog Unit | dlu | honors l&f, resolution, and dialog font size

Examples:

     Sizes.ZERO;
     Sizes.DLUX9;
     Sizes.dluX(42);
     Sizes.pixel(99);

Version:
  $Revision: 1.2 $
Author:
  Karsten Lentzsch
See Also:
  `Size`, `Sizes`, Serialized Form

Nested Class Summary
`static class` | `ConstantSize.Unit` An ordinal-based serializable typesafe enumeration for units as used in instances of `ConstantSize`.

Field Summary
`static ConstantSize.Unit` | `CENTIMETER`
`static ConstantSize.Unit` | `CM`
`static ConstantSize.Unit` | `DIALOG_UNITS_X`
`static ConstantSize.Unit` | `DIALOG_UNITS_Y`
`static ConstantSize.Unit` | `DLUX`
`static ConstantSize.Unit` | `DLUY`
`static ConstantSize.Unit` | `IN`
`static ConstantSize.Unit` | `INCH`
`static ConstantSize.Unit` | `MILLIMETER`
`static ConstantSize.Unit` | `MM`
`static ConstantSize.Unit` | `PIXEL`
`static ConstantSize.Unit` | `POINT`

Method Summary
`boolean` | `equals(Object o)` Indicates whether some other ConstantSize is "equal to" this one.
`int` | `getPixelSize(Component component)` Converts the size if necessary and returns the value in pixels.
`int` | `hashCode()` Returns a hash code value for the object.
`int` | `maximumSize(Container container, List components, com.jgoodies.forms.layout.FormLayout.Measure minMeasure, com.jgoodies.forms.layout.FormLayout.Measure prefMeasure, com.jgoodies.forms.layout.FormLayout.Measure defaultMeasure)` Returns this size as pixel size.
`String` | `toString()` Returns a string representation of this size object.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### PIXEL

    public static final ConstantSize.Unit PIXEL

### POINT

    public static final ConstantSize.Unit POINT

### DIALOG_UNITS_X

    public static final ConstantSize.Unit DIALOG_UNITS_X

### DLUX

    public static final ConstantSize.Unit DLUX

### DIALOG_UNITS_Y

    public static final ConstantSize.Unit DIALOG_UNITS_Y

### DLUY

    public static final ConstantSize.Unit DLUY

### MILLIMETER

    public static final ConstantSize.Unit MILLIMETER

### MM

    public static final ConstantSize.Unit MM

### CENTIMETER

    public static final ConstantSize.Unit CENTIMETER

### CM

    public static final ConstantSize.Unit CM

### INCH

    public static final ConstantSize.Unit INCH

### IN

    public static final ConstantSize.Unit IN

Method Detail

### getPixelSize

    public int getPixelSize(Component component)

  Converts the size if necessary and returns the value in pixels.

  Parameters:
    `component` - the associated component
  Returns:
    the size in pixels

### maximumSize

    public int maximumSize(Container container,
                           List components,
                           com.jgoodies.forms.layout.FormLayout.Measure minMeasure,
                           com.jgoodies.forms.layout.FormLayout.Measure prefMeasure,
                           com.jgoodies.forms.layout.FormLayout.Measure defaultMeasure)

  Returns this size as pixel size. Neither requires the component list nor the specified measures.

  Invoked by `FormSpec` to determine the size of a column or row.

  Specified by:
    `maximumSize` in interface `Size`
  Parameters:
    `container` - the layout container
    `components` - the list of components used to compute the size
    `minMeasure` - the measure that determines the minimum sizes
    `prefMeasure` - the measure that determines the preferred sizes
    `defaultMeasure` - the measure that determines the default sizes
  Returns:
    the computed maximum size in pixel

### equals

    public boolean equals(Object o)

  Indicates whether some other ConstantSize is "equal to" this one.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `o` - the Object with which to compare
  Returns:
    `true` if this object is the same as the obj argument; `false` otherwise.
  See Also:
    `Object.hashCode()`, `Hashtable`

### hashCode

    public int hashCode()

  Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by `java.util.Hashtable`.

  Overrides:
    `hashCode` in class `Object`
  Returns:
    a hash code value for this object.
  See Also:
    `Object.equals(java.lang.Object)`, `Hashtable`

### toString

    public String toString()

  Returns a string representation of this size object. Note: The string representation may change at any time. It is strongly recommended to not use this string for parsing purposes.

  Overrides:
    `toString` in class `Object`
  Returns:
    a string representation of the constant size

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 JGoodies Karsten Lentzsch. All Rights Reserved.