I tried to use
http://www3.math.tu-berlin.de/jreality/ ... one_viewer
and the information from
http://www3.math.tu-berlin.de/jreality/ ... p?f=3&t=53
the jar containing EmbeddedSwingComposite is still available at the bottom of this page:
http://www.eclipse.org/articles/article ... index.html
Unfortunately my attempts aren't successful.
Here's the full TestSWT.java:
Code: Select all
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JPanel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import swingintegration.example.EmbeddedSwingComposite;
import de.jreality.geometry.Primitives;
import de.jreality.plugin.JRViewer;
import de.jreality.plugin.basic.View;
import de.jreality.scene.SceneGraphComponent;
import de.jreality.scene.Viewer;
public class TestSWT {
protected Shell shell;
private EmbeddedSwingComposite mainViewer;
/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
TestSWT window = new TestSWT();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window.
*/
public void open() {
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Create contents of the window.
*/
protected void createContents() {
shell = new Shell();
shell.setSize(450, 300);
shell.setText("SWT and jReality");
SceneGraphComponent world = new SceneGraphComponent();
world.setGeometry(Primitives.sharedIcosahedron);
View.setTitle("The Icosahedron");
JRViewer jrv = JRViewer.createJRViewer(world);
jrv.startupLocal();
final Viewer viewer = jrv.getViewer();
Composite content = new Composite(shell, SWT.None);
mainViewer = new EmbeddedSwingComposite(content, SWT.BORDER) {
@Override
protected JComponent createSwingComponent() {
JPanel panel = new JPanel();
panel.setLayout(new java.awt.GridLayout(1, 1));
panel.add((Component) viewer.getViewingComponent());
return panel;
}
};
mainViewer.populate();
}
}
Upon running I get some messages in the console, no clue if the unneccesarily unlocked locks are of any importance.
Code: Select all
2014-01-10 22:09:45.251 java[3363:507] [Java CocoaComponent compatibility mode]: Enabled
2014-01-10 22:09:45.252 java[3363:507] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
JOGL3Viewer constuctor called
Profile GL4 is not available on MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], but: [GLProfile[GL2ES2/GL3.hw], GLProfile[GL2ES1/GL2.hw], GLProfile[GL2/GL2.hw], GLProfile[GL3/GL3.hw], GLProfile[GL2/GL2.hw], GLProfile[GL2GL3/GL3.hw]]
Profile GL4bc is not available on MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], but: [GLProfile[GL2ES2/GL3.hw], GLProfile[GL2ES1/GL2.hw], GLProfile[GL2/GL2.hw], GLProfile[GL3/GL3.hw], GLProfile[GL2/GL2.hw], GLProfile[GL2GL3/GL3.hw]]
2014-01-10 22:09:48.129 java[3363:ef03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x7fd3ab07aa60> '(null)') unlocked when not locked
2014-01-10 22:09:48.129 java[3363:ef03] *** Break on _NSLockError() to debug.
2014-01-10 22:09:48.233 java[3363:ef03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x7fd3a8c79930> '(null)') unlocked when not locked
2014-01-10 22:09:48.233 java[3363:ef03] *** Break on _NSLockError() to debug.
2014-01-10 22:09:48.337 java[3363:ef03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x7fd3a8e4a510> '(null)') unlocked when not locked
2014-01-10 22:09:48.337 java[3363:ef03] *** Break on _NSLockError() to debug.
2014-01-10 22:09:48.447 java[3363:ef03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x7fd3ab1567c0> '(null)') unlocked when not locked
2014-01-10 22:09:48.447 java[3363:ef03] *** Break on _NSLockError() to debug.
2014-01-10 22:09:48.555 java[3363:ef03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x7fd3a8e1e4d0> '(null)') unlocked when not locked
2014-01-10 22:09:48.556 java[3363:ef03] *** Break on _NSLockError() to debug.
I'd be grateful if you could help me get this running!
Thanks!