Package totalcross.ui
Class Whiteboard
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Whiteboard
-
public class Whiteboard extends Control
This is a whiteboard that can be used to draw something. It uses a special event flag in order to improve the accuracy.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description intborderColorSet this to some color so a frame can be drawn around the imagebooleanthickSet to true to draw a thick line.booleanuseAADeprecated.This field is useless in OpenGL platforms-
Fields inherited from class totalcross.ui.Control
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, nextTabControl, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Constructor Description Whiteboard()Constructs a new whiteboard, setting the back color to white.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the WhiteBoard to the current background color.ImagegetImage()Returns the image where the drawing is taking place.intgetPenColor()Returns the drawing pen color.intgetPreferredHeight()Returns the preferred height: FILLintgetPreferredWidth()Returns the preferred width: FILLvoidonBoundsChanged(boolean screenChanged)Now that we know our bounds, we can create the image that will hold the drawingvoidonEvent(Event event)Called to process key, pen, control and other posted events.voidonPaint(Graphics g)Called to draw the control.voidsetImage(Image image)Sets the image for this WhiteBoard.voidsetPenColor(int c)Sets the drawing pen color-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addGridListener, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addTimer, addTimer, addTimerListener, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onColorsChanged, onFontChanged, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
borderColor
public int borderColor
Set this to some color so a frame can be drawn around the image
-
useAA
@Deprecated public boolean useAA
Deprecated.This field is useless in OpenGL platformsSet to true to enable antialiase on the line drawing. It must be set right after the constructor.
-
thick
public boolean thick
Set to true to draw a thick line.- Since:
- TotalCross 1.14
-
-
Method Detail
-
onBoundsChanged
public void onBoundsChanged(boolean screenChanged)
Now that we know our bounds, we can create the image that will hold the drawing- Overrides:
onBoundsChangedin classControl- Parameters:
screenChanged- If the bounds were changed due to a screen change (rotation, collapse)
-
getImage
public Image getImage()
Returns the image where the drawing is taking place.
-
getPreferredWidth
public int getPreferredWidth()
Returns the preferred width: FILL- Overrides:
getPreferredWidthin classControl
-
getPreferredHeight
public int getPreferredHeight()
Returns the preferred height: FILL- Overrides:
getPreferredHeightin classControl
-
setImage
public void setImage(Image image) throws ImageException
Sets the image for this WhiteBoard. Pass null to create an empty image.- Throws:
ImageException
-
clear
public void clear()
Clears the WhiteBoard to the current background color.
-
setPenColor
public void setPenColor(int c)
Sets the drawing pen color
-
getPenColor
public int getPenColor()
Returns the drawing pen color.
-
onPaint
public void onPaint(Graphics g)
Description copied from class:ControlCalled to draw the control. When this method is called, the graphics object passed has been translated into the coordinate system of the control and the area behind the control has already been painted.
-
-