Class pvWinJ.PVRoundButton
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----pvWinJ.PVButton
|
+----pvWinJ.PVRoundButton
- public class PVRoundButton
- extends PVButton
The PVRoundButton class is designed to implement a windows
button behavior.
It paints a button with rounded corners. The shape, depth of 3D
effect, colors, size of the center area with solid colors, etc.
can be customized through get/setPropertyName() methods.
The PVRoundButton inherits behaviour, text painting styles and
shadow style from the PVButton. It means that most methods for
the PVButton are also valid for the PVRoundButton.
PVRoundButton supports ActionListener and MouseListener
interfaces.
When the property canKeepPressed is set to false, then the
actionPerformed is fired when the mouse button is released;
othewise the actionPerformed is fired when the mouse button is
pressed.
Example to insert an instance of the PVRoundButton class in an
applet and set some properties:
public void init()
{
setSize(580, 400);
setLayout(null);
PVRoundButton butt = new PVRoundButton("PVButton1",
20);
add(butt);
butt.setTextPressed("Pressed");
butt.setAureole(true);
butt.setCanKeepPressed(true);
butt.setCenterArea(2);
butt.setBackColor(Color.orange);
butt.setShape(2);
butt.setBounds(5, 40, 150, 30);
...
}
Notes:
To set/get background color, the get/setBackColor() should be
used rather than the get/setBackground().
When font with aureole is enabled, then the text 3D effect is
disabled.
PVRoundButton()
- Constructor.
PVRoundButton(String)
- Constructor.
PVRoundButton(String,
int)
- Constructor.
getCenterArea()
- Get size of the solid center area.
getColorsDepth()
- Get the depth of the button shadows.
getShape()
- Get shape of the button.
setCenterArea(int)
- Set the size of the center area with a solid color.
setColorsDepth(int)
- The range of colors to create the button 3D appearance.
setShape(int)
- Set the shape of the button.
PVRoundButton
public PVRoundButton(String text,
int fontSize)
- Constructor. Other properties are set:
font - "Arial", bold;
textPressed - null (the same as text);
enabled - true;
canKeepPressed - false;
threeButtonStates - true;
switchColorsOnPress - false;
switchShadowOnPress - false;
fontWithAureole - false;
focusRect - false;
shape - 7;
text3D horizontal - -1;
text3D vertical - -1;
shadow - 0(no shadow);
shadowWidth - 5;
foreground - black;
backColor - lightGray;
shadowColor - gray;
text3DColor - white.
PVRoundButton
public PVRoundButton(String text)
- Constructor.
The font size is set to 12.
PVRoundButton
public PVRoundButton()
- Constructor.
It calls this("Button");
getColorsDepth
public int getColorsDepth()
- Get the depth of the button shadows.
- Returns:
- The depth of the button 3D appearance.
- See Also:
- setColorsDepth
setColorsDepth
public void setColorsDepth(int colorsDepth)
- The range of colors to create the button 3D appearance.
- Parameters:
- colorsDepth - the depth of shadows to create the
button 3D appearance.
The range of values: 0..5.
The larger value, the deepper shadows of the 3D
effect.
Default value - 3.
- See Also:
- getColorsDepth, setCenterArea, setShape
getCenterArea
public int getCenterArea()
- Get size of the solid center area.
- Returns:
- The size of the center 3D area on the button.
- See Also:
- setCenterArea
setCenterArea
public void setCenterArea(int sizeOfCenterArea)
- Set the size of the center area with a solid color.
- Parameters:
- sizeOfCenterArea - size of the center area with
solid color.
The range of values: 0..8. The larger value, the
larger center area.
Default value - 3.
- See Also:
- getCenterArea, setColorsDepth, setShape
getShape
public int getShape()
- Get shape of the button.
- Returns:
- The shape of the button.
- See Also:
- setShape
setShape
public void setShape(int shape)
- Set the shape of the button.
- Parameters:
- shape - of the button.
The range of values: 0..5. The larger value, the
closer button edges to a circle. The smaller
value, the closer the button shape to a
rectangle.
Default value - 4.
- See Also:
- getShape, setColorsDepth, setCenterArea