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

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


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

    //Create a Arrow 
    vtkArrowSource ArrowSource = new vtkArrowSource();
    ArrowSource.Update();
    //Uncomment below lines to set properties
    //ArrowSource.SetShaftRadius(1.0);
    //ArrowSource.SetTipLength(1.0);
	 
    //Create a Mapper and Actor
    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();
    Mapper.SetInputConnection(ArrowSource.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("Arrow");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(new BorderLayout());
          frame.getContentPane().add(new Arrow(), 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
@@ -41,16 +41,43 @@
 Source;%0A
+import vtk.vtkNamedColors;%0A
 import v
@@ -101,29 +101,8 @@
 ry;%0A
-import vtk.vtkPanel;%0A
 impo
@@ -131,280 +131,121 @@
 er;%0A
-%0A//Author: Bharatesh Chakravarthi%0A//Affiliation: VE Lab, Chung Ang University, Seoul, South Korea. %0A%0A%0Apublic class Arrow 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;%0A
+WindowInteractor;%0Aimport vtk.vtkRenderer;%0A%0Apublic class Arrow  %0A%7B
 %0A  /
@@ -391,16 +391,19 @@
  static 
+%0A  
 %7B%0A    if
@@ -444,24 +444,29 @@
 ibraries()) 
+%0A    
 %7B%0A      for 
@@ -512,24 +512,31 @@
 y.values()) 
+%0A      
 %7B%0A        if
@@ -554,16 +554,25 @@
 aded()) 
+%0A        
 %7B%0A      
@@ -784,15 +784,8 @@
 ---%0A
-%09  %0A%09  
 %0A  p
@@ -794,49 +794,328 @@
 lic 
-Arrow() %7B%0A    super(new BorderLayout());%0A
+static void main(String s%5B%5D) %0A  %7B%0A    vtkNamedColors colors = new vtkNamedColors();%0A%0A%09    %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(%22Tomato%22, actorColor);%0A    colors.GetColor(%22DarkSeaGreen%22, Bgcolor);%0A%09    
 %0A   
@@ -1336,18 +1336,16 @@
 h(1.0);%0A
-%09 
 %0A    //C
@@ -1556,880 +1556,461 @@
 r);%0A
-%09
    
-%0A%09   %0A    renWin = new vtkPanel();%0A    renWin.GetRenderer().AddActor(A
+ Actor.GetProperty().SetColor(a
 ctor
+Color
 );%0A
+%09%0A
     
-renWin.resetCamera();%0A%0A    // Add Java UI components%0A    exitButton = new JButton(%22Exit%22);%0A    exitButton.addActionList
+ // Create the renderer, render window and interactor.%0A     vtkRenderer ren = new vtkRenderer();%0A     vtkRenderWindow renWin = new vtkR
 en
+d
 er
-(this
+Window(
 );%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(%22Arrow%22);%0A          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0A          frame.getContentPane().setLayout(new BorderLayout());%0A          frame.getContentPane().add(new Arrow(), BorderLayout.CENTER);%0A          frame.s
+.AddRenderer(ren);%0A     vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();%0A     iren.SetRenderWindow(renWin);%0A%0A     // Visualise the arrow%0A     ren.AddActor(Actor);%0A     ren.SetBackground(Bgcolor);%0A%0A     renWin.S
 etSize(
-4
+3
 00, 
-4
+3
 00);
@@ -2019,99 +2019,66 @@
     
-     frame.setLocationRelativeTo(null
+renWin.Render(
 );%0A
+%0A
      
-     frame.setVisible(true);%0A        %7D%0A      %7D
+iren.Initialize();%0A     iren.Start(
 );%0A 

Update Arrow.java