Running Java based GUIs as Plug In

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Running Java based GUIs as Plug In

Influenza
Hello Everyone!

I'm trying to build a user-friendly GUI for a PlugIn. I know that it must be possible, but I looked all over the net and couldn't find a solute answer. The problem that I have is that the PlugIn runs bug-free, and the imageJ status line says "done" without showing the GUI.

For example an easy code:

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import ij.plugin.*;
import ij.plugin.frame.*;
import java.awt.Color;
import javax.swing.*;
 



public class JFrameExample_
{
    public static void main(String[] args)
    {

        JFrame myJFrame = new JFrame();
        myJFrame.setTitle("JRadioButton Beispiel");
        myJFrame.setSize(450,300);
        JPanel panel = new JPanel();
        panel.setBackground(Color.red);

        JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
        panel.add(check);
 
        myJFrame.add(panel);
    myJFrame.setLocation(100, 200);
        myJFrame.pack();
        myJFrame.setVisible(true);
        }
}

The Compiler runs over it without any trouble, but the GUI is not shown. I saw a lot of PlugIns running with Java GUIs but I couldn't get a single one work! I'm very gladful for every idea.

best regards
Steve
Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

John Hayes
Hi Steve,

ImageJ plugins don’t use the standard Java ‘main’ function as an entry point. Try creating a new ImageJ Plugin from « Plugins|New|Plugin » and calling your GUI code from within the provided « run » function. Something like the following:

> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import java.awt.image.*;
> import java.awt.event.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> import java.awt.Color;
> import javax.swing.*;
>
> public class My_Plugin implements PlugIn {
>
> public void run(String arg) {
> IJ.showMessage("My_Plugin","Hello world!");
> JFrame myJFrame = new JFrame();
> myJFrame.setTitle("JRadioButton Beispiel");
> myJFrame.setSize(450,300);
> JPanel panel = new JPanel();
> panel.setBackground(Color.red);
>
> JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
> panel.add(check);
>
> myJFrame.add(panel);
> myJFrame.setLocation(100, 200);
> myJFrame.pack();
> myJFrame.setVisible(true);
> }
> }
Then, compile and run...

Best regards,

John

Le 14 oct. 2013 à 15:41, Influenza a écrit :

> Hello Everyone!
>
> I'm trying to build a user-friendly GUI for a PlugIn. I know that it must be
> possible, but I looked all over the net and couldn't find a solute answer.
> The problem that I have is that the PlugIn runs bug-free, and the imageJ
> status line says "done" without showing the GUI.
>
> For example an easy code:
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import java.awt.image.*;
> import java.awt.event.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> import java.awt.Color;
> import javax.swing.*;
>
>
>
>
> public class JFrameExample_
> {
>    public static void main(String[] args)
>    {
>
>        JFrame myJFrame = new JFrame();
>        myJFrame.setTitle("JRadioButton Beispiel");
>        myJFrame.setSize(450,300);
>        JPanel panel = new JPanel();
>        panel.setBackground(Color.red);
>
>        JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
>        panel.add(check);
>
>        myJFrame.add(panel);
>    myJFrame.setLocation(100, 200);
> myJFrame.pack();
>        myJFrame.setVisible(true);
> }
> }
>
> The Compiler runs over it without any trouble, but the GUI is not shown. I
> saw a lot of PlugIns running with Java GUIs but I couldn't get a single one
> work! I'm very gladful for every idea.
>
> best regards
> Steve
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

dscho
Hi,

On Mon, 14 Oct 2013, John Hayes wrote:

> ImageJ plugins don’t use the standard Java ‘main’ function as an entry point.

To clarify: main() methods are meant to be main entry points into
applications, not into classes. You should expect main() methods to call
System.exit() upon exit, which would quit all of ImageJ without giving the
user a chance to save their data.

That is the reason why plugins have a run() method which is expected
*not* to quit the application.

ImageJ plugins also have the quirk that you can perform all the
computation in a constructor (that cannot take parameters). This is not
good object-oriented design, of course, but it is convenient for
quick-n-dirty coding.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

Peter Mc
In reply to this post by Influenza
Hi Steve;

Guess you are a newbie programming plugins, I was a few months ago :)

You don't need a main method. Just implement the necessary interface (PlugIn, PlugInFilter or PlugInFrame), check on the site for more information.

In your example the code below should work.

public class JFrameExample_ implements PlugIn {

        public void run(String arg0) {
                   JFrame myJFrame = new JFrame();
                myJFrame.setTitle("JRadioButton Beispiel");
                myJFrame.setSize(450,300);
                JPanel panel = new JPanel();
                panel.setBackground(Color.red);

                JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
                panel.add(check);
         
                myJFrame.add(panel);
            myJFrame.setLocation(100, 200);
                myJFrame.pack();
                myJFrame.setVisible(true);
               
        }

}
Research engineer
HGGM. Madrid.
Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

Influenza
In reply to this post by John Hayes
Thanks for your fast reaction!

But unfortunatelly it still doesn't work.

"java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at ij.plugin.CompilerTool$JavaxCompilerTool.compile(Compiler.java:366)
at ij.plugin.Compiler.compile(Compiler.java:150)
at ij.plugin.Compiler.compileAndRun(Compiler.java:71)
at ij.plugin.Compiler.run(Compiler.java:37)
at ij.IJ.runPlugIn(IJ.java:166)
at ij.IJ.runPlugIn(IJ.java:149)
at ij.plugin.frame.Editor.compileAndRun(Editor.java:347)
at ij.plugin.frame.Editor.actionPerformed(Editor.java:601)
at java.awt.MenuItem.processActionEvent(MenuItem.java:627)
at java.awt.MenuItem.processEvent(MenuItem.java:586)
at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:317)
at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:305)
at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:320)
at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:305)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.IllegalArgumentException: All compilation units must be of SOURCE kind
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:203)
 ... 25 more"

have you tried it yourselve or any ideas left?

Beste regards 
steve



2013/10/15 John Hayes [via ImageJ] <[hidden email]>
Hi Steve,

ImageJ plugins don’t use the standard Java ‘main’ function as an entry point. Try creating a new ImageJ Plugin from « Plugins|New|Plugin » and calling your GUI code from within the provided « run » function. Something like the following:

> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import java.awt.image.*;
> import java.awt.event.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> import java.awt.Color;
> import javax.swing.*;
>
> public class My_Plugin implements PlugIn {
>
> public void run(String arg) {
> IJ.showMessage("My_Plugin","Hello world!");
> JFrame myJFrame = new JFrame();

> myJFrame.setTitle("JRadioButton Beispiel");
> myJFrame.setSize(450,300);
> JPanel panel = new JPanel();
> panel.setBackground(Color.red);
>
> JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
> panel.add(check);
>
> myJFrame.add(panel);
> myJFrame.setLocation(100, 200);
> myJFrame.pack();
> myJFrame.setVisible(true);
> }
> }
Then, compile and run...

Best regards,

John

Le 14 oct. 2013 à 15:41, Influenza a écrit :

> Hello Everyone!
>
> I'm trying to build a user-friendly GUI for a PlugIn. I know that it must be
> possible, but I looked all over the net and couldn't find a solute answer.
> The problem that I have is that the PlugIn runs bug-free, and the imageJ
> status line says "done" without showing the GUI.
>
> For example an easy code:
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import java.awt.image.*;
> import java.awt.event.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> import java.awt.Color;
> import javax.swing.*;
>
>
>
>
> public class JFrameExample_
> {
>    public static void main(String[] args)
>    {
>
>        JFrame myJFrame = new JFrame();

>        myJFrame.setTitle("JRadioButton Beispiel");
>        myJFrame.setSize(450,300);
>        JPanel panel = new JPanel();
>        panel.setBackground(Color.red);
>
>        JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
>        panel.add(check);
>
>        myJFrame.add(panel);
>    myJFrame.setLocation(100, 200);
> myJFrame.pack();
>        myJFrame.setVisible(true);
> }
> }
>
> The Compiler runs over it without any trouble, but the GUI is not shown. I

> saw a lot of PlugIns running with Java GUIs but I couldn't get a single one
> work! I'm very gladful for every idea.
>
> best regards
> Steve
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165p5005179.html
To unsubscribe from Running Java based GUIs as Plug In, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

Influenza
In reply to this post by dscho
Thanks Johannes,

you improved my nooby-knowledge.
But do you have an idea how I can run and display the java based GUI? it even doesn't work when I changethe main into a run() method...

Best regards
Steve
Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

Jerome Mutterer-3
In reply to this post by Influenza
Dear Steve,
You could try and modify this example from the plugins page:
http://rsbweb.nih.gov/ij/plugins/download/tutorial/FrameDemo_.java
Sincerely,

Jerome


On 15 October 2013 19:42, Influenza <[hidden email]> wrote:

> Thanks for your fast reaction!
>
> But unfortunatelly it still doesn't work.
>
> "java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at ij.plugin.CompilerTool$JavaxCompilerTool.compile(Compiler.java:366)
> at ij.plugin.Compiler.compile(Compiler.java:150)
> at ij.plugin.Compiler.compileAndRun(Compiler.java:71)
> at ij.plugin.Compiler.run(Compiler.java:37)
> at ij.IJ.runPlugIn(IJ.java:166)
> at ij.IJ.runPlugIn(IJ.java:149)
> at ij.plugin.frame.Editor.compileAndRun(Editor.java:347)
> at ij.plugin.frame.Editor.actionPerformed(Editor.java:601)
> at java.awt.MenuItem.processActionEvent(MenuItem.java:627)
> at java.awt.MenuItem.processEvent(MenuItem.java:586)
> at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:317)
> at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:305)
> at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:320)
> at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:305)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
> at
>
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
> at
>
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
> at
>
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> Caused by: java.lang.IllegalArgumentException: All compilation units must
> be of SOURCE kind
> at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:203)
>  ... 25 more"
>
> have you tried it yourselve or any ideas left?
>
> Beste regards
> steve
>
>
>
> 2013/10/15 John Hayes [via ImageJ] <[hidden email]>
>
> > Hi Steve,
> >
> > ImageJ plugins don’t use the standard Java ‘main’ function as an entry
> > point. Try creating a new ImageJ Plugin from « Plugins|New|Plugin » and
> > calling your GUI code from within the provided « run » function.
> Something
> > like the following:
> >
> > > import ij.*;
> > > import ij.process.*;
> > > import ij.gui.*;
> > > import java.awt.*;
> > > import java.awt.image.*;
> > > import java.awt.event.*;
> > > import ij.plugin.*;
> > > import ij.plugin.frame.*;
> > > import java.awt.Color;
> > > import javax.swing.*;
> > >
> > > public class My_Plugin implements PlugIn {
> > >
> > > public void run(String arg) {
> > > IJ.showMessage("My_Plugin","Hello world!");
> > > JFrame myJFrame = new JFrame();
> > > myJFrame.setTitle("JRadioButton Beispiel");
> > > myJFrame.setSize(450,300);
> > > JPanel panel = new JPanel();
> > > panel.setBackground(Color.red);
> > >
> > > JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
> > > panel.add(check);
> > >
> > > myJFrame.add(panel);
> > > myJFrame.setLocation(100, 200);
> > > myJFrame.pack();
> > > myJFrame.setVisible(true);
> > > }
> > > }
> > Then, compile and run...
> >
> > Best regards,
> >
> > John
> >
> > Le 14 oct. 2013 à 15:41, Influenza a écrit :
> >
> > > Hello Everyone!
> > >
> > > I'm trying to build a user-friendly GUI for a PlugIn. I know that it
> > must be
> > > possible, but I looked all over the net and couldn't find a solute
> > answer.
> > > The problem that I have is that the PlugIn runs bug-free, and the
> imageJ
> > > status line says "done" without showing the GUI.
> > >
> > > For example an easy code:
> > >
> > > import ij.*;
> > > import ij.process.*;
> > > import ij.gui.*;
> > > import java.awt.*;
> > > import java.awt.image.*;
> > > import java.awt.event.*;
> > > import ij.plugin.*;
> > > import ij.plugin.frame.*;
> > > import java.awt.Color;
> > > import javax.swing.*;
> > >
> > >
> > >
> > >
> > > public class JFrameExample_
> > > {
> > >    public static void main(String[] args)
> > >    {
> > >
> > >        JFrame myJFrame = new JFrame();
> > >        myJFrame.setTitle("JRadioButton Beispiel");
> > >        myJFrame.setSize(450,300);
> > >        JPanel panel = new JPanel();
> > >        panel.setBackground(Color.red);
> > >
> > >        JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
> > >        panel.add(check);
> > >
> > >        myJFrame.add(panel);
> > >    myJFrame.setLocation(100, 200);
> > > myJFrame.pack();
> > >        myJFrame.setVisible(true);
> > > }
> > > }
> > >
> > > The Compiler runs over it without any trouble, but the GUI is not
> shown.
> > I
> > > saw a lot of PlugIns running with Java GUIs but I couldn't get a single
> > one
> > > work! I'm very gladful for every idea.
> > >
> > > best regards
> > > Steve
> > >
> > >
> > >
> > > --
> > > View this message in context:
> >
> http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165.html
> > > Sent from the ImageJ mailing list archive at Nabble.com.
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165p5005179.html
> >  To unsubscribe from Running Java based GUIs as Plug In, click here<
> >
> > .
> > NAML<
>
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165p5005185.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

Michael Schmid
In reply to this post by Influenza
Hi Steve,

the plugin 'My_Plugin' copied from the mail below compiles and runs with no error in my version of ImageJ:
I tried ImageJ 1.46r and the daily build ImageJ 1.48e12
Java 1.6.0_51 [64-bit] Mac OSX 10.6.8

Michael
________________________________________________________________
On Oct 15, 2013, at 19:42, Influenza wrote:

> Thanks for your fast reaction!
>
> But unfortunatelly it still doesn't work.
>
> "java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at ij.plugin.CompilerTool$JavaxCompilerTool.compile(Compiler.java:366)
> at ij.plugin.Compiler.compile(Compiler.java:150)
> at ij.plugin.Compiler.compileAndRun(Compiler.java:71)
> at ij.plugin.Compiler.run(Compiler.java:37)
> at ij.IJ.runPlugIn(IJ.java:166)
> at ij.IJ.runPlugIn(IJ.java:149)
> at ij.plugin.frame.Editor.compileAndRun(Editor.java:347)
> at ij.plugin.frame.Editor.actionPerformed(Editor.java:601)
> at java.awt.MenuItem.processActionEvent(MenuItem.java:627)
> at java.awt.MenuItem.processEvent(MenuItem.java:586)
> at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:317)
> at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:305)
> at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:320)
> at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:305)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
> at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
> at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
> at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> Caused by: java.lang.IllegalArgumentException: All compilation units must
> be of SOURCE kind
> at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:203)
> ... 25 more"
>
> have you tried it yourselve or any ideas left?
>
> Beste regards
> steve
>
>
>
> 2013/10/15 John Hayes [via ImageJ] <[hidden email]>
>
>> Hi Steve,
>>
>> ImageJ plugins don’t use the standard Java ‘main’ function as an entry
>> point. Try creating a new ImageJ Plugin from « Plugins|New|Plugin » and
>> calling your GUI code from within the provided « run » function. Something
>> like the following:
>>
>>> import ij.*;
>>> import ij.process.*;
>>> import ij.gui.*;
>>> import java.awt.*;
>>> import java.awt.image.*;
>>> import java.awt.event.*;
>>> import ij.plugin.*;
>>> import ij.plugin.frame.*;
>>> import java.awt.Color;
>>> import javax.swing.*;
>>>
>>> public class My_Plugin implements PlugIn {
>>>
>>> public void run(String arg) {
>>> IJ.showMessage("My_Plugin","Hello world!");
>>> JFrame myJFrame = new JFrame();
>>> myJFrame.setTitle("JRadioButton Beispiel");
>>> myJFrame.setSize(450,300);
>>> JPanel panel = new JPanel();
>>> panel.setBackground(Color.red);
>>>
>>> JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
>>> panel.add(check);
>>>
>>> myJFrame.add(panel);
>>> myJFrame.setLocation(100, 200);
>>> myJFrame.pack();
>>> myJFrame.setVisible(true);
>>> }
>>> }
>> Then, compile and run...
>>
>> Best regards,
>>
>> John
>>
>> Le 14 oct. 2013 à 15:41, Influenza a écrit :
>>
>>> Hello Everyone!
>>>
>>> I'm trying to build a user-friendly GUI for a PlugIn. I know that it
>> must be
>>> possible, but I looked all over the net and couldn't find a solute
>> answer.
>>> The problem that I have is that the PlugIn runs bug-free, and the imageJ
>>> status line says "done" without showing the GUI.
>>>
>>> For example an easy code:
>>>
>>> import ij.*;
>>> import ij.process.*;
>>> import ij.gui.*;
>>> import java.awt.*;
>>> import java.awt.image.*;
>>> import java.awt.event.*;
>>> import ij.plugin.*;
>>> import ij.plugin.frame.*;
>>> import java.awt.Color;
>>> import javax.swing.*;
>>>
>>>
>>>
>>>
>>> public class JFrameExample_
>>> {
>>>   public static void main(String[] args)
>>>   {
>>>
>>>       JFrame myJFrame = new JFrame();
>>>       myJFrame.setTitle("JRadioButton Beispiel");
>>>       myJFrame.setSize(450,300);
>>>       JPanel panel = new JPanel();
>>>       panel.setBackground(Color.red);
>>>
>>>       JCheckBox check = new JCheckBox("Ich bin eine CheckBox", true);
>>>       panel.add(check);
>>>
>>>       myJFrame.add(panel);
>>>   myJFrame.setLocation(100, 200);
>>> myJFrame.pack();
>>>       myJFrame.setVisible(true);
>>> }
>>> }
>>>
>>> The Compiler runs over it without any trouble, but the GUI is not shown.
>> I
>>> saw a lot of PlugIns running with Java GUIs but I couldn't get a single
>> one
>>> work! I'm very gladful for every idea.
>>>
>>> best regards
>>> Steve
>>>
>>>
>>>
>>> --
>>> View this message in context:
>> http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165.html
>>> Sent from the ImageJ mailing list archive at Nabble.com.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165p5005179.html
>> To unsubscribe from Running Java based GUIs as Plug In, click here<
>> .
>> NAML<
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165p5005185.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Running Java based GUIs as Plug In

Influenza
In reply to this post by Influenza
Thanks to everyone!
Maybe there was something wrong with my imageJ. I reinstalled it and with your advices I now do fine!

Best regards