@ Override public boolean getScrollableTracksViewportWidth ( ) { Component parent = getParent ( ) ; ComponentUI myui = getUI ( ) ; return parent == null || ( myui . getPreferredSize ( this ) . width <= parent . getSize ( ) . width ) ; }
to preserve the full width of the text