These days I was reading about good pratices on java, and at some point my world has broken in pieces, because they say that call "init" methods on constructor can be a bad pratice, I know.. public methods can be overridden, but in my case is a little bit different, so please help take it of my head. example:
public class MLabel extends JLabel {
private Color color;
public MLabel(String txt, Color color, int align) {
super(txt, null, align);
this.color = color;
init();
}
private void init() {
setFont(new Font(Font.SERIF, Font.BOLD, 16));
setForeground(color);
}
}
I already read that answer, but still couldn't find the solution, think that factories will make a much robust code for this simple task, I just want to "configure" the JLabel for easy usage
thank you all, study about good pratices on programming is a little hard because the problems don't appear with errors but with how it could be made, I've upvoted all for the great answers, and I'll change inits() for factories for now, at least.. thank you