now i would like to add a link to another html or svg document to the rectangle. if the user clicks on the rectangle, the other document should appear.
You can easily achive the desired effect by adding an EventListener to your rectangle. Simply add something like
... //your code
Node rectangle=myClass.getRectangle(); //The rectangle you want to be clickable
EventTarget target = (EventTarget)rectangle;
target.addEventListener("click",new myEventListener(),false); ...//more of your code
to your main class and create a new class along these lines:
public class myEventListener implements EventListener {
private JSVGCanvas canvas;
/**Creates a new EventListener and sets the canvas property*/ myEventListener(JSVGCanvas canvas) {
this.canvas=canvas;
}
/**Callsed when an Event is triggered*/
public void handleEvent(Event evt) {
String svg=myClass.getSVGDocumentString(); //A string describing the URI of your SVG
canvas.loadSVGDocument(svg); }
}
For HTML-Documents, you need to hand the Listener a component to display them, but the main idea is the same.
Hope that helps, -Urs
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]