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


public class TextActor 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 TextActor() {
    super(new BorderLayout());
	   
	   
    vtkNamedColors Color = new vtkNamedColors(); 
    //For Actor Color
    double ActorColor[] = new double[4];
    //For Renderer Background Color
    double BgColor[] = new double[4];
	   
	   
    //Change Color Name to Use your own Color for Change Actor Color
    Color.GetColor("Red",ActorColor);
    //Change Color Name to Use your own Color for Renderer Background
    Color.GetColor("Black",BgColor);

   
    vtkTextActor Text = new vtkTextActor();
    Text.SetInput("Hello World");
    Text.SetDisplayPosition(20, 30);
    Text.GetTextProperty().SetFontSize(40);
    Text.GetTextProperty().SetFontFamilyToArial();
    Text.GetTextProperty().BoldOn();
    Text.GetTextProperty().ShadowOn();
    Text.GetTextProperty().GetShadowOffset();
    Text.GetTextProperty().SetColor(ActorColor);
	  
  
    renWin = new vtkPanel();
    renWin.GetRenderer().AddActor(Text);
    renWin.resetCamera();
    renWin.GetRenderer().SetBackground(BgColor);
	  
    // 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("Text Actor");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().setLayout(new BorderLayout());
          frame.getContentPane().add(new TextActor(), BorderLayout.CENTER);
          frame.setSize(400, 400);
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
        }
      });
  }
} 

@@ -4,251 +4,94 @@
 ort 
-java.awt.BorderLayout;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionList
+vtk.vtkNativeLibrary;%0Aimport vtk.vtkR
 en
+d
 er
-;%0A%0Aimport javax.swing.JButton;%0Aimport javax.swing.JFrame;%0Aimport javax.swing.JPanel;%0Aimport javax.swing.SwingUtilities;%0A%0A%0Aimport vtk.vtkNativeLibrary
+Window;%0Aimport vtk.vtkRenderWindowInteractor
 ;%0Aim
@@ -102,21 +102,24 @@
  vtk.vtk
-Panel
+Renderer
 ;%0Aimport
@@ -165,17 +165,16 @@
 olors;%0A%0A
-%0A
 public c
@@ -192,165 +192,16 @@
 tor 
-extends JPanel implements ActionListener %7B%0A  private static final long serialVersionUID = 1L;%0A  private vtkPanel renWin;%0A  private JButton exitButton;%0A
+ %0A%7B
 %0A  //
- 
 ----
@@ -341,16 +341,19 @@
  static 
+%0A  
 %7B%0A    if
@@ -394,24 +394,29 @@
 ibraries()) 
+%0A    
 %7B%0A      for 
@@ -462,24 +462,31 @@
 y.values()) 
+%0A      
 %7B%0A        if
@@ -504,16 +504,25 @@
 aded()) 
+%0A        
 %7B%0A      
@@ -663,17 +663,16 @@
   %7D%0A  //
- 
 --------
@@ -733,19 +733,16 @@
 ---%0A%09  %0A
-%09  
 %0A  publi
@@ -747,62 +747,41 @@
 lic 
-TextActor() %7B%0A    super(new BorderLayout());%0A%09  
+static void main(String s%5B%5D)
  %0A
-%09
   
- 
+%7B
 %0A   
@@ -939,17 +939,17 @@
 ouble Bg
-C
+c
 olor%5B%5D =
@@ -968,17 +968,9 @@
 4%5D;%0A
-%09   %0A%09   
+%0A
 %0A   
@@ -1176,17 +1176,17 @@
 %22,Bg
-C
+c
 olor);%0A%0A
    %0A
@@ -1185,12 +1185,8 @@
 );%0A%0A
-   %0A
     
@@ -1566,937 +1566,403 @@
 r);%0A
-%09  
 %0A  
-%0A
   
-  renWin = new vtkPanel();%0A    renWin.GetRenderer().AddActor(Text);%0A    renWin.resetCamera();%0A    renWin.GetRenderer().SetBackground(BgColor
+// Create the renderer, render window and interactor.%0A    vtkRenderer ren = new vtkRenderer(
 );%0A
-%09
   
-%0A
   
-  // Add Java UI components%0A    exitButton = new JButton(%22Exit%22);%0A    exitButton.addActionListener(this
+vtkRenderWindow renWin = new vtkRenderWindow(
 );%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(%22Text
+.AddRenderer(ren);%0A    vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();%0A    iren.SetRenderWindow(renWin);%0A%0A    // Visualize the
  Actor
-%22);
 %0A    
-      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0A          frame.getContentPane().setLayout(new BorderLayout());%0A          frame.getContentPane().add(new TextActor(), BorderLayout.CENTER);%0A          frame.s
+ren.AddActor(Text);%0A    ren.SetBackground(Bgcolor);%0A%0A    renWin.S
 etSize(
-4
+3
 00, 
-4
+3
 00);
@@ -1970,100 +1970,64 @@
     
- 
-     frame.setLocationRelativeTo(null
+renWin.Render(
 );%0A
+%0A
     
-      frame.setVisible(true);%0A        %7D%0A      %7D
+iren.Initialize();%0A    iren.Start(
 );%0A 

Update TextActor.java