Re: Can't get JPanel to open
Peter Hansson <[email protected]> Thu, 16 Mar 2017 14:38:38 +0100
| Newsgroups | gmane.comp.java.netbeans.devel |
|---|---|
| Message-ID | <CAC55jYNk3grk0AWMgQhyYOnxk6p-VHxiX_bLLnZti4nu-xfuXg@mail.gmail.com> |
--001a1146ec94b93833054ad92d97 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Christian, are you really creating a Netbeans Platform application? Aren't you just creating a normal Java application? ... and you just happen to be using NetBeans IDE for your development? I have a feeling that you have hit the wrong mailing list with this question. Ask youself: Is the fact that you are using NetBeans IDE relevant for the question you are asking? If not, your question is probably better suited for another mailing list or perhaps SO. On Thu, Mar 16, 2017 at 1:59 PM, Enrico Scantamburlo <[email protected]= m > wrote: > there is no public static void main method in an netbeans rcp application= . > You should create a topcomponent and add the psnel to it. > > in case of a standalone application you must create a jframe, add the > jpanel to it and then make the jframe visible. > > On 15 Mar 2017 19:28, "Christopher Coulon" <[email protected]> > wrote: > >> I am trying to get my JPanel to display in my Netbeans project; I am >> using the Maven git hub Process_Pixels, and I can run that class with th= e >> image and the instance of ImageJ, but I cannot find any way to display m= y >> GUI (JPanel). I created a class from my RoA_.java code, and I tried thi= s >> code, which creates an instance of ImageJ, but does not show the JPanel.= I >> tried the code "IJ.runPlugIn(clazz.getName(), "=E2=80=9D);=E2=80=9D and = " RoA_ ra =3D new >> RoA_(); ra.setVisible(true);=E2=80=9D, but nothing works. How do I get = the JPanel >> to show up? >> >> public static void main(String[] args) { >> // set the plugins.dir property to make the plugin appear in the Plugins >> menu >> Class<?> clazz =3D RoA_.class; >> String url =3D clazz.getResource("/" + clazz.getName().replace('.', '/')= + >> ".class").toString(); >> String pluginsDir =3D url.substring("file:".length(), url.length() - >> clazz.getName().length() - ".class".length()); >> System.setProperty("plugins.dir", pluginsDir); >> >> // start ImageJ >> new ImageJ(); >> >> // open the Clown sample >> // ImagePlus image =3D IJ.openImage("http://imagej.net/images/clown.jpg"= ); >> // image.show(); >> >> // run the plugin >> IJ.runPlugIn(clazz.getName(), ""); >> RoA_ ra =3D new RoA_(); >> ra.setVisible(true); >> } >> >> --001a1146ec94b93833054ad92d97 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Christian,=C2=A0=C2=A0 are you really creating a Netb= eans Platform application?=C2=A0=C2=A0=C2=A0 Aren't you just creating a= normal Java application?=C2=A0=C2=A0 ... and you just happen to be using N= etBeans IDE for your development?<br><br></div>I have a feeling that you ha= ve hit the wrong mailing list with this question. Ask youself:=C2=A0 Is the= fact that you are using NetBeans IDE relevant for the question you are ask= ing?=C2=A0 If not, your question is probably better suited for another mail= ing list or perhaps SO.<br><br><br></div><div class=3D"gmail_extra"><br><di= v class=3D"gmail_quote">On Thu, Mar 16, 2017 at 1:59 PM, Enrico Scantamburl= o <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D= "_blank">[email protected]</a>></span> wrote:<br><blockquote class= =3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd= ing-left:1ex"><div dir=3D"auto">there is no public static void main method = in an netbeans rcp application. You should create a topcomponent and add th= e psnel to it.=C2=A0<div dir=3D"auto"><br></div><div dir=3D"auto">in case o= f a standalone application you must create a jframe, add the jpanel to it a= nd then make the jframe visible.</div></div><div class=3D"HOEnZb"><div clas= s=3D"h5"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On 15 Ma= r 2017 19:28, "Christopher Coulon" <<a href=3D"mailto:christop= [email protected]" target=3D"_blank">[email protected]</a>>= ; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D= "margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style= =3D"word-wrap:break-word">I am trying to get my JPanel to display in my Net= beans project; I am using the Maven git hub Process_Pixels, and I can run t= hat class with the image and the instance of ImageJ, but I cannot find any = way to display my GUI (JPanel).=C2=A0 I created a class from my RoA_.java c= ode, and I tried this code, which creates an instance of ImageJ, but does n= ot show the JPanel.=C2=A0 I tried the code "IJ.runPlugIn(clazz.getName= (), "=E2=80=9D);=E2=80=9D and " RoA_ ra =3D new RoA_(); ra.setVis= ible(true);=E2=80=9D, but nothing works.=C2=A0 How do I get the JPanel to s= how up?<div><br></div><blockquote style=3D"margin:0px 0px 0px 40px;border:n= one;padding:0px"><div><div><span class=3D"m_1430560716315220711m_-427307665= 406810701Apple-tab-span" style=3D"white-space:pre-wrap"> </span>public stat= ic void main(String[] args) {</div><div><span class=3D"m_143056071631522071= 1m_-427307665406810701Apple-tab-span" style=3D"white-space:pre-wrap"> </sp= an>// set the plugins.dir property to make the plugin appear in the Plugins= menu</div><div><span class=3D"m_1430560716315220711m_-427307665406810701Ap= ple-tab-span" style=3D"white-space:pre-wrap"> </span>Class<?> clazz = =3D RoA_.class;</div><div><span class=3D"m_1430560716315220711m_-4273076654= 06810701Apple-tab-span" style=3D"white-space:pre-wrap"> </span>String url = =3D clazz.getResource("/" + clazz.getName().replace('.', = '/') + ".class").toString();</div><div><span class=3D"m_1= 430560716315220711m_-427307665406810701Apple-tab-span" style=3D"white-space= :pre-wrap"> </span>String pluginsDir =3D url.substring("file:".l= ength()<wbr>, url.length() - clazz.getName().length() - ".class".= length());</div><div><span class=3D"m_1430560716315220711m_-427307665406810= 701Apple-tab-span" style=3D"white-space:pre-wrap"> </span>System.setProper= ty("plugins.di<wbr>r", pluginsDir);</div><div><br></div><div><spa= n class=3D"m_1430560716315220711m_-427307665406810701Apple-tab-span" style= =3D"white-space:pre-wrap"> </span>// start ImageJ</div><div><span class=3D= "m_1430560716315220711m_-427307665406810701Apple-tab-span" style=3D"white-s= pace:pre-wrap"> </span>new ImageJ();</div><div><br></div><div><span class= =3D"m_1430560716315220711m_-427307665406810701Apple-tab-span" style=3D"whit= e-space:pre-wrap"> </span>// open the Clown sample</div><div>//<span class= =3D"m_1430560716315220711m_-427307665406810701Apple-tab-span" style=3D"whit= e-space:pre-wrap"> </span>ImagePlus image =3D IJ.openImage("<a href= =3D"http://imagej.net/images/clown.jpg" target=3D"_blank">http://imagej.ne<= wbr>t/images/clown.jpg</a>");</div><div>//<span class=3D"m_14305607163= 15220711m_-427307665406810701Apple-tab-span" style=3D"white-space:pre-wrap"= > </span>image.show();</div><div><br></div><div><span class=3D"m_143056071= 6315220711m_-427307665406810701Apple-tab-span" style=3D"white-space:pre-wra= p"> </span>// run the plugin</div><div><span class=3D"m_143056071631522071= 1m_-427307665406810701Apple-tab-span" style=3D"white-space:pre-wrap"> </sp= an>IJ.runPlugIn(clazz.getName(), "");</div><div>=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 RoA_ ra =3D new RoA_();</div><div>= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ra.setVisible(true)= ;</div><div><span class=3D"m_1430560716315220711m_-427307665406810701Apple-= tab-span" style=3D"white-space:pre-wrap"> </span>}</div></div></blockquote>= </div></blockquote></div></div> </div></div></blockquote></div><br></div> --001a1146ec94b93833054ad92d97--