yu.ac.bg.etf.javaqx.qswing
Class JQLabel

java.lang.Object
  extended byyu.ac.bg.etf.javaqx.core.AbstractDisposable
      extended byyu.ac.bg.etf.javaqx.qswing.JQComponent
          extended byyu.ac.bg.etf.javaqx.qswing.JQLabel
All Implemented Interfaces:
Disposable, JQComponentProperties, JQLabelProperties, JQTextProperty, QSwingConstants

public class JQLabel
extends JQComponent
implements QSwingConstants, JQLabelProperties

Label Component.

Version:
0.2.0
Author:
Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)

Field Summary
static int AUTO_TEXT
          Auto text format (the value is 2).
static int BORDER_STYLE_PLAIN
          Plain border (the value is 16).
static int BORDER_STYLE_RAISED
          Raised border (the value is 32).
static int BORDER_STYLE_SUNKEN
          Sunken border (the value is 48).
static int BORDER_TYPE_BOX
          Box border type (the value is 1).
static int BORDER_TYPE_CLASSIC
          Classic border type (the value is 3).
static int BORDER_TYPE_NONE
          None border type (the value is 0).
static int BORDER_TYPE_STANDARD
          Standard border type (the value is 2).
static int BORDER_TYPE_STYLED
          Styled border type (the value is 6).
static int PLAIN_TEXT
          Plain text format (the value is 0).
static int RICH_TEXT
          Rich text format (the value is 1).
 
Fields inherited from class yu.ac.bg.etf.javaqx.qswing.JQComponent
listenerList
 
Fields inherited from interface yu.ac.bg.etf.javaqx.qswing.QSwingConstants
BOTTOM, CENTER, HORIZONTAL, LEADING, LEFT, RIGHT, TOP, TRAILING, VERTICAL
 
Fields inherited from interface yu.ac.bg.etf.javaqx.qswing.properties.JQLabelProperties
PROPERTY_BORDER_STYLE, PROPERTY_BORDER_TYPE, PROPERTY_BORDER_WIDTH, PROPERTY_DISABLED_ICON, PROPERTY_HORIZONTAL_ALIGNMENT, PROPERTY_ICON, PROPERTY_TEXT_FORMAT, PROPERTY_VERTICAL_ALIGNMENT, PROPERTY_WRAP_TEXT
 
Fields inherited from interface yu.ac.bg.etf.javaqx.qswing.properties.JQTextProperty
PROPERTY_MNEMONIC, PROPERTY_TEXT
 
Fields inherited from interface yu.ac.bg.etf.javaqx.qswing.properties.JQComponentProperties
PROPERTY_BACKGROUND, PROPERTY_COMPONENT_ORIENTATION, PROPERTY_CONTEXT_MENU, PROPERTY_ENABLED, PROPERTY_FIXED_SIZE, PROPERTY_FOCUSABLE, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_INSETS, PROPERTY_LOCALE, PROPERTY_MAXIMUM_SIZE, PROPERTY_MINIMUM_SIZE, PROPERTY_NAME, PROPERTY_OPAQUE, PROPERTY_PREFERRED_SIZE, PROPERTY_RESOURCE_BUNDLE_NAME, PROPERTY_STATUS_TIP_TEXT, PROPERTY_STYLE_SHEET, PROPERTY_TOOL_TIP_TEXT, PROPERTY_VISIBLE, PROPERTY_WHATS_THIS_TEXT
 
Constructor Summary
JQLabel()
          Constructs new JQLabel object.
JQLabel(Icon icon)
          Constructs new JQLabel object.
JQLabel(java.lang.String text)
          Constructs new JQLabel object.
JQLabel(java.lang.String text, Icon icon)
          Constructs new JQLabel object.
JQLabel(java.lang.String text, Icon icon, int horizontalAlignment)
          Constructs new JQLabel object.
JQLabel(java.lang.String text, int horizontalAlignment)
          Constructs new JQLabel object.
 
Method Summary
protected  int checkHorizontalKey(int key, java.lang.String message)
          Checks horizontal alignment key.
protected  int checkTextFormatKey(int key, java.lang.String message)
          Checks text format key.
protected  int checkVerticalKey(int key, java.lang.String message)
          Checks vertical alignment key.
 int getBorderStyle()
          Returns border style.
 int getBorderType()
          Returns border type.
 int getBorderWidth()
          Returns border width.
 Icon getDisabledIcon()
          Returns disabled icon.
 int getHorizontalAlignment()
          Returns horizontal alignment.
 Icon getIcon()
          Returns icon.
 java.lang.String getText()
          Returns text.
 int getTextFormat()
          Returns text format.
 int getVerticalAlignment()
          Returns vertical alignment.
 boolean isWrapText()
          Returns true if the label is wrapping text.
protected  java.lang.String paramString()
          Returns parameters string.
 void setBorderStyle(int borderStyle)
          Sets border style.
 void setBorderType(int borderType)
          Sets border type.
 void setBorderWidth(int borderWidth)
          Sets border width.
 void setDisabledIcon(Icon icon)
          Sets disabled icon.
 void setHorizontalAlignment(int alignment)
          Sets horizontal alignment.
 void setIcon(Icon icon)
          Sets icon.
 void setText(java.lang.String text)
          Sets text.
 void setTextFormat(int textFormat)
          Sets text format.
 void setVerticalAlignment(int alignment)
          Sets vertical alignment.
 void setWrapText(boolean wrapText)
          Sets text wrap status.
 void updateLocalization()
          Updates localization.
 
Methods inherited from class yu.ac.bg.etf.javaqx.qswing.JQComponent
addComponentListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, disableEvents, disposeComponent, disposeObject, enableEvents, eventEnabled, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getClientProperty, getComponentListeners, getComponentOrientation, getContextMenu, getCursor, getEventMask, getFocusListener, getFont, getFontMetrics, getForeground, getHeight, getInsets, getKeyListeners, getLocale, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getOwnedComponents, getOwner, getParent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getResourceBundleName, getSize, getStatusTipText, getStyleSheet, getToolTipText, getToolTipText, getWhatsThisText, getWidth, getX, getY, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLeftToRight, isLocaleSet, isOpaque, isOwnerOf, isPainting, isResizable, isResourceBundleNameSet, isUpdatesEnabled, isValid, isVisible, localizeObject, localizeString, localizeString, localizeStrings, paintComponent, processComponentEvent, processContextMenuEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processStyleChange, putClientProperty, removeComponentListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, removeStyleSheet, repaint, repaint, repaint, requestFocus, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setContextMenu, setCursor, setDefaultResourceBundleName, setDisplayable, setEnabled, setFixedSize, setFixedSize, setFocusable, setFont, setForeground, setInsets, setInsets, setLeftToRightComponentOrientation, setLocale, setLocation, setLocation, setMaximumSize, setMaximumSize, setMinimumSize, setMinimumSize, setName, setOpaque, setPreferredSize, setPreferredSize, setResizable, setResourceBundleName, setRightToLeftComponentOrientation, setSize, setSize, setStatusTipText, setStyleSheet, setStyleSheet, setToolTipText, setUpdatesEnabled, setVisible, setWhatsThisText, toString, unsetComponentOrientation, update, update, update, updateComponentOrientation, validate
 
Methods inherited from class yu.ac.bg.etf.javaqx.core.AbstractDisposable
addDisposeListener, dispose, disposedCheck, disposedErrorString, finalize, isDisposed, removeDisposeListener
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PLAIN_TEXT

public static final int PLAIN_TEXT
Plain text format (the value is 0).

See Also:
Constant Field Values

RICH_TEXT

public static final int RICH_TEXT
Rich text format (the value is 1).

See Also:
Constant Field Values

AUTO_TEXT

public static final int AUTO_TEXT
Auto text format (the value is 2).

See Also:
Constant Field Values

BORDER_TYPE_NONE

public static final int BORDER_TYPE_NONE
None border type (the value is 0).

See Also:
Constant Field Values

BORDER_TYPE_BOX

public static final int BORDER_TYPE_BOX
Box border type (the value is 1).

See Also:
Constant Field Values

BORDER_TYPE_STANDARD

public static final int BORDER_TYPE_STANDARD
Standard border type (the value is 2).

See Also:
Constant Field Values

BORDER_TYPE_CLASSIC

public static final int BORDER_TYPE_CLASSIC
Classic border type (the value is 3).

See Also:
Constant Field Values

BORDER_TYPE_STYLED

public static final int BORDER_TYPE_STYLED
Styled border type (the value is 6).

See Also:
Constant Field Values

BORDER_STYLE_PLAIN

public static final int BORDER_STYLE_PLAIN
Plain border (the value is 16).

See Also:
Constant Field Values

BORDER_STYLE_RAISED

public static final int BORDER_STYLE_RAISED
Raised border (the value is 32).

See Also:
Constant Field Values

BORDER_STYLE_SUNKEN

public static final int BORDER_STYLE_SUNKEN
Sunken border (the value is 48).

See Also:
Constant Field Values
Constructor Detail

JQLabel

public JQLabel()
Constructs new JQLabel object.


JQLabel

public JQLabel(java.lang.String text)
Constructs new JQLabel object.

Parameters:
text - the text

JQLabel

public JQLabel(Icon icon)
Constructs new JQLabel object.

Parameters:
icon - the icon

JQLabel

public JQLabel(java.lang.String text,
               Icon icon)
Constructs new JQLabel object.

Parameters:
text - the text
icon - the icon

JQLabel

public JQLabel(java.lang.String text,
               int horizontalAlignment)
Constructs new JQLabel object.

Parameters:
text - the text
horizontalAlignment - the horizontal alignment

JQLabel

public JQLabel(java.lang.String text,
               Icon icon,
               int horizontalAlignment)
Constructs new JQLabel object.

Parameters:
text - the text
icon - the icon
horizontalAlignment - the horizontal alignment
Method Detail

getText

public java.lang.String getText()
Returns text.

Returns:
text

setText

public void setText(java.lang.String text)
Sets text.

Parameters:
text - the text

getTextFormat

public int getTextFormat()
Returns text format.

Returns:
text format

setTextFormat

public void setTextFormat(int textFormat)
Sets text format.

Valid values are: PLAIN_TEXT, RICH_TEXT and AUTO_TEXT.
Default value is: AUTO_TEXT.

Parameters:
textFormat - the new text format

isWrapText

public boolean isWrapText()
Returns true if the label is wrapping text.

Returns:
true if the label is wrapping text

setWrapText

public void setWrapText(boolean wrapText)
Sets text wrap status.

Parameters:
wrapText - if true the label will wrap the text

getHorizontalAlignment

public int getHorizontalAlignment()
Returns horizontal alignment.

Returns:
horizontal alignment

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)
Sets horizontal alignment.

Valid values are: LEFT, CENTER, RIGHT, LEADING and TRAILING.
Default value is: LEADING.

Parameters:
alignment - the horizontal alignment

getVerticalAlignment

public int getVerticalAlignment()
Returns vertical alignment.

Returns:
vertical alignment

setVerticalAlignment

public void setVerticalAlignment(int alignment)
Sets vertical alignment.

Valid values are: TOP, CENTER and BOTTOM.
Default value is: CENTER.

Parameters:
alignment - the vertical alignment

getIcon

public Icon getIcon()
Returns icon.

Returns:
icon

setIcon

public void setIcon(Icon icon)
Sets icon.

Parameters:
icon - the icon

getDisabledIcon

public Icon getDisabledIcon()
Returns disabled icon.

Returns:
disabled icon

setDisabledIcon

public void setDisabledIcon(Icon icon)
Sets disabled icon.

Parameters:
icon - the disabled icon

getBorderType

public int getBorderType()
Returns border type.

Returns:
border type

setBorderType

public void setBorderType(int borderType)
Sets border type.

Parameters:
borderType - the border type

getBorderStyle

public int getBorderStyle()
Returns border style.

Returns:
border style

setBorderStyle

public void setBorderStyle(int borderStyle)
Sets border style.

Parameters:
borderStyle - the border style

getBorderWidth

public int getBorderWidth()
Returns border width.

Returns:
border width

setBorderWidth

public void setBorderWidth(int borderWidth)
Sets border width.

Parameters:
borderWidth - int

checkHorizontalKey

protected final int checkHorizontalKey(int key,
                                       java.lang.String message)
Checks horizontal alignment key.

Parameters:
key - the key
message - the error message
Returns:
alignment key
Throws:
java.lang.IllegalArgumentException - if the key is invalid

checkVerticalKey

protected final int checkVerticalKey(int key,
                                     java.lang.String message)
Checks vertical alignment key.

Parameters:
key - the key
message - the error message
Returns:
alignment key
Throws:
java.lang.IllegalArgumentException - if the key is invalid

checkTextFormatKey

protected final int checkTextFormatKey(int key,
                                       java.lang.String message)
Checks text format key.

Parameters:
key - the key
message - the error message
Returns:
alignment key
Throws:
java.lang.IllegalArgumentException - if the key is invalid

updateLocalization

public void updateLocalization()
Updates localization.

Overrides:
updateLocalization in class JQComponent

paramString

protected java.lang.String paramString()
Returns parameters string.

Overrides:
paramString in class JQComponent
Returns:
parameters string


Copyright © 2007 ETF and contributors. All Rights Reserved.