To illustrate:
public class FooButton extends JButton {
protected Integer length = 30;
public FooButton(String txt) {
setText(txt);
}
@Override
public void setText(String txt) {
super.setText(txt.substring(0, length));
}
}
Unfortunatly for me, Eclipse tells me that length is null while passing through setText().
Shouldn’t it be: