I would like to optimise my Java programming code towards a better separation of model and view.
At the moment I have Panels which represent the view and POJOs and DAOs representing the model.
Is it possible to separate the model component DaoUser from the View Panel?
// Panel User
class UserPanel extends JPanel{
DaoUser daoUser = new DaoUser;
User user = daoUser.findUser(current_id);
JTextField tf = new JTextField();
tf.setText(user.getName());
}
//POJO User
class User{
int id;
String name;
Getters and Setters ..
}
// Dao User
class DaoUser{
public void saveUser(User user)
public User findUsers();
public List<User> listUsers()
}