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

//Author: Bharatesh Chakravarthi, Adithya B. 
//Affiliation: VELab, Chung Ang University, Seoul, South Korea. 
 
public class EarthSource 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 EarthSource() 
  {
    super(new BorderLayout());
		    
    double MyColors[] = new double[4];
    vtkNamedColors Colors = new vtkNamedColors();
    Colors.GetColor("Banana",MyColors);
		    
    vtkEarthSource EarthSource = new vtkEarthSource();
    EarthSource.OutlineOff();
    //EarthSource.OutlineOn();
    EarthSource.Update();
		    
		    
    //Create a Mapper and Actor
    vtkPolyDataMapper Mapper = new vtkPolyDataMapper();
    Mapper.SetInputConnection(EarthSource.GetOutputPort());
		
    vtkActor Actor = new vtkActor();
    Actor.SetMapper(Mapper);
    Actor.GetProperty().SetColor(MyColors);
    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("EarthSource");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(new BorderLayout());
          frame.getContentPane().add(new EarthSource(), BorderLayout.CENTER);
          frame.setSize(400, 400);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
        }
      });
  }
}

@@ -1,226 +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
 impo
@@ -74,29 +74,8 @@
 ry;%0A
-import vtk.vtkPanel;%0A
 impo
@@ -118,318 +118,147 @@
 .vtk
-NamedColors;%0A%0A//Author: Bharatesh Chakravarthi, Adithya B. %0A//Affiliation: VELab, Chung Ang University, Seoul, South Korea. %0A %0Apublic class EarthSource extends JPanel implements ActionListener %0A%7B%0A  private static final long serialVersionUID = 1L;%0A  private vtkPanel renWin;%0A  private JButton exitButton;%0A
+RenderWindow;%0Aimport vtk.vtkRenderWindowInteractor;%0Aimport vtk.vtkRenderer;%0Aimport vtk.vtkNamedColors;%0A%0A %0Apublic class EarthSource%0A%7B%09 
 %0A  //
- 
 ----
@@ -790,18 +790,16 @@
 ----%0A  %0A
-  
 %0A  publi
@@ -804,64 +804,41 @@
 lic 
-EarthSource() %0A  %7B%0A    super(new BorderLayout());%0A%09%09  
+static void main(String s%5B%5D) %0A
   
+%7B
 %0A   
@@ -963,22 +963,126 @@
 olors);%0A
-%09%09    
+%0A    //Renderer Background Color%0A    double Bgcolor%5B%5D = new double%5B4%5D;%0A    Colors.GetColor(%22Black%22, Bgcolor);%0A
 %0A    vtk
@@ -1220,21 +1220,8 @@
 ();%0A
-%09%09    %0A%09%09    
 %0A   
@@ -1365,18 +1365,16 @@
 ort());%0A
-%09%09
 %0A    vtk
@@ -1480,923 +1480,403 @@
 s);%0A
+%0A
     
-renWin = new vtkPanel();%0A    renWin.GetRenderer().AddActor(A
+//Create the renderer, render window and intera
 ctor
-);
+.
 %0A    
-renWin.resetCam
+vtkRenderer ren = new vtkRender
 er
-a
 ();%0A
-%09%09%0A
     
-// Add Java UI components%0A    exitButton = new JButton(%22Exit%22);%0A    exitButton.addActionListener(this);%0A%09%09%0A    add(renWin, BorderLayout.CENTER);%0A    add(exitButton, BorderLayout.SOUTH);%0A  %7D%0A%09%09    %0A  /** An ActionListener that listens to the button. */%0A  public void actionPerformed(ActionEvent e)%0A  %7B%0A    if (e.getSource().equals(exitButton))%0A    %7B%0A      System.exit(0);%0A    %7D%0A  %7D%0A%09%09    %0A  public static void main(String s%5B%5D) %0A  %7B%0A    SwingUtilities.invokeLater(new Runnable() %0A      %7B%0A        public void run() %0A        %7B%0A          JFrame frame = new JFrame(%22EarthSource%22);%0A          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE
+vtkRenderWindow renWin = new vtkRenderWindow();%0A    renWin.AddRenderer(ren);%0A    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();%0A    iren.SetRenderWindow(renWin);%0A%0A    // Visualise the arrow%0A    ren.AddActor(Actor
 );%0A    
-      frame.getContentPane().setLayout(new BorderLayout());%0A          frame.getContentPane().add(new EarthSource(), BorderLayout.CENTER);%0A          frame.s
+ren.SetBackground(Bgcolor);%0A%0A    renWin.S
 etSize(
-4
+3
 00, 
-4
+3
 00);
@@ -1884,103 +1884,68 @@
     
-      frame.setLocationRelativeTo(null
+renWin.Render(
 );%0A
+%0A
     
-      frame.setVisible(true);%0A        %7D%0A      %7D
+iren.Initialize();%0A    iren.Start(
 );%0A
+%0A
   %7D%0A

Update EarthSource.java