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.


Constructor Index

 o PVRoundButton()
Constructor.
 o PVRoundButton(String)
Constructor.
 o PVRoundButton(String, int)
Constructor.

Method Index

 o getCenterArea()
Get size of the solid center area.
 o getColorsDepth()
Get the depth of the button shadows.
 o getShape()
Get shape of the button.
 o setCenterArea(int)
Set the size of the center area with a solid color.
 o setColorsDepth(int)
The range of colors to create the button 3D appearance.
 o setShape(int)
Set the shape of the button.

Constructors

 o 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.

 o PVRoundButton

 public PVRoundButton(String text)
Constructor.
The font size is set to 12.

 o PVRoundButton

 public PVRoundButton()
Constructor.
It calls this("Button");

Methods

 o getColorsDepth

 public int getColorsDepth()
Get the depth of the button shadows.
Returns:
The depth of the button 3D appearance.
See Also:
setColorsDepth

 o 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

 o 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

 o 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

 o getShape

 public int getShape()
Get shape of the button.
Returns:
The shape of the button.
See Also:
setShape

 o 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