I'm using java program to display up a svg file. I would like to include double buffer method since the file will be periodically updated and re-displayed. Can anyone show me hw i suppose to add in the coding of double buffer?
Here's my code:
__________________________________________________ ___________
import java.awt.*;
import javax.swing.*;
import org.apache.batik.swing.JSVGCanvas;
public class displaySVG extends JFrame {
Thread thrd;
protected JFrame f; //The frame.
protected JSVGCanvas svgCanvas = new JSVGCanvas();
public displaySVG(JFrame f) {
this.f = f;
}
public void displaySVG(){
// Create a new JFrame.
displaySVG app = new displaySVG(f);
// Add components to the frame.
f.getContentPane().add(app.createComponents());
f.setSize(550, 400);
f.setVisible(true);
//update function
//re-display
}
public JComponent createComponents() {
// Create a panel and add the button, status label and the SVG canvas.
final JPanel panel = new JPanel(new BorderLayout());
JPanel p = new JPanel();
svgCanvas.setURI("file:/C:/Documents and Settings/Ricky" +
"/My Documents/NetBeansProjects/Project_test1/" +
"floorplan1.svg");
panel.add(p);
panel.add(svgCanvas);
return panel;
}
}