Separate class

In main program I have button whose actionperformed i want to write in separate class

JLabel label3 =new JLabel();

label3.setText("Added new RECORD to the DataBase");

String nam=txtA1.getText();

String num=txtA2.getText();

try

{

st2=con.createStatement();

String query="insert into dir1

values('"+num+"','"+nam+"')";

st2.executeUpdate(query);

st2.close();

}

catch(Exception e2)

{

label3.setText("Check that fields are not

empty.");

}

as the label3 and two text fields are common for main program and in this class . how to define it in this class?

[1055 byte] By [seemapa] at [2007-11-27 11:21:46]
# 1

could you write a public setter in the main class and access the setText functionality through this setter?

petes1234a at 2007-7-29 14:51:00 > top of Java-index,Java Essentials,Java Programming...