Cloned library of VTK-5.0.0 with extra build files for internal package management.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

2 years ago
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import vtk.*;
public class TestVTKCanvas extends JPanel {
public TestVTKCanvas() {
setLayout(new BorderLayout());
// Create the buttons.
vtkCanvas renWin = new vtkCanvas();
add(renWin, BorderLayout.CENTER);
vtkConeSource cone = new vtkConeSource();
cone.SetResolution(8);
vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();
coneMapper.SetInput(cone.GetOutput());
vtkActor coneActor = new vtkActor();
coneActor.SetMapper(coneMapper);
renWin.GetRenderer().AddActor(coneActor);
AxesActor aa = new AxesActor(renWin.GetRenderer());
renWin.GetRenderer().AddActor(aa);
}
public static void main(String s[])
{
TestVTKCanvas panel = new TestVTKCanvas();
TestVTKCanvas panel2 = new TestVTKCanvas();
JFrame frame = new JFrame("VTK Canvas Test");
frame.getContentPane().setLayout(new GridLayout(2,1));
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e) {System.exit(0);}
});
frame.getContentPane().add(panel);
frame.getContentPane().add(panel2);
frame.pack();
frame.setBounds(100, 100, 500, 500);
frame.setVisible(true);
}
}