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.vtkRegularPolygonSource;
import vtk.vtkNativeLibrary;
import vtk.vtkPanel;
import vtk.vtkPolyDataMapper;


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


public class Circle 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 Circle() {
    super(new BorderLayout());

	

    vtkRegularPolygonSource PolygoneSource = new vtkRegularPolygonSource();
    PolygoneSource.SetNumberOfSides(100);
    PolygoneSource.SetRadius(5);
    PolygoneSource.SetCenter(0,0,0);
    //Uncomment below line to Visualize outline of circle
    PolygoneSource.GeneratePolygonOff();
    PolygoneSource.Update();
	  
	  
    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();
    Mapper.SetInputConnection(PolygoneSource.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("Circle");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(new BorderLayout());
          frame.getContentPane().add(new Circle(), BorderLayout.CENTER);
          frame.setSize(400, 400);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
        }
      });
  }
} 

@@ -4,238 +4,145 @@
 ort 
-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.vtkA
+vtk.vtkActor;%0Aimport vtk.vtkNamedColors;%0Aimport vtk.vtkRegularPolygonSource;%0Aimport vtk.vtkRenderWindow;%0Aimport vtk.vtkRenderWindowIntera
 ctor
@@ -159,34 +159,22 @@
 tk.vtkRe
-gularPolygonSource
+nderer
 ;%0Aimport
@@ -200,29 +200,8 @@
 ry;%0A
-import vtk.vtkPanel;%0A
 impo
@@ -231,280 +231,30 @@
 r;%0A%0A
-%0A//Author: Bharatesh Chakravarthi%0A//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. %0A%0A%0Apublic class Circle extends JPanel implements ActionListener %7B%0A  private static final long serialVersionUID = 1L;%0A  private vtkPanel renWin;%0A  private JButton exitButton;
+public class Circle %0A%7B
 %0A%0A  
@@ -401,16 +401,19 @@
  static 
+%0A  
 %7B%0A    if
@@ -454,24 +454,29 @@
 ibraries()) 
+%0A    
 %7B%0A      for 
@@ -522,24 +522,31 @@
 y.values()) 
+%0A      
 %7B%0A        if
@@ -564,16 +564,25 @@
 aded()) 
+%0A        
 %7B%0A      
@@ -790,23 +790,16 @@
 -------%0A
-%09  %0A%09  
 %0A  publi
@@ -804,52 +804,317 @@
 lic 
-Circle() %7B%0A    super(new BorderLayout());%0A%0A%09
+static void main(String s%5B%5D) %0A  %7B%0A%0A    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(%22White%22, actorColor);%0A    colors.GetColor(%22DarkSeaGreen%22, Bgcolor);
 %0A%0A  
@@ -1431,15 +1431,9 @@
 ();%0A
-%09  %0A%09  
+%0A
 %0A   
@@ -1619,878 +1619,451 @@
 r);%0A
-%09  %0A    renWin = new vtkPanel();%0A    renWin.GetRenderer().AddActor(A
+    Actor.GetProperty().SetColor(a
 ctor
-);%0A    renWin.resetCamera(
+Color
 );%0A%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%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(%22Circle%22);%0A          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE
+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 Circle(), BorderLayout.CENTER);%0A 
+ren.SetBackground(Bgcolor);%0A%0A
     
-     frame.s
+renWin.S
 etSize(
-4
+3
 00, 
-4
+3
 00);
@@ -2071,106 +2071,70 @@
     
-      frame.setLocationRelativeTo(null
+renWin.Render(
 );%0A
+%0A
     
-      frame.setVisible(true);%0A        %7D%0A      %7D
+iren.Initialize();%0A    iren.Start(
 );%0A
+%0A
   %7D%0A%7D
- 
 %0A

Update Circle.java