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

## waba.ui
Class PushButtonGroup

    java.lang.Object
      |
      +--waba.ui.Control
            |
            +--waba.ui.PushButtonGroup

public class PushButtonGroup
extends Control

Group or matrix of pushbuttons in just one control. Is one of the most versatiles controls of SuperWaba. Created by guich from the original WExtras class Pushbutton of Stefan Kellner. here is a example of constructor: `new PushButtonGroup(new String[]{"Button1","Button2","Button3"},false,-1,-1,4,0,false,PushButtonGroup.NORMAL)`

Note: the width of each button is calculated based on its caption size plus the insideGap. Now, the height is calculated based on the font's size or on the height you specified.

Field Summary
`static byte` | `BUTTON` the button will be selected and de-selected immediatly, acting like a real button
`static byte` | `CHECK` one click in the button will select it and another click will unselect it.
`int` | `maxWidth`
`static byte` | `NORMAL` normal: only one selected at a time

Fields inherited from class waba.ui.Control
`AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2`

Constructor Summary
`PushButtonGroup(String[] names, boolean atLeastOne, int selected, int gap, int insideGap, int rows, boolean allSameWidth, byte type)` create the buttons.

Method Summary
`int` | `getPreferredHeight()` Returns the preffered height of this control.
`int` | `getPreferredWidth()` Returns the preffered width of this control.
`int` | `getSelected()` returns the index of the selected button
`void` | `onBoundsChanged()` Called after an setRect.
`protected void` | `onColorsChanged(boolean colorsChanged)` Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.
`void` | `onEvent(Event event)` Called to process key, pen, control and other posted events.
`protected void` | `onFontChanged()` Called after a setFont
`void` | `onPaint(Graphics g)` Called to draw the control.
`void` | `setCursorColor(Color color)` Sets the cursor color for this PushButtonGroup.
`void` | `setSelected(int ind)` sets the selected button index.
`void` | `setSimpleBorder(boolean simple)` uses the old style border

Methods inherited from class waba.ui.Control
`addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible`

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

Field Detail

### NORMAL

    public static final byte NORMAL

  normal: only one selected at a time

### BUTTON

    public static final byte BUTTON

  the button will be selected and de-selected immediatly, acting like a real button

### CHECK

    public static final byte CHECK

  one click in the button will select it and another click will unselect it. However, only one button can be selected at a time

### maxWidth

    public int maxWidth

Constructor Detail

### PushButtonGroup

    public PushButtonGroup(String[] names,
                           boolean atLeastOne,
                           int selected,
                           int gap,
                           int insideGap,
                           int rows,
                           boolean allSameWidth,
                           byte type)

  create the buttons.
  Parameters:
    `names` - captions of the buttons. You can specify some names as null so the button is not displayed. This is good if you're creating a button matrix and want to hide some buttons.
    `atLeastOne` - if true, at least one button must be selected
    `selected` - default index to appear selected, or -1 if none
    `gap` - space between the buttons, -1 glue them.
    `insideGap` - space between the text and the button border. the ideal is 6.
    `rows` - if > 1, creates a button matrix
    `allSameWidth` - if true, all the buttons will have the width of the most large one.
    `type` - can be NORMAL, BUTTON or CHECK

Method Detail

### setSimpleBorder

    public void setSimpleBorder(boolean simple)

  uses the old style border

### getSelected

    public int getSelected()

  returns the index of the selected button

### setCursorColor

    public void setCursorColor(Color color)

  Sets the cursor color for this PushButtonGroup. The default is equal to the background slightly darker. Make sure you tested it in 2,4 and 8bpp devices.

### getPreferredWidth

    public int getPreferredWidth()

  Description copied from class: Control
  Returns the preffered width of this control.
  Overrides:
    getPreferredWidth in class Control

### getPreferredHeight

    public int getPreferredHeight()

  Description copied from class: Control
  Returns the preffered height of this control.
  Overrides:
    getPreferredHeight in class Control

### onFontChanged

    protected void onFontChanged()

  Description copied from class: Control
  Called after a setFont
  Overrides:
    onFontChanged in class Control

### onColorsChanged

    protected void onColorsChanged(boolean colorsChanged)

  Description copied from class: Control
  Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled
  Overrides:
    onColorsChanged in class Control

### onBoundsChanged

    public void onBoundsChanged()

  Description copied from class: Control
  Called after an setRect.
  Overrides:
    onBoundsChanged in class Control

### onPaint

    public void onPaint(Graphics g)

  Description copied from class: Control
  Called to draw the control. When this method is called, the graphics object passed has been translated into the coordinate system of the control and the area behind the control has already been painted. The background is painted by the top-level window control.
  Overrides:
    onPaint in class Control
  Tags copied from class: Control
  Parameters:
    `g` - the graphics object for drawing
  See Also:
    `Graphics`

### setSelected

    public void setSelected(int ind)

  sets the selected button index. Note. if there are any null buttons, you must count them too to compute the correct index.

### onEvent

    public void onEvent(Event event)

  Description copied from class: Control
  Called to process key, pen, control and other posted events.
  Overrides:
    onEvent in class Control
  Tags copied from class: Control
  Parameters:
    `event` - the event to process
  See Also:
    `Event`, `KeyEvent`, `PenEvent`

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