[vtkusers] Problems With Java Applets and IExplorer
brylee at fumbo.com
brylee at fumbo.com
Tue Sep 7 13:15:27 EDT 2004
Hi everybdoy, I wonder if I can have a hand on this, I have this Java applet but
every time y try to load it in to a browser does not work! Any ideas or examples
thanks.
Bryan Lee
Ps here is my code of a simple example. Or any Ideas how to put VTK in to a browser.
--- Html code Ini-----
html>
<head>
<title> Welcome 23/title>
</head>
<body>
My first Applet
<br>
<applet code="Vtkjava.class" width="400" height="150"></applet>
<applet code =Vtkjava.class width=400 height=300 archive ="vtk.jar"></applet>
<br>
The applet is only visible if the Plug-in is installed.
<br>
<a href="http://java.sun.com/getjava/">Get Java Plug-in.</a>
</body>
<html>
--- Html code End-----
---Java Applet Code---
import vtk.*;
import java.lang.Object;
import java.awt.*;
import java.applet.*;
import javax.swing.*;
public class Vtkjava extends Applet {
vtkConeSource cone= null;
vtkPolyDataMapper coneMapper = null;
vtkActor coneActor = null;
vtkRenderer ren1 = null;
vtkRenderWindow renWin = null;
vtkRenderWindowInteractor iren = null;
vtkInteractorStyleTrackballCamera style = null;
//vtkPanel panel = null;
public void init(){
GridBagLayout grid = new GridBagLayout();
this.setLayout(grid);
//panel = new vtkPanel();
vtkConeSource cone = new vtkConeSource();
cone.SetHeight( 3.0 );
cone.SetRadius( 1.0 );
cone.SetResolution( 10 );
vtkPolyDataMapper coneMapper = new vtkPolyDataMapper();
coneMapper.SetInput(cone.GetOutput());
vtkActor coneActor = new vtkActor();
coneActor.SetMapper(coneMapper);
vtkRenderer ren1 = new vtkRenderer();
ren1.AddActor(coneActor);
ren1.SetBackground(0.1, 0.2, 0.4);
vtkRenderWindow renWin = new vtkRenderWindow();
renWin.AddRenderer( ren1 );
renWin.SetSize(300, 300);
ren1.GetActiveCamera().Azimuth(90);
vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();
iren.SetRenderWindow(renWin);
vtkInteractorStyleTrackballCamera style =
new vtkInteractorStyleTrackballCamera();
iren.SetInteractorStyle(style);
iren.Initialize();
iren.Start();
}
}
More information about the vtkusers
mailing list