All About Class Label in AWT in Java

0
20
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share


Label are String representation of a display text.A label is a component for placing text in a container.The text can be changed by the application but user can not edit it.
The class structure of Label is given as below:


public class java.awt.Label extends java.awt.Component{
//member elements:
public final static int CENTER;//indicates that the label should be centered.
public final static int LEFT;//indicates that the label should be left justified.
public final static int RIGHT;//indicates that the label should be right justified.
//constructors
public Label();//default constructor creates an empty label whose label is left justified
public Label(String label)//creates a label with the specified argument whose label is left justified
public Label(String label,int alignment);//creates a label with the specified argument and alignment 
//alignment could be Label.CENTER ,Label.LEFT or Label.RIGHT
//methods
public void addNotify();
public int getAlignment();
public String getText();
protected String paramString();
public void setAlignment(int alignment);
public void setText(String label);
 
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here