import java.awt.*;
import java.awt.event.*;
public class CopyStringToLabel extends Frame implements ActionListener
{
private Label label = new Label();
private TextField output = new TextField();
private Button copy = new Button("Copy");
private class WindowCloser extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{ System.exit(0); }
}
public CopyStringToLabel ()
{
super("Copy a String To Label");
setup();
copy.addActionListener(this);
addWindowListener(new WindowCloser());
{
if(e.getSource() == copy)
label.setText(output.getText());
{
Panel textGrid = new Panel();
textGrid.setLayout(new GridLayout(2,1));
textGrid.add(label);
textGrid.add(output);
setLayout(new BorderLayout());
add("Center",textGrid);
add("South",copy);
pack();
setVisible(true);
}
public static void main(String[] args) {
CopyStringToLabel cop = new CopyStringToLabel();
}
}
import java.awt.event.*;
public class CopyStringToLabel extends Frame implements ActionListener
{
private Label label = new Label();
private TextField output = new TextField();
private Button copy = new Button("Copy");
private class WindowCloser extends WindowAdapter
{
public void windowClosing(WindowEvent we)
{ System.exit(0); }
}
public CopyStringToLabel ()
{
super("Copy a String To Label");
setup();
copy.addActionListener(this);
addWindowListener(new WindowCloser());
}
{
if(e.getSource() == copy)
label.setText(output.getText());
}
{
Panel textGrid = new Panel();
textGrid.setLayout(new GridLayout(2,1));
textGrid.add(label);
textGrid.add(output);
setLayout(new BorderLayout());
add("Center",textGrid);
add("South",copy);
pack();
setVisible(true);
}
public static void main(String[] args) {
CopyStringToLabel cop = new CopyStringToLabel();
}
}