[vtkusers] java repaint?

ekaditya eka.aditya at gmail.com
Tue Jul 26 04:18:21 EDT 2005


hi all,

i'm newbie in VTK. now i'm using java.1.5 and vtk4.2 for my application.
i have problem when rendering the STL file.
first, i using GUI to select the STL file,
private void openActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser chooser = new JFileChooser();
chooser.showOpenDialog(this);

File file = chooser.getSelectedFile();
if(file != null)
{
String fileName = file.getPath();

mainPanel.open(fileName);
//System.out.println(fileName);
}
}

and then mainPanel, which is using vtkPanel to render the STL,
public void open(String fileName)
{
//this.setLayout(new BorderLayout());
vtkSTLReader reader = new vtkSTLReader();
reader.SetFileName(fileName);
//System.out.println("dalam fungsi" + fileName);

vtkPolyDataMapper mapper = new vtkPolyDataMapper();
mapper.SetInput(reader.GetOutput());

vtkActor actor = new vtkActor();
actor.SetMapper(mapper);

//renWin.GetRenderer().AddActor(actor);
renWin.GetRenderer().AddActor(actor);

renWin.validate();
renWin.repaint();
}

when i try to open the STL file, it's fine.
but the problem comes when i try to open other STL file.
the first STL image don't changed with the second STL image, but they 
together in one window.
how to make the second STL image replacing the first STL image?

thank's for your responese..

-- 
--Y!M: ekaditya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050726/bc8148e8/attachment.htm>


More information about the vtkusers mailing list