Dialog Wrapper not working
已回答
Hello,
Im trying to use simple dialog window and following example use of Dialog wrapper class. Dialog is not appearing and code is not moving past Dialog wrapper initialization. Im not getting any error and i tried debugging where is code stopping. Im not sure what could be the cause for this. Thanks for any help.
Class usage
Dialog wrapper class code
package org.intellij.sdk.settings;
import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
public class UpdateConfirmationDialog extends DialogWrapper {
public UpdateConfirmationDialog() {
super(true);
setTitle("Test DialogWrapper");
init();
}
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel dialogPanel = new JPanel(new BorderLayout());
JLabel label = new JLabel("Testing");
label.setPreferredSize(new Dimension(100, 100));
dialogPanel.add(label, BorderLayout.CENTER);
return dialogPanel;
}
public String getText() {
return "hello";
}
}
Ive found out that code does not continue past this function in Dialog wrapper class.
Called from here
请先登录再写评论。
Please make sure you follow guidelines from https://plugins.jetbrains.com/docs/intellij/threading-model.html#invoking-operations-on-edt-and-modality for invoking showing the dialog. Otherwise, please share the full code of your project.
Hello, it seems that the problem is that im using this code inside scheduled code. When i put it outside the function, it works properly. I need the dialog to show automatically after period of time. This is my code.
Could you recommend how to achieve this together with working dialog ? Thanks for any advice or help.
Any UI code invocation must happen on EDT thread.
Thank you, that solved the problem. Guidelines you provided were helpful.