# Class: Label

### LuxModule: gui

A Label element for displaying only.

## Hierarchy

    o-+ Component
      o-+ Label
        o-- MultiLineLabel

## Methods:

### Method overview:

- LABEL_ALIGNBOTTOM
- LABEL_ALIGNCENTERED
- LABEL_ALIGNLEFT
- LABEL_ALIGNRIGHT
- LABEL_ALIGNTOP
- createVisibles
- deleteVisibles
- getAlignment
- getMaxLines
- getTabWidth
- getText
- isFocusable
- maxLineCount
- mouseClicked
- new
- onGainedFocus
- onTextChange
- positionUpdate
- setAlignment
- setFontColor
- setTabWidth
- setText
- textDimensions
- toString
- wrapLine

new (class, int x,y,w,h, text, [align, [autofocus] ])
  returns: (Label)
  creates a labelwith the given dimensions. The align value can be a constant from the Label table (Label_ALIGNRIGHT, ...).
LABEL_ALIGNBOTTOM
  [int] - constant for vertical text alignment at bottom
LABEL_ALIGNCENTERED
  [int] - constant for centered text alignment
LABEL_ALIGNLEFT
  [int] - constant for left text alignment
LABEL_ALIGNRIGHT
  [int] - constant for right text alignment
LABEL_ALIGNTOP
  [int] - constant for vertical text alignment at top
createVisibles (Component self,l2dnode basel2d)
  returns: ()

  description from overloaded method of Component:

  called when a Component is now displayable (doesn't have to be visible)
deleteVisibles (Component self)
  returns: ()

  description from overloaded method of Component:

  called when a Component is no longer displayed
getAlignment (Label)
  returns: (string alignment)
  returns current alignment of the label's text
getMaxLines (Label,[height=getHeight])
  returns: (lines)
  gets the maximum number of currently (or for height) visible lines
getTabWidth (Label)
  returns: (float)
  gets the label's tabwidth.
getText (Label)
  returns: (string)
  returns the string label
isFocusable (Label)
  returns: (boolean)
  returns true if visible
maxLineCount ([height])
  returns: (float lines)

  uses the current label's font and size to calculate how many lines can be displayed at the moment. The return value is floating point, as lines might not fit in completly.

mouseClicked (Component self, MouseEvent e, boolean mouseover)
  returns: ()

  description from overloaded method of Component:

  called if the mouse was clicked on the component.
onGainedFocus (from)
  returns: ()
  simply forwards the focus to the next element.
onTextChange (Label)
  returns: ()
  called if the text changed (ie. by user input)
positionUpdate (Component self,int zindex,Rectangle clip)
  returns: (int newz)

  description from overloaded method of Component:

  called when the component was moved or resized. Overload this method for visual appearance. The zindex is the id to use for zordering the components. Return the newz value, reserving all the values that you require for your visual nodes.
setAlignment (Label,[alignment],[vertical_align])
  returns: ()
  sets textalignment, or resets to default (left aligned)
setFontColor (r,g,b,a)
  returns: ()

  sets RGBA font color of the label

setTabWidth (Label,float)
  returns: ()
  sets the label's tabwidth. 0 means fontspacing*4 is used, which is default.
setText (Label,string)
  returns: ()
  sets the label's text
textDimensions (Label,text)
  returns: (float,float)
  returns the text's bounding size (can exceed component's size)
toString (Label)
  returns: (string)
  returns simple component representation
wrapLine (Label,string,[width])
  returns: (string)

  uses the current label's font and size to wrap the line by inserting \n characters. If a width is provided, the wrapping is done using this width

## Inherited Methods:

### From Component

acceptSkinBounds, addKeyListener, addMouseListener, addTooltipListener, clipinsets, colors, contains, createVisibles, delete, deleteVisibles, fadeTo, focus, focuscolors, getBottom, getBounds, getClipRect, getFocusComponentAt, getFocusElement, getFocusIndex, getHeight, getLocation, getMinSize, getMouseLock, getParent, getRight, getSize, getSkin, getTooltip, getWidth, getX, getY, hasFocus, hideVisibles, index, invalidate, isClipped, isDisplayedFlag, isFocusable, isMouseLocker, isVisible, isVisibleFlag, keyEvent, keylisteners, local2world, lockMouse, mouseClicked, mouseEntered, mouseEvent, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheeled, mouselisteners, moveToRect, new, newFocusOrder, onDestroy, onDisplayChange, onGainedFocus, onLostFocus, onVisibilityChange, positionUpdate, remove, removeKeyListener, removeMouseListener, removeTooltipListener, setBounds, setClip, setColor, setDefaultUI, setDisabled, setDisplayable, setFont, setLocation, setSize, setSkin, setTooltip, setVisibility, showTooltipInformation, showVisibles, skinnames.defaultskin, skinnames.focusedskin, skinnames.hoveredskin, skinnames.pressedskin, think, toString, transferFocus, transferFocusOnArrows, transferFocusOnTab, unlockMouse, updateSkin, validate, validateFocus, white, world2local, zorderoffset