public class Label extends KComponent
Label object is a component for placing text in a
container. A label displays a single line of read-only text.
The text can be changed by the application, but a user cannot edit it
directly.
A Label can also display a visual object in a container.
For example:
setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
add(new Label("A Label"));
add(new Label(
new Text(
"Another Label",
new TextStyle("Dialog", Font.BOLD, 12, Color.red))));
add(new Label(new VImage("image.gif")));
Visualizable,
VLabel,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected int |
alignment
The label's alignment.
|
static int |
CENTER
Indicates that the label should be centered.
|
static int |
EAST
Indicates that the label should be right.
|
protected VLabel |
label
The visual label of this label.
|
static int |
LEFT
Indicates that the label should be left justified.
|
static int |
NORTH
Indicates that the label should be top.
|
static int |
NORTHEAST
Indicates that the label should be top-right.
|
static int |
NORTHWEST
Indicates that the label should be top-left.
|
static int |
RIGHT
Indicates that the label should be right justified.
|
static int |
SOUTH
Indicates that the label should be bottom.
|
static int |
SOUTHEAST
Indicates that the label should be bottom-right.
|
static int |
SOUTHWEST
Indicates that the label should be bottom-left.
|
static int |
WEST
Indicates that the label should be left.
|
DefaultToolkit, doubleBuffered, focusTraversable, offscreenBuffer, toolTip| コンストラクタと説明 |
|---|
Label()
Constructs an empty label.
|
Label(java.lang.String str)
Constructs a new label with the specified string, left justified.
|
Label(java.lang.String str,
int alignment)
Constructs a new label that presents the specified string with the
specified alignment.
|
Label(Text text)
Constructs a new label with the specified text, left justified.
|
Label(Text text,
int alignment)
Constructs a new label that presents the specified string with the
specified alignment.
|
Label(Visualizable visualizable)
Constructs a new label with the specified visual object, left justified.
|
Label(Visualizable visualizable,
int alignment)
Constructs a new label with the specified visual object with the
specified alignment.
|
Label(VLabel label)
Constructs a new label with the specified visual label, left justified.
|
Label(VLabel label,
int alignment)
Constructs a new label with the specified visual label with the
specified alignment.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
int |
getAlignment()
Gets the current alignment of this label.
|
protected java.awt.Color |
getButtonBackground()
Returns the background color for the button.
|
java.awt.Dimension |
getMinimumSize()
Gets the mininimum size of this component.
|
java.awt.Dimension |
getPreferredSize()
Gets the preferred size of this component.
|
java.lang.String |
getText()
Gets the string of this label.
|
Text |
getTEXT()
Gets the text object of this label.
|
Visualizable |
getVisualizable()
Gets the visual object of this label.
|
VLabel |
getVLabel()
Gets the visual label of this label.
|
protected void |
paintOn(java.awt.Graphics g)
Paints this label.
|
void |
setAlignment(int alignment)
Sets the alignment for this label to the specified alignment.
|
void |
setBackground(java.awt.Color c)
Sets the background color of this component.
|
void |
setBounds(int x,
int y,
int width,
int height)
Moves and resizes this component.
|
void |
setEnabled(boolean b)
Enables or disables this component.
|
void |
setFont(java.awt.Font f)
Sets the font of this component.
|
void |
setForeground(java.awt.Color c)
Sets the foreground color of this component.
|
protected void |
setLabelSize(int width,
int height)
Sets the size of the visual label to be the specified width and height.
|
void |
setText(java.lang.String str)
Sets the text for this label to the specified string.
|
void |
setText(Text text)
Sets the text object for this label to the specified text object.
|
void |
setTEXT(Text text)
Sets the text object for this label to the specified text object.
|
void |
setVisualizable(Visualizable visualizable)
Sets the visual object for this label to the specified visual object.
|
void |
setVLabel(VLabel label)
Sets the visual label for this label to the specified viaul label.
|
addNotify, bounds, disable, doLayout, enable, enable, getBounds, getFrame, getLocation, getPreferredGraphics, getPreferredGraphics, getSize, getToolTipText, getToolTipVisual, hide, isDirectNotification, isDoubleBuffered, isFocusTraversable, layout, location, minimumSize, paint, postOldEvent, preferredSize, processMouseEvent, processMouseMotionEvent, repaintNow, requestFocus, reshape, setDoubleBuffered, setFocusTraversable, setToolTipText, setToolTipText, setToolTipVisual, setVisible, show, show, size, syncGraphics, syncGraphics, syncGraphics, updateaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disableEvents, dispatchEvent, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, list, list, locate, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validateprotected int alignment
protected VLabel label
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int NORTH
public static final int NORTHEAST
public static final int EAST
public static final int SOUTHEAST
public static final int SOUTH
public static final int SOUTHWEST
public static final int WEST
public static final int NORTHWEST
public Label()
public Label(java.lang.String str)
str - the string that the label presents.public Label(java.lang.String str,
int alignment)
str - the string that the label presents.alignment - the alignment value.public Label(Text text)
text - the text that the label presents.public Label(Text text, int alignment)
text - the text that the label presents.alignment - the alignment value.public Label(Visualizable visualizable)
visualizable - the visual object that the label presents.public Label(Visualizable visualizable, int alignment)
visualizable - the visual object that the label presents.alignment - the alignment value.public Label(VLabel label)
label - the visual label that the label presents.public Label(VLabel label, int alignment)
label - the visual label that the label presents.alignment - the alignment value.public void setFont(java.awt.Font f)
setFont クラス内 java.awt.Componentpublic java.awt.Dimension getPreferredSize()
getPreferredSize クラス内 KComponentpublic java.awt.Dimension getMinimumSize()
getMinimumSize クラス内 KComponentpublic void setForeground(java.awt.Color c)
setForeground クラス内 KComponentpublic void setBackground(java.awt.Color c)
setBackground クラス内 KComponentpublic void setEnabled(boolean b)
setEnabled クラス内 KComponentprotected void paintOn(java.awt.Graphics g)
paintOn クラス内 KComponentpublic void setBounds(int x,
int y,
int width,
int height)
setBounds クラス内 KComponentprotected java.awt.Color getButtonBackground()
protected void setLabelSize(int width,
int height)
public int getAlignment()
setAlignment(int)public void setAlignment(int alignment)
alignment - the alignment to be set.java.lang.IllegalArgumentException - if an improper value for
alignment is given.getAlignment()public java.lang.String getText()
public void setText(java.lang.String str)
str - the string that this label presents.getText()public Text getTEXT()
setTEXT(jp.kyasu.graphics.Text),
setText(jp.kyasu.graphics.Text)public void setTEXT(Text text)
text - the text object that this label presents.getTEXT()public void setText(Text text)
text - the text object that this label presents.getTEXT()public Visualizable getVisualizable()
setVisualizable(jp.kyasu.graphics.Visualizable)public void setVisualizable(Visualizable visualizable)
visualizable - the visual object that this label presents.getVisualizable()public VLabel getVLabel()
setVLabel(jp.kyasu.graphics.VLabel)public void setVLabel(VLabel label)
label - the visual label that this label presents.getVLabel()