else {
nothingToSearchFor();
}
+ if (mySearchField instanceof JTextArea) {
+ UIUtil.adjustRows((JTextArea)mySearchField, 2, 6);
+ }
}
public boolean isRegexp() {
private void replaceFieldDocumentChanged() {
setMatchesLimit(LivePreviewController.MATCHES_LIMIT);
myFindModel.setStringToReplace(myReplaceField.getText());
+ if (myReplaceField instanceof JTextArea) {
+ UIUtil.adjustRows((JTextArea)myReplaceField, 2, 6);
+ }
}
private boolean canReplaceCurrent() {
super.paintBorder(g);
paintBorderOfTextField(g);
}
+
+ @Override
+ public Dimension getPreferredSize() {
+ return super.getPreferredSize();
+ }
};
((JTextArea)editorTextField).setColumns(25);
- ((JTextArea)editorTextField).setRows(3);
+ ((JTextArea)editorTextField).setRows(2);
final JScrollPane scrollPane = new JBScrollPane(editorTextField,
- ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
- ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+ ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
+ ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
myLeftComponent.add(scrollPane, constraint);
componentRef.set(scrollPane);
}
textComponent.getActionMap().put("redoKeystroke", REDO_ACTION);
}
+ public static void adjustRows(JTextArea area, int minRows, int maxRows) {
+ area.setRows(Math.max(minRows, Math.min(maxRows, area.getText().split("\n").length)));
+ }
+
public static void playSoundFromResource(final String resourceName) {
final Class callerClass = ReflectionUtil.getGrandCallerClass();
if (callerClass == null) return;