I’m still not really sure what misconception lead to this class:
public class StatusBar {
private JTextField status;
public void setStatus (String status) {
this.status.setText(status);
}
public void clearStatus () {
this.status.setText("");
}
public JTextField getStatus () {
return this.status;
}
}
I can’t comprehend why they didn’t just extend
JTextField to add their methods instead of doing this weird wrapping. This violation of encapsulation principles really hurts somehow.
Posted by torturedtutor 