Dimension () { // Preferred size should not be zero, otherwise the content loading is not triggered Dimension size = super.getPreferredSize(); return size.width > 0 && size.height > 0 ? size : DEF_PREF_SIZE; }