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

## javax.microedition.lcdui
Class Spacer

    java.lang.Object
      javax.microedition.lcdui.Item
          javax.microedition.lcdui.Spacer

public class Spacer
extends Item

A blank, non-interactive item that has a settable minimum size. The minimum width is useful for allocating flexible amounts of space between `Items` within the same row of a `Form`. The minimum height is useful for enforcing a particular minimum height of a row. The application can set the minimum width or height to any non-negative value. The implementation may enforce implementation-defined maximum values for the minimum width and height.

The unlocked preferred width of a `Spacer` is the same as its current minimum width. Its unlocked preferred height is the same as its current minimum height.

Since a `Spacer's` primary purpose is to position other items, it is restricted to be non-interactive, and the application is not allowed to add `Commands` to a `Spacer`. Since the presence of a label on an `Item` may affect layout in device-specific ways, the label of a `Spacer` is restricted to always be `null`, and the application is not allowed to change it.

Since:
  MIDP 2.0

Field Summary

Fields inherited from class javax.microedition.lcdui.Item
`BUTTON, HYPERLINK, LAYOUT_2, LAYOUT_BOTTOM, LAYOUT_CENTER, LAYOUT_DEFAULT, LAYOUT_EXPAND, LAYOUT_LEFT, LAYOUT_NEWLINE_AFTER, LAYOUT_NEWLINE_BEFORE, LAYOUT_RIGHT, LAYOUT_SHRINK, LAYOUT_TOP, LAYOUT_VCENTER, LAYOUT_VEXPAND, LAYOUT_VSHRINK, PLAIN`

Constructor Summary
`Spacer(int minWidth, int minHeight)` Creates a new `Spacer` with the given minimum size.

Method Summary
`void` | `addCommand(Command cmd)` `Spacers` are restricted from having `Commands`, so this method will always throw `IllegalStateException` whenever it is called.
`void` | `setDefaultCommand(Command cmd)` Spacers are restricted from having `Commands`, so this method will always throw `IllegalStateException` whenever it is called.
`void` | `setLabel(String label)` `Spacers` are restricted to having `null` labels, so this method will always throw `IllegalStateException` whenever it is called.
`void` | `setMinimumSize(int minWidth, int minHeight)` Sets the minimum size for this spacer.

Methods inherited from class javax.microedition.lcdui.Item
`getLabel, getLayout, getMinimumHeight, getMinimumWidth, getPreferredHeight, getPreferredWidth, notifyStateChanged, removeCommand, setItemCommandListener, setLayout, setPreferredSize`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Spacer

    public Spacer(int minWidth,
                  int minHeight)

  Creates a new `Spacer` with the given minimum size. The `Spacer's` label is `null`. The minimum size must be zero or greater. If `minWidth` is greater than the implementation-defined maximum width, the maximum width will be used instead. If `minHeight` is greater than the implementation-defined maximum height, the maximum height will be used instead.

Parameters:
  `minWidth` - the minimum width in pixels
  `minHeight` - the minimum height in pixels
Throws:
  `IllegalArgumentException` - if either `minWidth` or `minHeight` is less than zero

Method Detail

### setMinimumSize

    public void setMinimumSize(int minWidth,
                               int minHeight)

  Sets the minimum size for this spacer. The `Form` will not be allowed to make the item smaller than this size. The minimum size must be zero or greater. If `minWidth` is greater than the implementation-defined maximum width, the maximum width will be used instead. If `minHeight` is greater than the implementation-defined maximum height, the maximum height will be used instead.

  Parameters:
    `minWidth` - the minimum width in pixels
    `minHeight` - the minimum height in pixels
  Throws:
    `IllegalArgumentException` - if either `minWidth` or `minHeight` is less than zero

### addCommand

    public void addCommand(Command cmd)

  `Spacers` are restricted from having `Commands`, so this method will always throw `IllegalStateException` whenever it is called.

  Overrides:
    `addCommand` in class `Item`
  Parameters:
    `cmd` - the `Command`
  Throws:
    `IllegalStateException` - always

### setDefaultCommand

    public void setDefaultCommand(Command cmd)

  Spacers are restricted from having `Commands`, so this method will always throw `IllegalStateException` whenever it is called.

  Overrides:
    `setDefaultCommand` in class `Item`
  Parameters:
    `cmd` - the `Command`
  Throws:
    `IllegalStateException` - always

### setLabel

    public void setLabel(String label)

  `Spacers` are restricted to having `null` labels, so this method will always throw `IllegalStateException` whenever it is called.

  Overrides:
    `setLabel` in class `Item`
  Parameters:
    `label` - the label string
  Throws:
    `IllegalStateException` - always
  See Also:
    `Item.getLabel()`

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

Submit a comment or suggestion Version 2.0 of MID Profile Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.