package appcomponents;
public class AppComponents extends javax.swing.JFrame{
public AppComponents(){
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
java.awt.Container con=getContentPane();
con.setLayout(null);
setBounds(150,200,400,500);
setVisible(true);
Labname=new javax.swing.JLabel("Hello New world!");
Labname.setBounds(50,30,140,30);
con.add(Labname);
txt1=new javax.swing.JTextField();
txt1.setBounds(170,30,140,30);
con.add(txt1);
btOK=new java.awt.Button("ok");
btOK.setBounds(170,80,140,30);
con.add(btOK);
btOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btOKActionPerformed(evt);
}
});
}
private void btOKActionPerformed(java.awt.event.ActionEvent evt) {
Labname.setText(txt1.getText())
}
public static void main(String[] args) {
new AppComponents();
}
private javax.swing.JLabel Labname;
private java.awt.Button btOK;
private javax.swing.JTextField txt1;
}