Login  Register

Deadlock on SimpleUniverse.getPreferredConfiguration() from Swing

Posted by Sebastian Lewalder on Apr 23, 2013; 9:09am
URL: https://forum.jogamp.org/Deadlock-on-SimpleUniverse-getPreferredConfiguration-from-Swing-tp4029006.html

Hi everybody,

I am using j3dcore-pre5.jar and j3dutils.jar (1.6.0-pre2) from the github and Jogl 2.0 rc11 is retrieved via maven central repository. Java version is 1.6.

I have problems creating a 3D scene as a result of clicking a button in swing.
So i stripped the code until the following was left over.

import java.awt.Dimension;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;

import com.sun.j3d.utils.universe.SimpleUniverse;

public class TestDeadlock
{
        public static void main(String[] args)
        {
                JFrame frame = new JFrame();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setSize(new Dimension(800, 600));
                frame.add(new JButton(new AbstractAction()
                {
                        {
                                putValue(Action.NAME, "Deadlock");
                        }
                       
                        @Override
                        public void actionPerformed(ActionEvent e)
                        {
                                SimpleUniverse.getPreferredConfiguration().getDevice();
                        }
                }));
                frame.setVisible(true);
        }
}

This still produces a deadlock for me.
Is there a workaround for this problem or is there someting wrong with my code?

Thanks in advance for your support.

Sebastian