|
|||||||||
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 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 |
public static final byte NORMAL
public static final byte BUTTON
public static final byte CHECK
public int maxWidth
Constructor Detail |
public PushButtonGroup(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.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 6.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 CHECKMethod Detail |
public void setSimpleBorder(boolean simple)
public int getSelected()
public 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 drawingGraphics
public void setSelected(int ind)
public void onEvent(Event event)
event
- the event to processEvent
,
KeyEvent
,
PenEvent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |