Dimension () { Dimension size = super.getPreferredSize(); Dimension parentEditorSize = parentEditor.getScrollPane().getSize(); int maxWidth = (int)parentEditorSize.getWidth() / 3; int maxHeight = (int)parentEditorSize.getHeight() / 2; final int width = settings.isUseSoftWraps() ? maxWidth : Math.min((int)size.getWidth(), maxWidth); final int height = Math.min((int)size.getHeight(), maxHeight); return new Dimension(width, height); }