Resize content of DialogWrapper when its size changes

Hello there,

my plugin shows a DialogWrapper that contains a JPanel (with a LanguageTextField).

When I change the size od the DialogWrapper, the size of JPanel does not change. How can I make it to always fill the whole DialogWrapper?

My DialogWrapper implementation looks like this:

 
public class EditorWrapper extends DialogWrapper {

    private JPanel panel = new JPanel();

    private
EditorTextField editorTextField;

    protected
EditorWrapper(Language language, Project project, String text) {
        super(project);
        super
.setOKActionEnabled(false);

        
init();

        editorTextField
= new LanguageTextField(language, project, text);
        editorTextField
.setOneLineMode(false);
        editorTextField
.setPreferredSize(new Dimension(800, 600));

        editorTextField
.setVisible(true);

        panel
.add(editorTextField);
    
}

    @Override
    protected
JComponent createCenterPanel() {
        return panel;
    
}
}
1 comment
Comment actions Permalink

I just found out on my own: Adding BorderLayout to my JPanel did the trick.

 
private JPanel panel = new JPanel(new BorderLayout());
0

Please sign in to leave a comment.