public class ImageControl extends Control
Control.TranslucentShape
Modifier and Type | Field and Description |
---|---|
boolean |
allowBeyondLimits
Set to true to let the image be dragged beyond container limits.
|
int |
borderColor
Change this member to set the border color.
|
boolean |
centerImage
Set to true to center the image in the control when it is loaded
|
int |
drawOp
Dumb field to keep compilation compatibility with TC 1
|
boolean |
hwScale
Set to true to enable zooming in open gl devices.
|
int |
lastX
The last position used for X and Y.
|
int |
lastY
The last position used for X and Y.
|
boolean |
scaleToFit
Set to true to scale the image to fit the bounds.
|
static int |
scrollValue
The amount to scroll when in penless mode.
|
boolean |
strechImage
Set to true, with scaleToFit, to strech the image.
|
ImageControlTarget |
target |
double |
tempHwScale
Temporary values to set the hwScaleW/hwScaleH to during draw.
|
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
Constructor and Description |
---|
ImageControl()
Constructs with no initial image.
|
ImageControl(Image img)
Constructs an ImageControl using the given image.
|
Modifier and Type | Method and Description |
---|---|
Image |
getBackground()
Returns the background image set with setBackground
|
Image |
getImage()
Returns the current image assigned to this ImageControl.
|
int |
getImageHeight()
Returns the image's height; when scaling, returns the scaled height.
|
int |
getImageWidth()
Returns the image's width; when scaling, returns the scaled width.
|
Image |
getOriginalImage()
Returns the original image assigned to this ImageControl.
|
int |
getPreferredHeight()
Returns the preferred height of this control.
|
int |
getPreferredWidth()
Returns the preferred width of this control.
|
Image |
getVisibleImage(boolean includeBackground)
Gets an image representing the portion being shown.
|
Control |
handleGeographicalFocusChangeKeys(KeyEvent ke)
Used by the main event loop to give the currently focused control an opportunity to act directly on
the KeyEvent.
|
boolean |
moveTo(int newX,
int newY)
Moves to the given coordinates, respecting the current moving policy regarding allowBeyondLimits.
|
protected void |
onBoundsChanged(boolean screenChanged)
Called after a setRect.
|
void |
onEvent(Event event)
Called to process key, pen, control and other posted events.
|
void |
onPaint(Graphics g)
Called to draw the control.
|
void |
setBackground(Image img)
Sets the given image as a freezed background of this image control.
|
void |
setEventsEnabled(boolean enabled)
Pass true to enable dragging and events on the image.
|
void |
setImage(Image img)
Sets the image to the given one.
|
void |
setImage(Image img,
boolean resetPositions)
Sets the image to the given one, optionally resetting the image position.
|
void |
setPressedEventsEnabled(boolean enabled)
Pass true to enable this ImageControl to send Press events.
|
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, clear, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, 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, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onColorsChanged, onFontChanged, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setEnabled, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
public static int scrollValue
public boolean centerImage
public int lastX
public int lastY
public int borderColor
public boolean allowBeyondLimits
public int drawOp
public boolean hwScale
public double tempHwScale
public boolean scaleToFit
public boolean strechImage
public ImageControlTarget target
public ImageControl(Image img)
public ImageControl()
public void setEventsEnabled(boolean enabled)
public void setPressedEventsEnabled(boolean enabled)
public void setImage(Image img)
public void setImage(Image img, boolean resetPositions)
public void onEvent(Event event)
Control
public boolean moveTo(int newX, int newY)
protected void onBoundsChanged(boolean screenChanged)
Control
onBoundsChanged
in class Control
screenChanged
- If the bounds were changed due to a screen change (rotation, collapse)public void onPaint(Graphics g)
Control
public int getImageWidth()
public int getImageHeight()
public int getPreferredWidth()
Control
getPreferredWidth
in class Control
public int getPreferredHeight()
Control
getPreferredHeight
in class Control
public Image getImage()
public Image getOriginalImage()
public void setBackground(Image img)
public Image getBackground()
public Image getVisibleImage(boolean includeBackground) throws ImageException
ImageException
public Control handleGeographicalFocusChangeKeys(KeyEvent ke)
Control
handleGeographicalFocusChangeKeys
in class Control
ke
- The KeyEvent to be processedSettings.geographicalFocus