Running Java based GUIs as Plug In
Posted by Influenza on Oct 14, 2013; 1:41pm
URL: http://imagej.273.s1.nabble.com/Running-Java-based-GUIs-as-Plug-In-tp5005165.html
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