void () { Dimension newSize = Objects.requireNonNull(getSize()); int preferredHeight = getComponent().getPreferredSize().height; int realHeight = getComponent().getHeight(); boolean shouldExpand = preferredHeight + myMeanRowHeight < realHeight; boolean sizeWasIncreased = myPrevSize.height < newSize.height; if (!myInternalSizeChanged && sizeWasIncreased && shouldExpand) { List<MoreAction> mores = getMoreActions(); for (MoreAction more : mores) { if (!getList().getScrollableTracksViewportHeight()) break; if (!more.isExpanded()) { more.setExpanded(true); getListModel().refilter(); } } } myPrevSize = newSize; //ugly properties to distinguish user size changed from pack method call after Restore Size action performed myUserSizeChanged = !myInternalSizeChanged; myInternalSizeChanged = false; }