Search

// program in java using awt control label and button to select a value of label.


CODE

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class value extends Applet implements ActionListener
{
Label l1;
Button b1;
public void init( )
{
l1= new Label("Hello");
add(l1);
b1= new Button("Show");
add(b1);
b1.addActionListener (this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
String s=l1.getText();
System.out.println(s);
}
}
}

HTML CODE
<HTML>
<BODY>
<APPLET ALIGN="CENTER" CODE="AppletSum.class" width = "700" height = "400"></APPLET>
</BODY>
</HTML>

OUTPUT DISPLAY



Share this article :
 

Post a Comment

 
Support : everytricks4.blogspot.in/ | Johny Template | Mas Template
Copyright © 2011. Computer Tricks - All Rights Reserved
Creating Website Published by
Proudly powered by Blogger