Hello,
I need some help. When I run the following GUI and then Exit it the Java or Javaw process doesn’t stop it just keeps going and appears to use all the CPU. I have no Idea what’s going on and any help would be appreciated. I am posting here because the newbie section is gone and I was using JOGL at the time of the problem(I commented out the JOGL stuff and it still doesn’t work).
/**
* This GUI uses a JSplitPane with a heavyweight GLCanvas. The split pane can
* only be resized by clicking on the little arrow to completly cover the screen
* with the left side and then resizing it backwards.
*
* @author Stephen Johnson
*
*
*/
public class CsEngineTool extends JFrame
{
//private Animator _animator;
private CsSimpleJoglRendering _renderer;
private GLDrawable _glDrawable;
public CsEngineTool()
{
super("Engine Tool");
_renderer = new CsSimpleJoglRendering();
addWindowListener(createWindowListener());
buildGUI();
setSize(500,500);
setVisible(true);
// _animator.start();
// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
protected void buildGUI()
{
JSplitPane splitPane = new JSplitPane();
splitPane.setOneTouchExpandable(true);
//getContentPane().setLayout(new GridLayout(1,2));
splitPane.setLeftComponent((buildTreePanel()));
//splitPane.setRightComponent(buildOpenGLPanel());
getContentPane().add(splitPane);
}
protected JPanel buildTreePanel()
{
JPanel p = new JPanel();
return p;
}
protected JPanel buildOpenGLPanel()
{
JPanel p = new JPanel();
p.setLayout(new GridLayout(1,1)); //don't know why but flowlayout doesn't work??
p.setBorder(BorderFactory.createLineBorder(Color.BLACK,2));
GLDrawableFactory f = GLDrawableFactory.getFactory();
GLCapabilities c = new GLCapabilities();
//c.setDoubleBuffered(false); //need this if making a GLJPanel
//_glDrawable = f.createGLJPanel(c);
//_animator = new Animator(_glDrawable);
//_glDrawable.addGLEventListener(_renderer);
//p.add((GLJPanel) _glDrawable);
_glDrawable = f.createGLCanvas(c);
// _animator = new Animator(_glDrawable);
_glDrawable.addGLEventListener(_renderer);
p.add((GLCanvas)_glDrawable);
return p;
}
public static void main(String args[])
{
CsEngineTool tool = new CsEngineTool();
}
protected WindowListener createWindowListener()
{
return new WindowAdapter()
{
public void windowClosed(WindowEvent we)
{
// _animator.stop();
((Window) we.getSource()).dispose();
System.exit(0);
// TODO Auto-generated method stub
}
};
}
}
Thanks,
Steve