Showing posts with label COSTRUCTORS. Show all posts
Showing posts with label COSTRUCTORS. Show all posts

Monday, 3 March 2014

AWT CONTROLS IN JAVA:LABELS

AWT Label Class

Create AWT Label with simple Example..........

INTRODUCTION

Label component displays text just like a drawString(). The difference is Label gets the status of a component so that it can be added in position format using layout manager. Label displays text in one line only. User cannot edit the text of the label. It is meant only for the programmer to display some information. The label does not raise any events (the other only component that does not raise events is Panel). 

FIELDS

Following are the fields for java.awt.Component class:
  • static int CENTER
  • static int LEFT 
  • static int RIGHT 

public static final int LEFT = 0       label is aligned to left
public static final int CENTER = 1 label is aligned to center
public static final int RIGHT = 2         label is aligned to right