How to use Label in java applet?

Hello Friends, 

Today I will explain how can we use Label in java applet.
In this  program I used simple label name but you can write or put different labels in your java applet program.

import java.awt.*;
import java.applet.*;
import java.awt.event.*;

/*


*/

public class sixth extends Applet
{
String msg="";
public void init()
{
Label one=new Label("one");
Label two=new Label("two");
Label three=new Label();

three.setText("three");

add(one);
add(two);
add(three);

msg=one.getText();
}
public void paint(Graphics g)
{
setBackground(Color.black);
setForeground(Color.white);

g.setFont(new Font("Corbel",Font.BOLD,30));
g.drawString(msg,20,80);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *