Can't get JPanel to open
Christopher Coulon <[email protected]> Wed, 15 Mar 2017 11:28:00 -0700
| Newsgroups | gmane.comp.java.netbeans.devel |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_DBCBA14D-D2DE-475F-BC7B-0E6ACAAED832
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
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 =
the image and the instance of ImageJ, but I cannot find any way to =
display my GUI (JPanel). I created a class from my RoA_.java code, and =
I tried this 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 =
<http://imagej.net/images/clown.jpg>");
// image.show();
// run the plugin
IJ.runPlugIn(clazz.getName(), "");
RoA_ ra =3D new RoA_();
ra.setVisible(true);
}=
--Apple-Mail=_DBCBA14D-D2DE-475F-BC7B-0E6ACAAED832
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=utf-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D"">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 the image and the instance of ImageJ, but I cannot find any =
way to display my GUI (JPanel). I created a class from my =
RoA_.java code, and I tried this 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?<div class=3D""><br =
class=3D""></div><blockquote class=3D"" style=3D"margin: 0px 0px 0px =
40px; border: none; padding: 0px;"><div class=3D""><div class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>public =
static void main(String[] args) {</div><div class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;"> =
</span>// set the plugins.dir property to make the plugin appear in the =
Plugins menu</div><div class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;"> </span>Class<?> clazz =3D =
RoA_.class;</div><div class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;"> </span>String url =3D =
clazz.getResource("/" + clazz.getName().replace('.', '/') + =
".class").toString();</div><div class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;"> </span>String pluginsDir =3D =
url.substring("file:".length(), url.length() - clazz.getName().length() =
- ".class".length());</div><div class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;"> =
</span>System.setProperty("plugins.dir", pluginsDir);</div><div =
class=3D""><br class=3D""></div><div class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;"> =
</span>// start ImageJ</div><div class=3D""><span class=3D"Apple-tab-span"=
style=3D"white-space: pre;"> </span>new ImageJ();</div><div =
class=3D""><br class=3D""></div><div class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;"> =
</span>// open the Clown sample</div><div class=3D"">//<span =
class=3D"Apple-tab-span" style=3D"white-space: pre;"> =
</span>ImagePlus image =3D IJ.openImage("<a =
href=3D"http://imagej.net/images/clown.jpg" =
class=3D"">http://imagej.net/images/clown.jpg</a>");</div><div =
class=3D"">//<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> =
</span>image.show();</div><div class=3D""><br =
class=3D""></div><div class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;"> </span>// run the =
plugin</div><div class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;"> =
</span>IJ.runPlugIn(clazz.getName(), "");</div><div class=3D""> =
RoA_ ra =3D new =
RoA_();</div><div class=3D""> =
ra.setVisible(true);</div><div class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;"> =
</span>}</div></div></blockquote></body></html>=
--Apple-Mail=_DBCBA14D-D2DE-475F-BC7B-0E6ACAAED832--