diff --git a/src/main/java/com/shuzijun/leetcode/plugin/window/login/LoginPanel.java b/src/main/java/com/shuzijun/leetcode/plugin/window/login/LoginPanel.java index 5b26d81..c3a23c9 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/window/login/LoginPanel.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/window/login/LoginPanel.java @@ -53,7 +53,11 @@ public LoginPanel(@Nullable Project project) { if (HttpLogin.isEnabledJcef()) { okAction = new OkAction() { }; - jcefPanel = new JcefPanel(project, okAction); + try { + jcefPanel = new JcefPanel(project, okAction); + } catch (IllegalArgumentException e) { + jcefPanel = new JcefPanel(project, okAction,true); + } jcefPanel.getComponent().setMinimumSize(new Dimension(1000, 500)); jcefPanel.getComponent().setPreferredSize(new Dimension(1000, 500)); panel.addToCenter(new JBScrollPane(jcefPanel.getComponent(), JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); @@ -145,10 +149,21 @@ private static class JcefPanel extends JCEFHtmlPanel { private Action okAction; + public JcefPanel(Project project, Action okAction, boolean old) { + super( null); + this.project = project; + this.okAction = okAction; + init(); + } + public JcefPanel(Project project, Action okAction) { super(null, null); this.project = project; this.okAction = okAction; + init(); + } + + private void init(){ getJBCefClient().addLoadHandler(cefLoadHandler = new CefLoadHandlerAdapter() { boolean successDispose = false;