org.smartui
Class Label3D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--org.smartui.SmartComponent
              |
              +--org.smartui.Label3D
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, Smart
Direct Known Subclasses:
SuperLabel3D

public class Label3D
extends SmartComponent

The Label3D class is used to replace the awt's Label component with many new properties used in popular user interface.

It can be shown in multiline, auto-wrap your text.

It can be shown with outline,shadow,and 3D features

And it is lightweight, can be transparent.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
 int align
           
 boolean autosize
           
static int BOTTOM
          The vert align style, used when align the total text only valid when not autosize
 int hAlign
           
static int HCENTER
          The horz align style, used when align the total text only valid when not autosize
static int LEFT
          The horz align style, used when align the total text only valid when not autosize
static int LINECENTER
          The align style, used when align one line
 int lineGap
           
static int LINELEFT
          The align style, used when align one line
static int LINERIGHT
          The align style, used when align one line
 int lineWidth
           
static int NORMAL
          The style of the text being showned
static int OUTLINE
          The style of the text being showned
 java.awt.Color outlineColor
           
static int RAISE3D
          The style of the text being showned
static int RIGHT
          The horz align style, used when align the total text only valid when not autosize
 int separateLength
           
 java.awt.Color shadowColor
           
 int shadowHeight
           
 int style
           
static int SUNK3D
          The style of the text being showned
 java.lang.String text
           
static int TOP
          The vert align style, used when align the total text only valid when not autosize
 int vAlign
           
static int VCENTER
          The vert align style, used when align the total text only valid when not autosize
 
Fields inherited from class org.smartui.SmartComponent
cliprect, transparent
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Label3D()
          Create a new instance with default text and fontsize
Label3D(int fontsize)
          Creates a new instance
Label3D(java.lang.String text)
          Creates a new instance
Label3D(java.lang.String text, int fontsize)
          Creates a new instance
Label3D(java.lang.String text, int fontsize, int style)
          Creates a new instance
 
Method Summary
protected  void doPaint(java.awt.Graphics g, int x, int y, java.awt.Dimension dim)
           
 java.awt.Dimension getMinimumSize()
          Gets the mininimum size of this component.
 java.awt.Dimension getPreferredSize()
          Gets the preferred size of this component. if autosize is true, it will auto calc the size.
 java.awt.Dimension getTextDimension()
          Returns the size of this text according the component's current font and the maxwords It is called when the object excute sizeToFit or getPreferredSize and paint
 void paint(java.awt.Graphics g)
          Paint the component
 void propertyChanged()
           
 boolean rejustSize(java.awt.Graphics g)
           
 void setAlign(int align, int hAlign, int vAlign)
          Set all aligns
 void setFont(java.awt.Font f)
          Set the Font
 void setLabel3D(java.lang.String text, int fontsize, int style)
          Set the label3D
 void sizeToFit()
          It will set the autosize be true and relayout the parent
 
Methods inherited from class org.smartui.SmartComponent
getBackground, getFather, getFont, getForeground, getParent, isShowing, isValid, setFather, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LINELEFT

public static final int LINELEFT
The align style, used when align one line

LINECENTER

public static final int LINECENTER
The align style, used when align one line

LINERIGHT

public static final int LINERIGHT
The align style, used when align one line

LEFT

public static final int LEFT
The horz align style, used when align the total text only valid when not autosize

HCENTER

public static final int HCENTER
The horz align style, used when align the total text only valid when not autosize

RIGHT

public static final int RIGHT
The horz align style, used when align the total text only valid when not autosize

TOP

public static final int TOP
The vert align style, used when align the total text only valid when not autosize

VCENTER

public static final int VCENTER
The vert align style, used when align the total text only valid when not autosize

BOTTOM

public static final int BOTTOM
The vert align style, used when align the total text only valid when not autosize

NORMAL

public static final int NORMAL
The style of the text being showned

SUNK3D

public static final int SUNK3D
The style of the text being showned

RAISE3D

public static final int RAISE3D
The style of the text being showned

OUTLINE

public static final int OUTLINE
The style of the text being showned

style

public int style

outlineColor

public java.awt.Color outlineColor

shadowHeight

public int shadowHeight

shadowColor

public java.awt.Color shadowColor

align

public int align

hAlign

public int hAlign

vAlign

public int vAlign

lineWidth

public int lineWidth

separateLength

public int separateLength

lineGap

public int lineGap

autosize

public boolean autosize

text

public java.lang.String text
Constructor Detail

Label3D

public Label3D()
Create a new instance with default text and fontsize

Label3D

public Label3D(java.lang.String text)
Creates a new instance
Parameters:
text - is the text to be shown.

Label3D

public Label3D(int fontsize)
Creates a new instance
Parameters:
fontsize - is the font size of the text to be shown.

Label3D

public Label3D(java.lang.String text,
               int fontsize)
Creates a new instance
Parameters:
text - is the text to be shown.
fontsize - is the font size of the text to be shown.

Label3D

public Label3D(java.lang.String text,
               int fontsize,
               int style)
Creates a new instance
Parameters:
text - is the text to be shown.
fontsize - is the font size of the text to be shown.
style - is the style of the text to be shown.
Method Detail

setAlign

public void setAlign(int align,
                     int hAlign,
                     int vAlign)
Set all aligns

setLabel3D

public void setLabel3D(java.lang.String text,
                       int fontsize,
                       int style)
Set the label3D

setFont

public void setFont(java.awt.Font f)
Set the Font
Overrides:
setFont in class java.awt.Component

propertyChanged

public void propertyChanged()
Overrides:
propertyChanged in class SmartComponent

getTextDimension

public java.awt.Dimension getTextDimension()
Returns the size of this text according the component's current font and the maxwords It is called when the object excute sizeToFit or getPreferredSize and paint

Returns:
A Dimension object that indicates the proper size of the text.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size of this component. if autosize is true, it will auto calc the size.
Overrides:
getPreferredSize in class SmartComponent
Returns:
A dimension object indicating this component's preferred size.
See Also:
Component

getMinimumSize

public java.awt.Dimension getMinimumSize()
Gets the mininimum size of this component.
Overrides:
getMinimumSize in class java.awt.Component
Returns:
A dimension object indicating this component's minimum size.
See Also:
getPreferredSize()

sizeToFit

public void sizeToFit()
It will set the autosize be true and relayout the parent

paint

public void paint(java.awt.Graphics g)
Paint the component
Overrides:
paint in class SmartComponent

rejustSize

public boolean rejustSize(java.awt.Graphics g)

doPaint

protected void doPaint(java.awt.Graphics g,
                       int x,
                       int y,
                       java.awt.Dimension dim)