|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--waba.ui.Control
|
+--waba.ui.PushButtonGroup
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 unselected immediatly, acting like a real button |
static byte |
CHECK
one click in the button will select it and another click will unselect it. |
boolean[] |
hidden
The boolean array that defines which buttons are hidden. |
int |
maxWidth
|
protected java.lang.String[] |
names
|
static byte |
NORMAL
normal: only one selected at a time |
| Fields inherited from class waba.ui.Control |
AFTER,
appId,
appObj,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
clearValueInt,
clearValueStr,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
focusTraversable,
font,
foreColor,
foreDis,
height,
highlightRectsCount,
isHighlighting,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
uiCE,
uiFlat,
uiPalm,
uiVista,
visible,
width,
x,
x2,
y,
y2 |
| Constructor Summary | |
PushButtonGroup(java.lang.String[] names,
boolean atLeastOne,
int selected,
int gap,
int insideGap,
int rows,
boolean allSameWidth,
byte type)
Create the button matrix. |
|
PushButtonGroup(java.lang.String[] names,
int gap,
int rows)
Create the button matrix, with insideGap = 4, selected = -1, atLeastOne = false, allSameWidth = true and type = BUTTON. |
|
PushButtonGroup(java.lang.String[] names,
int gap,
int insideGap,
int rows)
Create the button matrix, with selected = -1, atLeastOne = false, allSameWidth = false and type = BUTTON. |
|
| Method Summary | |
void |
clear()
Clears this control, selecting index clearValueInt. |
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 |
java.lang.String |
getSelectedCaption()
Returns the caption of the selected button, or null if no button is selected |
void |
onBoundsChanged()
Called after a 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 |
setColor(int index,
Color fore,
Color back)
Sets a button's index color. |
void |
setCursorColor(Color color)
Sets the cursor color for this PushButtonGroup. |
void |
setNames(java.lang.String[] newNames)
Sets the names. |
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,
changeHighlighted,
contains,
createGraphics,
drawHighlight,
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,
translateFromOrigin,
uiStyleChanged |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final byte NORMAL
public static final byte BUTTON
public static final byte CHECK
protected java.lang.String[] names
public int maxWidth
public boolean[] hidden
pbg.hidden[5] = true; // hides button 5
pbg.repaint();
| Constructor Detail |
public PushButtonGroup(java.lang.String[] names,
boolean atLeastOne,
int selected,
int gap,
int insideGap,
int rows,
boolean allSameWidth,
byte type)
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. You can also use the hidden property to dynamically show/hide buttons.atLeastOne - if true, at least one button must be selectedselected - default index to appear selected, or -1 if nonegap - space between the buttons, -1 glue them.insideGap - Space between the text and the button border. The ideal is 4. If allSameWidth is true, it is only used to compute the preferred width and may be overriden; otherwise, it is used as the internal gap.rows - if > 1, creates a button matrixallSameWidth - if true, all the buttons will have the width of the most large one.type - can be NORMAL, BUTTON or CHECK
public PushButtonGroup(java.lang.String[] names,
int gap,
int rows)
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. You can also use the hidden property to dynamically show/hide buttons.gap - space between the buttons, -1 glue them.rows - if > 1, creates a button matrix
public PushButtonGroup(java.lang.String[] names,
int gap,
int insideGap,
int rows)
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. You can also use the hidden property to dynamically show/hide buttons.gap - space between the buttons, -1 glue them.insideGap - Space between the text and the button border. The ideal is 4. If allSameWidth is true, it is only used to compute the preferred width and may be overriden; otherwise, it is used as the internal gap.rows - if > 1, creates a button matrix| Method Detail |
public void setNames(java.lang.String[] newNames)
public void setColor(int index,
Color fore,
Color back)
public void setSimpleBorder(boolean simple)
public int getSelected()
public java.lang.String getSelectedCaption()
null if no button is selectedpublic void setCursorColor(Color color)
public int getPreferredWidth()
public int getPreferredHeight()
protected void onFontChanged()
protected void onColorsChanged(boolean colorsChanged)
public void onBoundsChanged()
public void onPaint(Graphics g)
g - the graphics object for drawingGraphicspublic void setSelected(int ind)
public void onEvent(Event event)
event - the event to processEvent,
KeyEvent,
PenEventpublic void clear()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||