Package de.gurkenlabs.litiengine.gui
Class ImageComponent
java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
de.gurkenlabs.litiengine.gui.ImageComponent
- All Implemented Interfaces:
IRenderable
,Tweenable
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.util.EventListener
- Direct Known Subclasses:
CheckBox
,MouseDrawComponent
,TextFieldComponent
public class ImageComponent
extends GuiComponent
Field Summary
Fields Modifier and Type Field Description static int
BACKGROUND_DISABLED_INDEX
static int
BACKGROUND_HOVER_INDEX
static int
BACKGROUND_INDEX
static int
BACKGROUND_PRESSED_INDEX
Constructor Summary
Constructors Constructor Description ImageComponent(double x, double y, double width, double height)
ImageComponent(double x, double y, double width, double height, Spritesheet spritesheet, java.lang.String text, java.awt.Image image)
ImageComponent(double x, double y, double width, double height, java.awt.Image image)
ImageComponent(double x, double y, double width, double height, java.lang.String text)
ImageComponent(double x, double y, java.awt.Image image)
Method Summary
Modifier and Type Method Description java.awt.Image
getBackground()
java.awt.image.BufferedImage
getImage()
Align
getImageAlign()
ImageScaleMode
getImageScaleMode()
Valign
getImageValign()
protected Spritesheet
getSpritesheet()
void
render(java.awt.Graphics2D g)
Renders the visual contents of this instance onto the provided graphics context.void
rescaleImage()
void
setHeight(double height)
Sets the GuiComponent's height.void
setImage(java.awt.Image image)
void
setImageAlign(Align imageAlign)
void
setImageScaleMode(ImageScaleMode imageScaleMode)
void
setImageValign(Valign imageValign)
void
setSpriteSheet(Spritesheet spr)
void
setWidth(double width)
Sets the GuiComponent's width.Methods inherited from class de.gurkenlabs.litiengine.gui.GuiComponent
drawTextShadow, getAppearance, getAppearanceDisabled, getAppearanceHovered, getBoundingBox, getClickConsumer, getComponentId, getComponents, getCurrentAppearance, getFont, getHeight, getHoverConsumer, getHoverSound, getLocation, getMouseDraggedConsumer, getMouseEnterConsumer, getMouseLeaveConsumer, getMouseMovedConsumer, getMousePressedConsumer, getMouseReleasedConsumer, getMouseWheelConsumer, getName, getShape, getTag, getText, getTextAlign, getTextAngle, getTextShadowColor, getTextShadowStroke, getTextToRender, getTextValign, getTextX, getTextY, getTweenValues, getWidth, getX, getY, hasAutomaticLineBreaks, hasTextAntialiasing, initializeComponents, isEnabled, isForwardMouseEvents, isHovered, isPressed, isSelected, isSuspended, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseEventShouldBeForwarded, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onClicked, onHovered, onMouseDragged, onMouseEnter, onMouseLeave, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelScrolled, onTextChanged, prepare, setAutomaticLineBreaks, setDimension, setEnabled, setFont, setFontSize, setForwardMouseEvents, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setText, setTextAlign, setTextAngle, setTextAntialiasing, setTextShadow, setTextShadowColor, setTextShadowStroke, setTextValign, setTextX, setTextY, setTweenValues, setVisible, setX, setY, suspend, toggleSelection, toggleSuspension
Field Details
BACKGROUND_INDEX
public static final int BACKGROUND_INDEX- See Also:
- Constant Field Values
BACKGROUND_HOVER_INDEX
public static final int BACKGROUND_HOVER_INDEX- See Also:
- Constant Field Values
BACKGROUND_PRESSED_INDEX
public static final int BACKGROUND_PRESSED_INDEX- See Also:
- Constant Field Values
BACKGROUND_DISABLED_INDEX
public static final int BACKGROUND_DISABLED_INDEX- See Also:
- Constant Field Values
Constructor Details
ImageComponent
public ImageComponent(double x, double y, java.awt.Image image)ImageComponent
public ImageComponent(double x, double y, double width, double height)ImageComponent
public ImageComponent(double x, double y, double width, double height, java.lang.String text)ImageComponent
public ImageComponent(double x, double y, double width, double height, java.awt.Image image)ImageComponent
public ImageComponent(double x, double y, double width, double height, Spritesheet spritesheet, java.lang.String text, java.awt.Image image)
Method Details
getBackground
public java.awt.Image getBackground()rescaleImage
public void rescaleImage()getImage
public java.awt.image.BufferedImage getImage()getImageAlign
getImageScaleMode
getImageValign
render
public void render(java.awt.Graphics2D g)Description copied from interface:IRenderable
Renders the visual contents of this instance onto the provided graphics context.If an
Entity
implements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.This interface can be implemented in general by anything that should be rendered to the game's screen.
- Specified by:
render
in interfaceIRenderable
- Overrides:
render
in classGuiComponent
- Parameters:
g
- The current graphics object onto which this instance will render its visual contents.- See Also:
RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
setImage
public void setImage(java.awt.Image image)setImageScaleMode
setSpriteSheet
setImageAlign
setImageValign
setHeight
public void setHeight(double height)Description copied from class:GuiComponent
Sets the GuiComponent's height.- Overrides:
setHeight
in classGuiComponent
- Parameters:
height
- the new height
setWidth
public void setWidth(double width)Description copied from class:GuiComponent
Sets the GuiComponent's width.- Overrides:
setWidth
in classGuiComponent
- Parameters:
width
- the new width
getSpritesheet