본문 바로가기
C.E/Java

[API] JLabel

by 책읽는구리 2008. 10. 24.
반응형
public class JLabel
extends JComponent
implements SwingConstants, Accessible

A display area for a short text string or an image, or both. A label does not react to input events. As a result, it cannot get the keyboard focus. A label can, however, display a keyboard alternative as a convenience for a nearby component that has a keyboard alternative but can't display it.

//단문 문자열 또는 이미지를 위한 출력창이다. label은 입력 이벤트에 반응하지 않는다. 그 결과 키보드 포커스를 입력받지 못한다....?

A JLabel object can display either text, an image, or both. You can specify where in the label's display area the label's contents are aligned by setting the vertical and horizontal alignment. By default, labels are vertically centered in their display area. Text-only labels are leading edge aligned, by default; image-only labels are horizontally centered, by default.

//JLabel 객체는 문장, 이미지 뿐만 아니라 둘 동시에도 표현이 가능하다. label들의 horizontal과 vertical의 정렬을 이용해 원하는 위치에 나타낼 수 있다. 디폴트 경우 label은 display arear의 중심에 나타난다. 텍스트만 있는 label은 디폴트값이면 가에 정렬되고 이미지 뿐인 label은 horizontally 에 정렬된다.

You can also specify the position of the text relative to the image. By default, text is on the trailing edge of the image, with the text and image vertically aligned.

A label's leading and trailing edge are determined from the value of its ComponentOrientation property. At present, the default ComponentOrientation setting maps the leading edge to left and the trailing edge to right.

Finally, you can use the setIconTextGap method to specify how many pixels should appear between the text and the image. The default is 4 pixels.

See How to Use Labels in The Java Tutorial for further documentation.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.


출처 : http://java.sun.com/j2se/1.4.2/docs/api/
반응형

댓글