[vtkusers] problem with vtkPanel
Jan-Gerrit Drexhage
jdrexhage at wiwi.uni-bielefeld.de
Tue Jan 7 09:21:49 EST 2003
Hi all together,
I have a little problem with Java.
I just wanted to try to use the vtkPanel and see if it works. For that i
wrote a little program with this code:
Dummy.java
import vtk.*;
public class Dummy {
public static void main(String[] args) {
VTKmyFrame testFrame = new VTKmyFrame();
}
}
VTKmyFrame.java:
import vtk.*;
import java.awt.*;
import javax.swing.*;
import java.io.InputStream;
public class VTKmyFrame extends JFrame{
// in the static contructor we load in the native code
// The libraries must be in your path to work
static {
System.loadLibrary("vtkCommonJava");
System.loadLibrary("vtkFilteringJava");
System.loadLibrary("vtkIOJava");
System.loadLibrary("vtkImagingJava");
System.loadLibrary("vtkGraphicsJava");
System.loadLibrary("vtkRenderingJava");
System.loadLibrary("vtkHybridJava");
}
static int res = 20;
static double rad = 0.2;
vtkPanel vtkpane = new vtkPanel();;
Container content = new Container();
public VTKmyFrame() {
this.setSize(800,600);
vtkCylinderSource cylinder1 = new vtkCylinderSource();
cylinder1.SetResolution(res);
cylinder1.SetRadius(0.01);
cylinder1.SetHeight(2);
vtkPolyDataMapper cylinder1Mapper = new vtkPolyDataMapper();
cylinder1Mapper.SetInput(cylinder1.GetOutput());
vtkActor cylinder1Actor = new vtkActor();
cylinder1Actor.SetMapper(cylinder1Mapper);
cylinder1Actor.SetPosition(0.0, 0.0, 0.0);
cylinder1Actor.SetOrientation(90.0, 0.0, 0.0);
vtkpane.GetRenderer().AddActor(cylinder1Actor);
content.add(vtkpane);
this.setTitle("myvtkFrame");
this.setVisible(true);
}
}
If i start this i get a 800x600 Window with grey background and nothing
happen. I used the vtkPanel as it was written in SimpleVTK.java
(/vtkdir/Wrapping/Java).
If you found the error(s) then please reply, thanks in Advance and a
Happy New Year to you all :-)
Greets
Jan-Gerrit Drexhage
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030107/ace59681/attachment.htm>
More information about the vtkusers
mailing list