Package totalcross.ui
Class NinePatch
- java.lang.Object
-
- totalcross.ui.NinePatch
-
public class NinePatch extends java.lang.ObjectNinePatch is a class that creates a button of any size by dividing a sample button into 9 parts: the 4 corners, the 4 sides, and the middle. Corner are drawn unscaled, sides are resized in a single direction, and the middle is resized, colorized and then dithered. This class is thread-safe.- Since:
- TotalCross 1.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classNinePatch.Parts
-
Field Summary
Fields Modifier and Type Field Description static intBUTTONstatic intCOMBOBOXstatic intEDITstatic intGRIDstatic intLISTBOXstatic intMULTIBUTTONstatic intMULTIEDITstatic intpressColorAlgorithmDefines if we will use the Image.applyColor (1) or Image.applyColor2 (2) algorithms when getting the pressed instance.static intPROGRESSBARHstatic intPROGRESSBARVstatic intSCROLLPOSHstatic intSCROLLPOSVstatic intTABstatic intTAB2
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()static NinePatchgetInstance()ImagegetNormalInstance(int type, int width, int height, int color, boolean rotate)ImagegetNormalInstance(NinePatch.Parts p, int width, int height, int color, boolean rotate)ImagegetPressedInstance(Image img, int backColor, int pressColor)NinePatch.Partsload(Image original, int corner, int side)static voidtryDrawImage(Graphics g, Image npback, int x, int y)Used internally to prevent Out of Memory errors.
-
-
-
Field Detail
-
BUTTON
public static final int BUTTON
- See Also:
- Constant Field Values
-
EDIT
public static final int EDIT
- See Also:
- Constant Field Values
-
COMBOBOX
public static final int COMBOBOX
- See Also:
- Constant Field Values
-
LISTBOX
public static final int LISTBOX
- See Also:
- Constant Field Values
-
MULTIEDIT
public static final int MULTIEDIT
- See Also:
- Constant Field Values
-
PROGRESSBARV
public static final int PROGRESSBARV
- See Also:
- Constant Field Values
-
PROGRESSBARH
public static final int PROGRESSBARH
- See Also:
- Constant Field Values
-
SCROLLPOSH
public static final int SCROLLPOSH
- See Also:
- Constant Field Values
-
SCROLLPOSV
public static final int SCROLLPOSV
- See Also:
- Constant Field Values
-
TAB
public static final int TAB
- See Also:
- Constant Field Values
-
GRID
public static final int GRID
- See Also:
- Constant Field Values
-
TAB2
public static final int TAB2
- See Also:
- Constant Field Values
-
MULTIBUTTON
public static final int MULTIBUTTON
- See Also:
- Constant Field Values
-
pressColorAlgorithm
public static int pressColorAlgorithm
Defines if we will use the Image.applyColor (1) or Image.applyColor2 (2) algorithms when getting the pressed instance.
-
-
Method Detail
-
getInstance
public static NinePatch getInstance()
-
load
public NinePatch.Parts load(Image original, int corner, int side)
-
getNormalInstance
public Image getNormalInstance(NinePatch.Parts p, int width, int height, int color, boolean rotate) throws ImageException
- Throws:
ImageException
-
getNormalInstance
public Image getNormalInstance(int type, int width, int height, int color, boolean rotate) throws ImageException
- Throws:
ImageException
-
getPressedInstance
public Image getPressedInstance(Image img, int backColor, int pressColor) throws ImageException
- Throws:
ImageException
-
flush
public void flush()
-
-