import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;


import vtk.vtkActor;
import vtk.vtkConeSource;
import vtk.vtkNativeLibrary;
import vtk.vtkPanel;
import vtk.vtkPolyDataMapper;

//Author: Bharatesh Chakravarthi
//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. 


public class Cone extends JPanel implements ActionListener {
  private static final long serialVersionUID = 1L;
  private vtkPanel renWin;
  private JButton exitButton;

  // -----------------------------------------------------------------
  // Load VTK library and print which library was not properly loaded
  static {
    if (!vtkNativeLibrary.LoadAllNativeLibraries()) {
      for (vtkNativeLibrary lib : vtkNativeLibrary.values()) {
        if (!lib.IsLoaded()) {
          System.out.println(lib.GetLibraryName() + " not loaded");
        }
      }
    }
    vtkNativeLibrary.DisableOutputWindow(null);
  }
  // -----------------------------------------------------------------
	  
	  
  public Cone() {
    super(new BorderLayout());

	    
    //create a Cone
    vtkConeSource ConeSource = new vtkConeSource();
    //Uncomment below line to set the Resolution of Cone
    // ConeSource.SetResolution(100);
    ConeSource.Update();
	  
	  
	 
    //Create a Mapper and Actor
    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();
    Mapper.SetInputConnection(ConeSource.GetOutputPort());

    vtkActor Actor = new vtkActor();
    Actor.SetMapper(Mapper);
	  
	   
    renWin = new vtkPanel();
    renWin.GetRenderer().AddActor(Actor);
    renWin.resetCamera();

    // Add Java UI components
    exitButton = new JButton("Exit");
    exitButton.addActionListener(this);

    add(renWin, BorderLayout.CENTER);
    add(exitButton, BorderLayout.SOUTH);
  }

  /** An ActionListener that listens to the button. */
  public void actionPerformed(ActionEvent e) {
    if (e.getSource().equals(exitButton)) {
      System.exit(0);
    }
  }

  public static void main(String s[]) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          JFrame frame = new JFrame("Cone");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(new BorderLayout());
          frame.getContentPane().add(new Cone(), BorderLayout.CENTER);
          frame.setSize(400, 400);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
        }
      });
  }
} 

@@ -1,227 +1,4 @@
-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%0A%0A
 impo
@@ -40,16 +40,43 @@
 Source;%0A
+import vtk.vtkNamedColors;%0A
 import v
@@ -100,29 +100,8 @@
 ry;%0A
-import vtk.vtkPanel;%0A
 impo
@@ -130,285 +130,125 @@
 er;%0A
-%0A//Author: Bharatesh Chakravarthi%0A//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. %0A%0A%0Apublic class Cone extends JPanel implements ActionList
+import vtk.vtkRenderWindow;%0Aimport vtk.vtkR
 en
+d
 er
- %7B%0A  private static final long serialVersionUID = 1L;%0A  private vtkPanel renWin;%0A  private JButton exitButton;
+WindowInteractor;%0Aimport vtk.vtkRenderer;%0A%0Apublic class Cone %0A%7B
 %0A%0A  //
- 
 ----
@@ -388,16 +388,19 @@
  static 
+%0A  
 %7B%0A    if
@@ -440,24 +440,28 @@
 Libraries())
+%0A   
  %7B%0A      for
@@ -508,24 +508,31 @@
 y.values()) 
+%0A      
 %7B%0A        if
@@ -550,16 +550,25 @@
 aded()) 
+%0A        
 %7B%0A      
@@ -776,21 +776,18 @@
 -------%0A
-%09
   
-%0A%09
   %0A  pub
@@ -794,54 +794,321 @@
 lic 
-Cone()
+static void main(String s%5B%5D) %0A 
  %7B%0A
+%0A
     
-super(new BorderLayout());%0A%0A%09    
+vtkNamedColors colors = new vtkNamedColors();%0A%0A%0A    //For Actor Color%0A    double actorColor%5B%5D = new double%5B4%5D;%0A    //Renderer Background Color%0A    double Bgcolor%5B%5D = new double%5B4%5D;%0A%0A%0A    colors.GetColor(%22MediumVioletRed%22, actorColor);%0A    colors.GetColor(%22Wheat%22, Bgcolor);%0A
 %0A   
@@ -1300,18 +1300,8 @@
 ();%0A
-%09  %0A%09  %0A%09 
 %0A   
@@ -1515,877 +1515,449 @@
 r);%0A
-%09  %0A%09   %0A    renWin = new vtkPanel();%0A    renWin.GetRenderer().AddActor(A
+    Actor.GetProperty().SetColor(a
 ctor
-);%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(%22Cone%22);%0A          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE
+Color);%0A%0A    //Create the renderer, render window and interactor.%0A    vtkRenderer ren = new vtkRenderer();%0A    vtkRenderWindow renWin = new vtkRenderWindow();%0A    renWin.AddRenderer(ren);%0A    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();%0A    iren.SetRenderWindow(renWin
 );%0A
+%0A
     
-      frame.getContentPane().setLayout(new BorderLayout()
+// Visualise the arrow%0A    ren.AddActor(Actor
 );%0A    
-      frame.getContentPane().add(new Cone(), BorderLayout.CENTER
+ren.SetBackground(Bgcolor
 );%0A
+%0A
     
-      frame.s
+renWin.S
 etSize(
-4
+3
 00, 
-4
+3
 00);
@@ -1965,100 +1965,64 @@
     
-      frame.setLocationRelativeTo(null
+renWin.Render(
 );%0A
+%0A
     
-      frame.setVisible(true);%0A        %7D%0A      %7D
+iren.Initialize();%0A    iren.Start(
 );%0A 

Update Cone.java