Class Image

java.lang.Object
com.groiss.gui.AbstractComponent
com.groiss.gui.component.Image
All Implemented Interfaces:
Component, Serializable, Cloneable

public class Image extends AbstractComponent
A HTML image (img) element.
See Also:
  • Constructor Details

    • Image

      public Image()
      Constructs a new empty image.
    • Image

      public Image(String src)
      Constructor with image url
      Parameters:
      src - the image url
    • Image

      public Image(String src, String alt)
      Constructor with image url
      Parameters:
      src - the image url
      alt - the alternative text
    • Image

      public Image(String src, String alt, String styleClass)
      Constructor with image url
      Parameters:
      src - the image url
      alt - the alternative text
      styleClass - the name of a CSS class
    • Image

      public Image(String name, String src, int width, int height, String alt)
      Constructor with image url
      Parameters:
      name -
      src -
      width -
      height -
      alt -
  • Method Details

    • setSize

      public void setSize(int width, int height)
      sets the size of the image
      Parameters:
      width - - the width of the image
      height - - the height of the image
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • setAltText

      public void setAltText(String alt)
      sets the alternative text - attribute "title" if image is rendered this text is the tooltip text else it is the alternative text instead of the image
      Parameters:
      alt - - the alternative text
    • getAltText

      public String getAltText()
    • setSource

      public void setSource(String src)
      sets the source of the image
      Parameters:
      src - - the sourcepath of the image file
    • getSource

      public String getSource()
    • setBorder

      public void setBorder(int border)
      sets the thickness of the border around the displayed image
      Parameters:
      border - - the thickness of the border
    • getBorder

      public int getBorder()
    • setText

      public void setText(String text)
      sets the text
      Parameters:
      text - - the text String
    • getText

      public String getText()
    • setContent

      public void setContent(Object o)
      sets the content of the component
      Specified by:
      setContent in interface Component
      Overrides:
      setContent in class AbstractComponent
      Parameters:
      o - any object where the string representation is used for rendering
    • getContent

      public Object getContent()
      Specified by:
      getContent in interface Component
      Overrides:
      getContent in class AbstractComponent
      Returns:
      the content object of the component