JavaTM Platform
Standard Ed. 6

java.awt
클래스 Label

java.lang.Object 
  상위를 확장 java.awt.Component 
      상위를 확장 java.awt.Label
모든 구현된 인터페이스:
ImageObserver , MenuContainer , Serializable , Accessible


public class Label
extends Component
implements Accessible

Label 객체는, 컨테이너내에 텍스트를 배치하기 위한 컴퍼넌트입니다. 라벨은, 단일행의 read 전용 텍스트를 표시합니다. 텍스트를 변경하려면 어플리케이션을 사용해, 사용자가 직접 편집할 수 없습니다.  

예를 나타냅니다.  


 setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
 add(new Label("Hi There! "));
 add(new Label("Another Label"));
 

상기의 코드는, 다음의 라벨을 작성합니다.  

2 개의 라벨:'Hi There!' 과 'Another label'

도입된 버젼:
JDK1. 0
관련 항목:
직렬화 된 형식

상자의 클래스의 개요
protected  class Label.AccessibleAWTLabel
          이 클래스는 Label 클래스용의 접근성?의 지원를 구현하고 있습니다.
 
클래스 java.awt. Component 로부터 상속된 상자의 클래스/인터페이스
Component.AccessibleAWTComponent , Component.BaselineResizeBehavior , Component.BltBufferStrategy , Component.FlipBufferStrategy
 
필드의 개요
static int CENTER
          라벨이 centering 되는 것을 나타냅니다.
static int LEFT
          라벨이 왼쪽 가지런히 하고 되는 것을 나타냅니다.
static int RIGHT
          라벨이 오른쪽맞춤 되는 것을 나타냅니다.
 
클래스 java.awt. Component 로부터 상속된 필드
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT
 
인터페이스 java.awt.image. ImageObserver 로부터 상속된 필드
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH
 
생성자 의 개요
Label ()
          빈 상태(empty)의 라벨을 구축합니다.
Label (String  text)
          새로운 라벨을 왼쪽 가지런히 해, 지정된 텍스트 캐릭터 라인으로 구축합니다.
Label (String  text, int alignment)
          지정된 텍스트 캐릭터 라인을, 지정된 배치로 표시하는 새로운 라벨을 구축합니다.
 
메소드의 개요
 void addNotify ()
          이 라벨의 피어를 작성합니다.
 AccessibleContext getAccessibleContext ()
          이 Label 에 관련한 AccessibleContext 를 돌려줍니다.
 int getAlignment ()
          이 라벨의 현재의 배치를 돌려줍니다.
 String getText ()
          이 라벨의 텍스트를 돌려줍니다.
protected  String paramString ()
          이 Label 상태를 나타내는 캐릭터 라인을 돌려줍니다.
 void setAlignment (int alignment)
          이 라벨의 배치를, 지정된 배치로 설정합니다.
 void setText (String  text)
          이 라벨의 텍스트를, 지정된 텍스트로 설정합니다.
 
클래스 java.awt. Component 로부터 상속된 메소드
action , add , addComponentListener , addFocusListener , addHierarchyBoundsListener , addHierarchyListener , addInputMethodListener , addKeyListener , addMouseListener , addMouseMotionListener , addMouseWheelListener , addPropertyChangeListener , addPropertyChangeListener , applyComponentOrientation , areFocusTraversalKeysSet , bounds , checkImage , checkImage , coalesceEvents , contains , contains , createImage , createImage , createVolatileImage , createVolatileImage , deliverEvent , disable , disableEvents , dispatchEvent , doLayout , enable , enable , enableEvents , enableInputMethods , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , firePropertyChange , getAlignmentX , getAlignmentY , getBackground , getBaseline , getBaselineResizeBehavior , getBounds , 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 , getLocation , getLocationOnScreen , getMaximumSize , getMinimumSize , getMouseListeners , getMouseMotionListeners , getMousePosition , getMouseWheelListeners , getName , getParent , getPeer , getPreferredSize , getPropertyChangeListeners , getPropertyChangeListeners , getSize , getSize , getToolkit , getTreeLock , getWidth , getX , getY , gotFocus , handleEvent , hasFocus , hide , imageUpdate , inside , invalidate , isBackgroundSet , isCursorSet , isDisplayable , isDoubleBuffered , isEnabled , isFocusable , isFocusCycleRoot , isFocusOwner , isFocusTraversable , isFontSet , isForegroundSet , isLightweight , isMaximumSizeSet , isMinimumSizeSet , isOpaque , isPreferredSizeSet , isShowing , isValid , isVisible , keyDown , keyUp , layout , list , list , list , list , list , locate , location , lostFocus , minimumSize , mouseDown , mouseDrag , mouseEnter , mouseExit , mouseMove , mouseUp , move , nextFocus , paint , paintAll , postEvent , preferredSize , prepareImage , prepareImage , print , printAll , processComponentEvent , processEvent , processFocusEvent , processHierarchyBoundsEvent , processHierarchyEvent , processInputMethodEvent , processKeyEvent , processMouseEvent , processMouseMotionEvent , processMouseWheelEvent , remove , removeComponentListener , removeFocusListener , removeHierarchyBoundsListener , removeHierarchyListener , removeInputMethodListener , removeKeyListener , removeMouseListener , removeMouseMotionListener , removeMouseWheelListener , removeNotify , removePropertyChangeListener , removePropertyChangeListener , repaint , repaint , repaint , repaint , requestFocus , requestFocus , requestFocusInWindow , requestFocusInWindow , reshape , resize , resize , setBackground , setBounds , setBounds , setComponentOrientation , setCursor , setDropTarget , setEnabled , setFocusable , setFocusTraversalKeys , setFocusTraversalKeysEnabled , setFont , setForeground , setIgnoreRepaint , setLocale , setLocation , setLocation , setMaximumSize , setMinimumSize , setName , setPreferredSize , setSize , setSize , setVisible , show , show , size , toString , transferFocus , transferFocusBackward , transferFocusUpCycle , update , validate
 
클래스 java.lang. Object 로부터 상속된 메소드
clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait
 

필드의 상세

LEFT

public static final int LEFT
라벨이 왼쪽 가지런히 하고 되는 것을 나타냅니다.

관련 항목:
정수 필드치

CENTER

public static final int CENTER
라벨이 centering 되는 것을 나타냅니다.

관련 항목:
정수 필드치

RIGHT

public static final int RIGHT
라벨이 오른쪽맞춤 되는 것을 나타냅니다.

도입된 버젼:
JDK1. 0t.
관련 항목:
정수 필드치
생성자 의 상세

Label

public Label()
      throws HeadlessException 
빈 상태(empty)의 라벨을 구축합니다. 라벨의 텍스트는, 빈 상태(empty)의 캐릭터 라인 "" 입니다.

예외:
HeadlessException - GraphicsEnvironment.isHeadless()의 경우 true 를 돌려주는
관련 항목:
GraphicsEnvironment.isHeadless()

Label

public Label(String  text)
      throws HeadlessException 
새로운 라벨을 왼쪽 가지런히 해, 지정된 텍스트 캐릭터 라인으로 구축합니다.

파라미터:
text - 라벨이 표시하는 캐릭터 라인. null 치를 지정해도, NullPointerException 를 throw 하지 않고 받아들일 수 있다
예외:
HeadlessException - GraphicsEnvironment.isHeadless()의 경우 true 를 돌려주는
관련 항목:
GraphicsEnvironment.isHeadless()

Label

public Label(String  text,
             int alignment)
      throws HeadlessException 
지정된 텍스트 캐릭터 라인을, 지정된 배치로 표시하는 새로운 라벨을 구축합니다. alignment 의 값은,Label.LEFT,Label.RIGHT,Label.CENTER 의 머지않아인가입니다.

파라미터:
text - 라벨이 표시하는 캐릭터 라인. null 치를 지정해도, NullPointerException 를 throw 하지 않고 받아들일 수 있는
alignment - 배치 방법의 값
예외:
HeadlessException - GraphicsEnvironment.isHeadless()의 경우 true 를 돌려주는
관련 항목:
GraphicsEnvironment.isHeadless()
메소드의 상세

addNotify

public void addNotify()
이 라벨의 피어를 작성합니다. 피어를 사용하면(자), 그 기능성을 바꾸는 일 없이 라벨의 외관을 수정할 수가 있습니다.

오버라이드(override):
클래스 Component 내의 addNotify
관련 항목:
Component.isDisplayable() , Component.removeNotify()

getAlignment

public int getAlignment()
이 라벨의 현재의 배치를 돌려줍니다. 값은,Label.LEFT,Label.RIGHT,Label.CENTER 의 머지않아인가입니다.

관련 항목:
setAlignment(int)

setAlignment

public void setAlignment(int alignment)
이 라벨의 배치를, 지정된 배치로 설정합니다. 값은,Label.LEFT,Label.RIGHT,Label.CENTER 의 머지않아인가입니다.

파라미터:
alignment - 설정되는 배치
예외:
IllegalArgumentException - alignment 에 올바르지 않은 값이 지정되었을 경우
관련 항목:
getAlignment()

getText

public String  getText()
이 라벨의 텍스트를 돌려줍니다.

반환값:
이 라벨의 텍스트. 텍스트가 null 에 설정되어 있는 경우는 null
관련 항목:
setText(java.lang.String)

setText

public void setText(String  text)
이 라벨의 텍스트를, 지정된 텍스트로 설정합니다.

파라미터:
text - 이 라벨이 표시하는 텍스트. textnull 의 경우는, 빈 상태(empty)의 캐릭터 라인 "" 으로서 처리되는
관련 항목:
getText()

paramString

protected String  paramString()
Label 상태를 나타내는 캐릭터 라인을 돌려줍니다. 이 메소드는 디버그 전용이며, 반환되는 캐릭터 라인의 내용 및 형식은 구현에 따라서 다릅니다. 반환되는 캐릭터 라인은 빈 상태(empty)의 경우가 있습니다만,null 로는 되지 않습니다.

오버라이드(override):
클래스 Component 내의 paramString
반환값:
이 라벨의 파라미터 캐릭터 라인

getAccessibleContext

public AccessibleContext  getAccessibleContext()
이 Label 에 관련한 AccessibleContext 를 돌려줍니다. 라벨의 경우, AccessibleContext 는 AccessibleAWTLabel 의 형식을 취합니다. 필요에 따라서 새로운 AccessibleAWTLabel 인스턴스를 작성합니다.

정의:
인터페이스 Accessible 내의 getAccessibleContext
오버라이드(override):
클래스 Component 내의 getAccessibleContext
반환값:
이 Label 의 AccessibleContext 로서 기능한다 AccessibleAWTLabel
도입된 버젼:
1.3

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.