javax.swing.text.html

Class StyleSheet.BoxPainter

public static class StyleSheet.BoxPainter extends Object implements Serializable

This class carries out some of the duties of CSS formatting. This enables views to present the CSS formatting while not knowing how the CSS values are cached. This object is reponsible for the insets of a View and making sure the background is maintained according to the CSS attributes.
Method Summary
floatgetInset(int size, View v)
Gets the inset needed on a given side to account for the margin, border and padding.
voidpaint(Graphics g, float x, float y, float w, float h, View v)
Paints the CSS box according to the attributes given.

Method Detail

getInset

public float getInset(int size, View v)
Gets the inset needed on a given side to account for the margin, border and padding.

Parameters: size - the size of the box to get the inset for. View.TOP, View.LEFT, View.BOTTOM or View.RIGHT. v - the view making the request. This is used to get the AttributeSet, amd may be used to resolve percentage arguments.

Returns: the inset

Throws: IllegalArgumentException - for an invalid direction.

paint

public void paint(Graphics g, float x, float y, float w, float h, View v)
Paints the CSS box according to the attributes given. This should paint the border, padding and background.

Parameters: g - the graphics configuration x - the x coordinate y - the y coordinate w - the width of the allocated area h - the height of the allocated area v - the view making the request