|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.lwuit.plaf.Border
public class Border
Base class that allows us to render a border for a component, a border is drawn before the component and is drawn within the padding region of the component. It is the responsibility of the component not to draw outside of the border line.
This class can be extended to provide additional border types and custom made border types.
A border can optionally paint the background of the component, this depends on the border type and is generally required for rounded borders that "know" the area that should be filled.
Constructor Summary | |
---|---|
Border()
|
Method Summary | |
---|---|
static Border |
createBevelLowered()
Creates a lowered bevel border with default colors, highlight is derived from the component and shadow is a plain dark color. |
static Border |
createBevelLowered(Color highlightOuter,
Color highlightInner,
Color shadowOuter,
Color shadowInner)
Creates a raised bevel border with the given colors. |
static Border |
createBevelRaised()
Creates a lowered bevel border with default colors, highlight is derived from the component and shadow is a plain dark color. |
static Border |
createBevelRaised(Color highlightOuter,
Color highlightInner,
Color shadowOuter,
Color shadowInner)
Creates a raised bevel border with the given colors. |
static Border |
createEmpty()
Creates an empty border, this is useful where we don't want a border for a component but want a focus border etc... |
static Border |
createEtchedLowered()
Creates a lowered etched border with default colors, highlight is derived from the component and shadow is a plain dark color. |
static Border |
createEtchedLowered(Color highlight,
Color shadow)
Creates a raised etched border with the given colors. |
static Border |
createEtchedRaised()
Creates a lowered etched border with default colors, highlight is derived from the component and shadow is a plain dark color. |
static Border |
createEtchedRaised(Color highlight,
Color shadow)
Creates a raised etched border with the given colors. |
static Border |
createImageBorder(Image top,
Image topLeft,
Image background)
The given images are tiled appropriately across the matching side of the border, rotated and placed as expected in the four corners. |
static Border |
createImageBorder(Image top,
Image bottom,
Image left,
Image right,
Image topLeft,
Image topRight,
Image bottomLeft,
Image bottomRight,
Image background)
The given images are tiled appropriately across the matching side of the border and placed as expected in the four corners. |
static Border |
createLineBorder(int thickness)
Creates a line border that uses the color of the component foreground for drawing. |
static Border |
createLineBorder(int thickness,
Color color)
Creates a line border that uses the given color for the component. |
Border |
createPressedVersion()
When applied to buttons borders produce a version that reverses the effects of the border providing a pressed feel. |
static Border |
createRoundBorder(int arcWidth,
int arcHeight)
Creates a rounded corner border that uses the color of the component foreground for drawing. |
static Border |
createRoundBorder(int arcWidth,
int arcHeight,
Color color)
Creates a rounded border that uses the given color for the component. |
static Border |
getDefaultBorder()
Gets the default border to the given value. |
static Border |
getEmpty()
Returns an empty border, this is mostly useful for overriding components that have a border by default. |
Border |
getFocusedInstance()
Returns the focused version of the border if one is installed. |
Border |
getPressedInstance()
Returns the pressed version of the border if one is set by the user. |
boolean |
isBackgroundPainter()
Returns true if installing this border will override the painting of the component background. |
void |
paint(Graphics g,
Component c)
Draws the border for the given component, this method is called before a call to background painting is made. |
void |
paintBorderBackground(Graphics g,
Component c)
Has effect when the border demands responsibility for background painting normally the painter will perform this work but in this case the border might do it instead. |
static void |
setDefaultBorder(Border border)
Sets the default border to the given value. |
void |
setFocusedInstance(Border focused)
Allows us to define a border that will act as the focused version of this border. |
void |
setPressedInstance(Border pressed)
Allows us to define a border that will act as the pressed version of this border. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Border()
Method Detail |
---|
public static Border getEmpty()
public static Border createEmpty()
public static Border createImageBorder(Image top, Image bottom, Image left, Image right, Image topLeft, Image topRight, Image bottomLeft, Image bottomRight, Image background)
By default this border does not override background unless a background image is specified.
top
- the Image for the top sidebottom
- the Image for the bottom sideleft
- the Image for the left sideright
- the Image for the right sidetopLeft
- the Image for the top left cornertopRight
- the Image for the top right cornerbottomLeft
- the Image for the bottom left cornerbottomRight
- the Image for the bottom right cornerbackground
- the Image for the background
public static Border createImageBorder(Image top, Image topLeft, Image background)
By default this border does not override background unless a background image is specified.
Notice that this version of the method is potentially much more efficient since images are rotated internally and this might save quite a bit of memory!
The top and topLeft images must be square! The width and height of these images must be equal otherwise rotation won't work as you expect.
top
- the Image for the top sidetopLeft
- the Image for the top left cornerbackground
- the Image for the background
public static Border createLineBorder(int thickness)
thickness
- thickness of the border in pixels
public static Border createLineBorder(int thickness, Color color)
thickness
- thickness of the border in pixelscolor
- the color for the border
public static Border createRoundBorder(int arcWidth, int arcHeight)
This border overrides any painter used on the component and would ignore such a painter.
arcWidth
- the horizontal diameter of the arc at the four corners.arcHeight
- the vertical diameter of the arc at the four corners.
public static Border createRoundBorder(int arcWidth, int arcHeight, Color color)
This border overrides any painter used on the component and would ignore such a painter.
arcWidth
- the horizontal diameter of the arc at the four corners.arcHeight
- the vertical diameter of the arc at the four corners.color
- the color for the border
public static Border createEtchedLowered()
public static Border createEtchedLowered(Color highlight, Color shadow)
highlight
- color RGB valueshadow
- color RGB value
public static Border createEtchedRaised()
public static Border createEtchedRaised(Color highlight, Color shadow)
highlight
- color RGB valueshadow
- color RGB value
public boolean isBackgroundPainter()
public static Border createBevelLowered()
public static Border createBevelLowered(Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner)
highlightOuter
- RGB of the outer edge of the highlight areahighlightInner
- RGB of the inner edge of the highlight areashadowOuter
- RGB of the outer edge of the shadow areashadowInner
- RGB of the inner edge of the shadow area
public static Border createBevelRaised()
public static Border createBevelRaised(Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner)
highlightOuter
- RGB of the outer edge of the highlight areahighlightInner
- RGB of the inner edge of the highlight areashadowOuter
- RGB of the outer edge of the shadow areashadowInner
- RGB of the inner edge of the shadow area
public void setPressedInstance(Border pressed)
pressed
- a border that will be returned by the pressed version methodgetPressedInstance()
public void setFocusedInstance(Border focused)
focused
- a border that will be returned by the focused version methodgetFocusedInstance()
public Border getFocusedInstance()
setFocusedInstance(com.sun.dtv.lwuit.plaf.Border)
public Border getPressedInstance()
setPressedInstance(com.sun.dtv.lwuit.plaf.Border)
public Border createPressedVersion()
public void paintBorderBackground(Graphics g, Component c)
g
- graphics context to draw ontoc
- component whose border should be drawnpublic void paint(Graphics g, Component c)
g
- graphics context to draw ontoc
- component whose border should be drawnpublic static void setDefaultBorder(Border border)
border
- new border valuegetDefaultBorder()
public static Border getDefaultBorder()
setDefaultBorder(com.sun.dtv.lwuit.plaf.Border)
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |