Skip to content

Commit

Permalink
#33 Fix string editor dialog layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Dec 31, 2022
1 parent 26f0d50 commit 9cf1720
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import javax.swing.*;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.ActionListener;

public class StringValueEditor extends BaseValueEditor<String, JTextComponent> {
Expand All @@ -19,7 +20,10 @@ protected JTextComponent createComponentImpl() {
if (controller.getEditType() == EditType.INLINE) {
return new JTextField();
} else {
return new JTextArea();
final JTextArea area = new JTextArea();
area.setPreferredSize(new Dimension(500, 400));
area.setLineWrap(true);
return area;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ protected void buttonPressed(@NotNull ButtonDescriptor descriptor) {
@Override
protected JComponent createContentsPane() {
final JComponent component = editor.createComponent();

editor.setEditorValue(controller.getValue());
return component;

if (component instanceof Scrollable) {
return new JScrollPane(component);
} else {
return component;
}
}

@Override
Expand Down

0 comments on commit 9cf1720

Please sign in to comment.