Package ej.widget.basic
Class ImageWidget
- java.lang.Object
-
- ej.mwt.Widget
-
- ej.widget.basic.ImageWidget
-
- Direct Known Subclasses:
ImageButton
public class ImageWidget extends ej.mwt.WidgetA widget that displays a resource image.The widget holds a path to the image. The actual image is allocated only when the widget is attached. It is also closed when the widget is detached.
-
-
Constructor Summary
Constructors Modifier Constructor Description ImageWidget(java.lang.String imagePath)Creates an image widget with the resource path of the image to display.protectedImageWidget(java.lang.String imagePath, boolean enabled)Creates an image widget with the resource path of the image to display and its enabled state.ImageWidget(java.lang.String imagePath, ej.microui.display.ResourceImage.OutputFormat outputFormat)Creates an image widget with the resource path of the image to display.protectedImageWidget(java.lang.String imagePath, ej.microui.display.ResourceImage.OutputFormat outputFormat, boolean enabled)Creates an image widget with the resource path of the image to display and its enabled state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeContentOptimalSize(ej.mwt.util.Size size)protected voidonAttached()protected voidonDetached()protected voidrenderContent(ej.microui.display.GraphicsContext g, int contentWidth, int contentHeight)voidsetImagePath(java.lang.String imagePath)Sets the image path.-
Methods inherited from class ej.mwt.Widget
addClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getContentBounds, getDesktop, getHeight, getParent, getStyle, getWidgetAt, getWidth, getX, getY, handleEvent, hasClassSelector, isAttached, isEnabled, isInState, isShown, isTransparent, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStyle, updateStyle
-
-
-
-
Constructor Detail
-
ImageWidget
public ImageWidget(java.lang.String imagePath)
Creates an image widget with the resource path of the image to display.- Parameters:
imagePath- the resource path of the image to display.- Throws:
java.lang.IllegalArgumentException- if the image cannot be loaded.- See Also:
ResourceImage.canLoadImage(String)
-
ImageWidget
public ImageWidget(java.lang.String imagePath, ej.microui.display.ResourceImage.OutputFormat outputFormat)Creates an image widget with the resource path of the image to display.- Parameters:
imagePath- the resource path of the image to display.outputFormat- the output format of the image to display.- Throws:
java.lang.IllegalArgumentException- if the image cannot be loaded.- See Also:
ResourceImage.canLoadImage(String)
-
ImageWidget
protected ImageWidget(java.lang.String imagePath, boolean enabled)Creates an image widget with the resource path of the image to display and its enabled state.- Parameters:
imagePath- the resource path of the image to display.enabled-trueif this image widget is to be enabled,falseotherwise.- Throws:
java.lang.IllegalArgumentException- if the image cannot be loaded.- See Also:
ResourceImage.canLoadImage(String)
-
ImageWidget
protected ImageWidget(java.lang.String imagePath, ej.microui.display.ResourceImage.OutputFormat outputFormat, boolean enabled)Creates an image widget with the resource path of the image to display and its enabled state.- Parameters:
imagePath- the resource path of the image to display.outputFormat- the output format of the image to display.enabled-trueif this image widget is to be enabled,falseotherwise.- Throws:
java.lang.IllegalArgumentException- if the image cannot be loaded.- See Also:
ResourceImage.canLoadImage(String)
-
-
Method Detail
-
onAttached
protected void onAttached()
- Overrides:
onAttachedin classej.mwt.Widget
-
onDetached
protected void onDetached()
- Overrides:
onDetachedin classej.mwt.Widget
-
setImagePath
public void setImagePath(java.lang.String imagePath)
Sets the image path.- Parameters:
imagePath- the resource path of the image to display.- Throws:
java.lang.IllegalArgumentException- if the image cannot be loaded.- See Also:
ResourceImage.canLoadImage(String)
-
renderContent
protected void renderContent(ej.microui.display.GraphicsContext g, int contentWidth, int contentHeight)- Specified by:
renderContentin classej.mwt.Widget
-
computeContentOptimalSize
protected void computeContentOptimalSize(ej.mwt.util.Size size)
- Specified by:
computeContentOptimalSizein classej.mwt.Widget
-
-