[vtkusers] Jar File doesn't show render window
Marc Meidinger
marc.meidinger at pps-ag.ch
Wed Oct 3 03:36:10 EDT 2007
Good Morning vtk users!
I'm a VTK beginner. I just have installed vtk and wrote my first application
in Java on Eclipse (on WinXP). I display the render window in a JPanel which
is added to a JFrame. When compiling everything works fine till I try to
create & run the JAR File ->
After I doubleclick the JAR File, nothing happens. (But when I remove the
Panel with the vtk render window the empty Frame appears, correctly.)
What am I doing wrong, why doesnt my JAR File show me the render window? I
would be glad about some quick help.
Thanks.
Sincerely, Marc Meidinger
Here is the main method which creates the JFrame and the JPanel class which
displays the vtk Modell (from Spectrogramm)
// the main function
public static void main (String[] args)
{
SpecPanel oPanel = new SpecPanel();
JFrame frame = new JFrame("3D Spectrogramm");
frame.getContentPane().setLayout(new GridLayout(1,1));
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e) {System.exit(0);}
});
}
package HelloVtkMain;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;
import vtk.*;
public class SpecPanel extends JPanel {
Spectrogramm spec = new Spectrogramm( 100, 100, 100 ); // creates a VTK
modell
public SpecPanel()
{
//Set Panel Layout
setLayout(new BorderLayout());
//Get the Canvas
vtkCanvas oCanvas = spec.getSpectrogrammCanvas();
//Set Camera on Canvas
oCanvas.GetRenderer().ResetCamera();
//Size the Canvas
oCanvas.setSize(1000, 1000);
//Add Canvas to Panel
this.add(oCanvas, BorderLayout.CENTER);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071003/e07c3564/attachment.htm>
More information about the vtkusers
mailing list