Login  Register

Re: Running Java based GUIs as Plug In

Posted by Peter Mc on Oct 14, 2013; 8:08pm
URL: http://imagej.273.s1.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165p5005170.html

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.