Here i have a login form includes
username and
password
and i have another form which can records customer data and there are few text boxes to fill.
like customer name;
customer email and customer contact.
the basically what happens is when user get a call from a customer.
user put his or her user name and password, login to the system.
and user has to fill textboxes and after submit it, data saves in a mysql database.
so mysql has a database called customer.
it has five cloumns
cus id,cusName,cusAdress,cusContact,contactUser
So i have created a class called MysqlConnect which holds all setters and getters.
so i have created a getter and setter called setName and getName
public class MysqlConnect {
String Name;
public void setName(String newName){
Name = newName;
}
public String getName(){
return Name;
}
}
then i set a value in the login form
nameSet = uName.getText();
MysqlConnect cont = new MysqlConnect();
cont.setName(nameSet);
after that i have implement a getter in the other form call customer data.
MysqlConnect cont = new MysqlConnect();
String namet = cont.getName();
JOptionPane.showMessageDialog(null, "Data Saved Successfully."+nameUser+"");
But it shows a null value.
What I have tried:
Getters and Setters as i Described?