Re: Displaying dialog during module restore causes java.lang.IllegalStateException: no splash screen available
Paolo Repele <[email protected]> Mon, 16 Oct 2017 16:14:41 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <CAGtHowbMzSbUGLJpie1h2Gs6Ujf_8M_UoMVAZDt=LzaeqrhZqQ@mail.gmail.com> |
--94eb2c086d18e4338c055baaa155
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi,
you have to wait the window manager is ready before to use dialog displayer=
.
Try
WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
@Override
public void run() {
//do something
}
});
On 16 October 2017 at 15:52, Martin Barn=C3=A1=C5=A1 <martin.barnas@certico=
n.cz>
wrote:
> Hi all,
>
> I have application built on top of Netbeans Platform and I need to do som=
e
> checks during loading of one of the modules and display a dialog if some =
of
> the check fails to let the user to decide what should happen.
>
> Inspired by this tutorial https://platform.netbeans.org/
> tutorials/60/nbm-login.html I created installer for the module and put
> the checks and dialog display to the installers method restore().
> NetBeans NetBeans Platform Login Tutorial
> <https://platform.netbeans.org/tutorials/60/nbm-login.html>
> platform.netbeans.org
> NetBeans Platform Login Tutorial. This tutorial demonstrates how to creat=
e
> a login form for a NetBeans Platform application with very simple user an=
d
> password management.
>
> public class Installer extends ModuleInstall {
>
> @Override
> public void restored() {
> if (check()) {
> DialogDisplayer.getDefault().notify(myDialogDescriptor);
> //...
> }
> }
>
> This works but causes the splash screen to be closed and later there
> occurs an exception
>
> java.lang.IllegalStateException: no splash screen available
> at java.awt.SplashScreen.checkVisible(SplashScreen.java:197)
> at java.awt.SplashScreen.update(SplashScreen.java:324)
> at org.netbeans.core.startup.Splash$SplashPainter.repaint(Splash.java:401=
)
> at org.netbeans.core.startup.Splash$SplashPainter$1.run(Splash.java:442)
> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
> at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
> at java.awt.EventQueue.access$500(EventQueue.java:97)
> at java.awt.EventQueue$3.run(EventQueue.java:709)
> at java.awt.EventQueue$3.run(EventQueue.java:703)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPr=
ivilege(ProtectionDomain.java:80)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
> at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea=
d.java:201)
> at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j=
ava:116)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea=
d.java:105)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
>
> What can I do to prevent this exception?
> Thanks
> Martin
>
>
--=20
Non hai veramente capito qualcosa fino a quando non sei in grado di
spiegarlo a tua nonna. (A.Einstein)
--94eb2c086d18e4338c055baaa155
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<div>you have to wait the window manager is ready befor=
e to use dialog displayer.</div><div>Try</div><div><br></div><div><div>Wind=
owManager.getDefault().invokeWhenUIReady(new Runnable() {</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @Override</d=
iv><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 public void run() {</div></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0//do something</div>=
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
}</div><div>});</div></div><div class=3D"gmail_extra"><br><div class=3D"gma=
il_quote">On 16 October 2017 at 15:52, Martin Barn=C3=A1=C5=A1 <span dir=3D=
"ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank">ma=
[email protected]</a>></span> wrote:<br><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">
<div dir=3D"ltr">
<div id=3D"m_-2968128612120323547divtagdefaultwrapper" style=3D"font-size:1=
2pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir=3D"ltr">
<div id=3D"m_-2968128612120323547divtagdefaultwrapper" style=3D"font-size:1=
2pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,"EmojiFo=
nt","Apple Color Emoji","Segoe UI Emoji",NotoColor=
Emoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" d=
ir=3D"ltr">
<div class=3D"m_-2968128612120323547vote"><span class=3D"m_-296812861212032=
3547vote-count-post">Hi all,<br>
</span></div>
<div>
<div class=3D"m_-2968128612120323547post-text">
<p>I have application built on top of Netbeans Platform and I need to do so=
me checks during loading of one of the modules and display a dialog if some=
of the check fails to let the user to decide what should happen.</p>
<p>Inspired by this tutorial <a href=3D"https://platform.netbeans.org/tutor=
ials/60/nbm-login.html" rel=3D"nofollow noreferrer" id=3D"m_-29681286121203=
23547LPlnk428140" target=3D"_blank">
https://platform.netbeans.org/<wbr>tutorials/60/nbm-login.html</a> I create=
d installer for the module and put the checks and dialog display to the ins=
tallers method
<code>restore()</code>. </p>
<div id=3D"m_-2968128612120323547LPBorder_GT_15081619166690.790797136275825=
4" style=3D"margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id=3D"m_-2968128612120323547LPContainer_15081619166600.2683344605599=
0395" style=3D"width:90%;background-color:rgb(255,255,255);overflow:auto;pa=
dding-top:20px;padding-bottom:20px;margin-top:20px;border-top:1px dotted rg=
b(200,200,200);border-bottom:1px dotted rgb(200,200,200)" cellspacing=3D"0"=
>
<tbody>
<tr style=3D"border-spacing:0px" valign=3D"top">
<td id=3D"m_-2968128612120323547TextCell_15081619166630.9391906904566244" s=
tyle=3D"vertical-align:top;padding:0px;display:table-cell" colspan=3D"2">
<div id=3D"m_-2968128612120323547LPRemovePreviewContainer_15081619166630.20=
597966394697909"></div>
<div id=3D"m_-2968128612120323547LPTitle_15081619166630.7902122015153895" s=
tyle=3D"color:rgb(0,120,215);font-weight:400;font-size:21px;font-family:&qu=
ot;wf_segoe-ui_light","Segoe UI Light","Segoe WP Light&=
quot;,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;lin=
e-height:21px">
<a id=3D"m_-2968128612120323547LPUrlAnchor_15081619166650.1844933724819391"=
style=3D"text-decoration:none" href=3D"https://platform.netbeans.org/tutor=
ials/60/nbm-login.html" target=3D"_blank">NetBeans NetBeans Platform Login =
Tutorial</a></div>
<div id=3D"m_-2968128612120323547LPMetadata_15081619166660.9981489095626906=
" style=3D"margin:10px 0px 16px;color:rgb(102,102,102);font-weight:400;font=
-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP&=
quot;,Tahoma,Arial,sans-serif;font-size:14px;line-height:14px">
<a href=3D"http://platform.netbeans.org" target=3D"_blank">platform.netbean=
s.org</a></div>
<div id=3D"m_-2968128612120323547LPDescription_15081619166680.2284773746941=
321" style=3D"display:block;color:rgb(102,102,102);font-weight:400;font-fam=
ily:"wf_segoe-ui_normal","Segoe UI","Segoe WP"=
;,Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;=
overflow:hidden">
NetBeans Platform Login Tutorial. This tutorial demonstrates how to create =
a login form for a NetBeans Platform application with very simple user and =
password management.</div>
</td>
</tr>
</tbody>
</table>
</div>
<pre><code>public class Installer extends ModuleInstall {
@Override
public void restored() {
if (check()) {
DialogDisplayer.getDefault().<wbr>notify(myDialogDescriptor);
//...
}
}
</code></pre>
<p>This works but causes the splash screen to be closed and later there occ=
urs an exception</p>
<pre><code>java.lang.<wbr>IllegalStateException: no splash screen available
at java.awt.SplashScreen.<wbr>checkVisible(SplashScreen.<wbr>java:197)
at java.awt.SplashScreen.update(<wbr>SplashScreen.java:324)
at org.netbeans.core.startup.<wbr>Splash$SplashPainter.repaint(<wbr>Splash.=
java:401)
at org.netbeans.core.startup.<wbr>Splash$SplashPainter$1.run(<wbr>Splash.ja=
va:442)
at java.awt.event.<wbr>InvocationEvent.dispatch(<wbr>InvocationEvent.java:3=
11)
at java.awt.EventQueue.<wbr>dispatchEventImpl(EventQueue.<wbr>java:756)
at java.awt.EventQueue.access$<wbr>500(EventQueue.java:97)
at java.awt.EventQueue$3.run(<wbr>EventQueue.java:709)
at java.awt.EventQueue$3.run(<wbr>EventQueue.java:703)
at java.security.<wbr>AccessController.doPrivileged(<wbr>Native Method)
at java.security.<wbr>ProtectionDomain$<wbr>JavaSecurityAccessImpl.<wbr>doI=
ntersectionPrivilege(<wbr>ProtectionDomain.java:80)
at java.awt.EventQueue.<wbr>dispatchEvent(EventQueue.java:<wbr>726)
at java.awt.EventDispatchThread.<wbr>pumpOneEventForFilters(<wbr>EventDispa=
tchThread.java:201)
at java.awt.EventDispatchThread.<wbr>pumpEventsForFilter(<wbr>EventDispatch=
Thread.java:116)
at java.awt.EventDispatchThread.<wbr>pumpEventsForHierarchy(<wbr>EventDispa=
tchThread.java:105)
at java.awt.EventDispatchThread.<wbr>pumpEvents(<wbr>EventDispatchThread.ja=
va:101)
at java.awt.EventDispatchThread.<wbr>pumpEvents(<wbr>EventDispatchThread.ja=
va:93)
at java.awt.EventDispatchThread.<wbr>run(EventDispatchThread.java:<wbr>82)
</code></pre>
<p>What can I do to prevent this exception?</p>
</div>
</div>
Thanks</div><span class=3D"HOEnZb"><font color=3D"#888888">
<div style=3D"font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica=
,sans-serif,"EmojiFont","Apple Color Emoji","Segoe=
UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Em=
oji",EmojiSymbols" dir=3D"ltr">
Martin<br>
<p></p>
</div>
</font></span></div>
</div>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature">Non hai veramente c=
apito qualcosa fino a quando non sei in grado di spiegarlo a tua nonna. (A.=
Einstein)</div>
</div>
--94eb2c086d18e4338c055baaa155--