@@ -0,0 +1,2855 @@
+import java.awt.BorderLayout;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A%0Aimport javax.swing.JButton;%0Aimport javax.swing.JFrame;%0Aimport javax.swing.JPanel;%0Aimport javax.swing.SwingUtilities;%0A%0Aimport vtk.vtkActor;%0Aimport vtk.vtkSphereSource;%0Aimport vtk.vtkNativeLibrary;%0Aimport vtk.vtkPanel;%0Aimport vtk.vtkPolyDataMapper;%0A%0A%0A/**%0A Java Program to Display a  Wireframe Sphere using VTK. %0A Author: Bharatesh Chakravarthi, Chung Ang University,%0A Seoul, South Korea. %0A */%0A %0A %0Apublic class Sphere extends JPanel implements ActionListener %7B%0A  private static final long serialVersionUID = 1L;%0A  private vtkPanel renWin;%0A  private JButton exitButton;%0A%0A  // -----------------------------------------------------------------%0A  // Load VTK library and print which library was not properly loaded%0A  static %7B%0A    if (!vtkNativeLibrary.LoadAllNativeLibraries()) %7B%0A      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) %7B%0A        if (!lib.IsLoaded()) %7B%0A          System.out.println(lib.GetLibraryName() + %22 not loaded%22);%0A        %7D%0A      %7D%0A    %7D%0A    vtkNativeLibrary.DisableOutputWindow(null);%0A  %7D%0A  // -----------------------------------------------------------------%0A  %0A  %0A  public Sphere() %7B%0A    super(new BorderLayout());%0A%0A  //Create a Sphere%0A  vtkSphereSource Sphere = new vtkSphereSource();%0A  Sphere.SetCenter(0.0,0.0,0.0);%0A  Sphere.SetRadius(1.0);%0A  Sphere.Update();%0A  %0A  //Change Phi and Theta Value for Smooth Surface%0A  Sphere.SetPhiResolution(10);%0A  Sphere.SetThetaResolution(10);%0A  %0A  //Create a Mapper and Actor%0A  vtkPolyDataMapper Mapper = new vtkPolyDataMapper();%0A  Mapper.SetInputConnection(Sphere.GetOutputPort());%0A%0A  vtkActor Actor = new vtkActor();%0A  Actor.SetMapper(Mapper);%0A  Actor.GetProperty().SetColor(1.0, 1.0, 1.0);%0A  //Setting up the wireframe property to Sphere. Comment the below line to display Solid Sphere%0A  Actor.GetProperty().SetRepresentationToWireframe();%0A %0A  %0A   %0A  renWin = new vtkPanel();%0A  renWin.GetRenderer().AddActor(Actor);%0A  renWin.resetCamera();%0A%0A  // Add Java UI components%0A  exitButton = new JButton(%22Exit%22);%0A  exitButton.addActionListener(this);%0A%0A  add(renWin, BorderLayout.CENTER);%0A  add(exitButton, BorderLayout.SOUTH);%0A  %7D%0A%0A  /** An ActionListener that listens to the button. */%0A  public void actionPerformed(ActionEvent e) %7B%0A    if (e.getSource().equals(exitButton)) %7B%0A      System.exit(0);%0A    %7D%0A  %7D%0A%0A  public static void main(String s%5B%5D) %7B%0A    SwingUtilities.invokeLater(new Runnable() %7B%0A      public void run() %7B%0A        JFrame frame = new JFrame(%22Sphere%22);%0A        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0A        frame.getContentPane().setLayout(new BorderLayout());%0A        frame.getContentPane().add(new Sphere(), BorderLayout.CENTER);%0A        frame.setSize(400, 400);%0A        frame.setLocationRelativeTo(null);%0A        frame.setVisible(true);%0A      %7D%0A    %7D);%0A  %7D%0A%7D%0A

Create Sphere.java