net.yura.mobile.gui.components
Class Label

java.lang.Object
  extended by net.yura.mobile.gui.components.Component
      extended by net.yura.mobile.gui.components.Label
Direct Known Subclasses:
Button, DefaultListCellRenderer, Spinner, ToolTip

public class Label
extends Component

Author:
Yura Mamyrin
See Also:
JLabel

Field Summary
protected  int alignment
           
static String extension
           
protected  Font font
           
protected  int gap
           
protected  Icon icon
           
protected  int padding
           
protected  String string
           
protected  int textPosition
           
 
Fields inherited from class net.yura.mobile.gui.components.Component
background, empty, FOCUS_GAINED, FOCUS_LOST, focusable, foreground, height, parent, posX, posY, preferredHeight, preferredWidth, state, theme, width
 
Constructor Summary
Label()
           
Label(Icon icon)
           
Label(String text)
           
Label(String text, Icon icon)
           
 
Method Summary
protected  int getCombinedHeight()
           
protected  int getCombinedHeight(int iconHeight)
           
protected  int getCombinedWidth()
           
protected  int getCombinedWidth(String string, int iconWidth)
           
protected  String getDefaultName()
           
 Font getFont()
           
 int getHorizontalAlignment()
           
 int getHorizontalTextPosition()
           
 Icon getIcon()
           
 int getMargin()
           
 int getMaxWidth()
           
 String getText()
           
 int getVerticalAlignment()
           
 int getVerticalTextPosition()
           
 void paintComponent(Graphics2D g)
           
protected  void paintIcon(Graphics2D g, int x, int y)
           
 void setFont(Font font)
           
 void setHorizontalAlignment(int a)
           
 void setHorizontalTextPosition(int a)
           
 void setIcon(Icon icon)
           
 void setIconTextGap(int iconTextGap)
           
 void setMargin(int padding)
           
 void setText(String a)
           
 void setValue(Object obj)
           
 void setVerticalAlignment(int a)
           
 void setVerticalTextPosition(int a)
           
 String toString()
           
 void updateUI()
           
 void workoutMinimumSize()
          This sets the width and height of this component to the MINIMUM that is needed for this component
 
Methods inherited from class net.yura.mobile.gui.components.Component
add, add, add, addFocusListener, addImpl, animate, clip, consumesMotionEvents, focusGained, focusLost, getBackground, getBorder, getCurrentState, getDesktopPane, getFocusListeners, getForeground, getHeight, getHeightWithBorder, getInsets, getName, getParent, getPreferredHeight, getPreferredWidth, getState, getToolTipLocationX, getToolTipLocationY, getToolTipText, getValue, getWidth, getWidthWithBorder, getWindow, getX, getXOnScreen, getXWithBorder, getY, getYOnScreen, getYWithBorder, insert, insert, isComponentVisible, isFocusable, isFocusOwner, isOpaque, isRectVisible, isShowing, isVisible, makeVisible, paint, paintBorder, processKeyEvent, processMouseEvent, processMultitouchEvent, removeFocusListener, removeParent, repaint, requestFocusInWindow, revalidate, scrollRectToVisible, scrollUpDown, setBackground, setBorder, setBounds, setBoundsWithBorder, setFocusable, setForeground, setLocation, setName, setPreferredSize, setSize, setState, setToolTipText, setupState, setVisible, transferFocus, validate, wait, workoutSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

alignment

protected int alignment

extension

public static String extension

font

protected Font font

gap

protected int gap

icon

protected Icon icon

padding

protected int padding

string

protected String string

textPosition

protected int textPosition
Constructor Detail

Label

public Label()
See Also:
JLabel.JLabel

Label

public Label(Icon icon)
Parameters:
icon - The image to be displayed by the label
See Also:
JLabel.JLabel

Label

public Label(String text)
Parameters:
text - The text to be displayed by the label
See Also:
JLabel.JLabel

Label

public Label(String text,
             Icon icon)
Parameters:
text - The text to be displayed by the label
icon - The image to be displayed by the label
See Also:
JLabel.JLabel
Method Detail

getCombinedHeight

protected int getCombinedHeight()

getCombinedHeight

protected int getCombinedHeight(int iconHeight)

getCombinedWidth

protected int getCombinedWidth()

getCombinedWidth

protected int getCombinedWidth(String string,
                               int iconWidth)

getDefaultName

protected String getDefaultName()
Specified by:
getDefaultName in class Component

getFont

public Font getFont()
Returns:
The font of the label
See Also:
Component.getFont

getHorizontalAlignment

public int getHorizontalAlignment()
See Also:
JLabel.getHorizontalAlignment

getHorizontalTextPosition

public int getHorizontalTextPosition()
See Also:
JLabel.getHorizontalTextPosition

getIcon

public Icon getIcon()
Returns:
The icon of the label
See Also:
JLabel.getIcon

getMargin

public int getMargin()
Returns:
The padding of the label
See Also:
AbstractButton.getMargin

getMaxWidth

public int getMaxWidth()

getText

public String getText()
Returns:
The text of the label
See Also:
JLabel.getText

getVerticalAlignment

public int getVerticalAlignment()
See Also:
JLabel.getVerticalAlignment

getVerticalTextPosition

public int getVerticalTextPosition()
See Also:
JLabel.getVerticalTextPosition

paintComponent

public void paintComponent(Graphics2D g)
Specified by:
paintComponent in class Component
See Also:
JComponent.paintComponent

paintIcon

protected void paintIcon(Graphics2D g,
                         int x,
                         int y)

setFont

public void setFont(Font font)
Parameters:
font - The font of the label
See Also:
JComponent.setFont

setHorizontalAlignment

public void setHorizontalAlignment(int a)
Parameters:
a - One of the following constants defined in Graphics: LEFT (the default for text-only labels), HCENTER (the default for image-only labels), RIGHT
See Also:
JLabel.setHorizontalAlignment

setHorizontalTextPosition

public void setHorizontalTextPosition(int a)
Parameters:
a - One of the following constants defined in Graphics: LEFT, HCENTER, RIGHT (the default)
See Also:
JLabel.setHorizontalTextPosition

setIcon

public void setIcon(Icon icon)
Parameters:
icon - The icon of the label
See Also:
JLabel.setIcon

setIconTextGap

public void setIconTextGap(int iconTextGap)
Parameters:
iconTextGap - The gap, default is 2
See Also:
JLabel.setIconTextGap

setMargin

public void setMargin(int padding)
See Also:
AbstractButton.setMargin

setText

public void setText(String a)
Parameters:
a - The text of the label
See Also:
JLabel.setText

setValue

public void setValue(Object obj)
Overrides:
setValue in class Component

setVerticalAlignment

public void setVerticalAlignment(int a)
Parameters:
a - One of the following constants defined in Graphics: TOP, VCENTER (the default), or BOTTOM
See Also:
JLabel.setVerticalAlignment

setVerticalTextPosition

public void setVerticalTextPosition(int a)
Parameters:
a - One of the following constants defined in Graphics: TOP, VCENTER (the default), or BOTTOM
See Also:
JLabel.setVerticalTextPosition

toString

public String toString()
Overrides:
toString in class Component
See Also:
Component.toString

updateUI

public void updateUI()
Overrides:
updateUI in class Component
See Also:
JComponent.updateUI

workoutMinimumSize

public void workoutMinimumSize()
Description copied from class: Component
This sets the width and height of this component to the MINIMUM that is needed for this component

Specified by:
workoutMinimumSize in class Component
See Also:
JComponent.getMinimumSize