samedi 7 mars 2015

How to make all of the region of a Jpanel draggable including a JSVGCanvas within it



Ive been following this guide http://ift.tt/1Er1gCt


to make my custom Jpanels draggable however for some reason only the region of the JPanel with no components is draggable. I have a JSVGCanvas(from the batik library) which has some painting within it which I then added to my custom JPanel.


In the past for hover events on the JPanel to make it highlightable i would do the following to pass mouse hover events from the canvas to the outside jpanel like this to solve this issue.



@Override public void mouseClicked(MouseEvent e){outside.dispatchEvent(e);}
@Override public void mousePressed(MouseEvent e){outside.dispatchEvent(e);}
@Override public void mouseReleased(MouseEvent e){outside.dispatchEvent(e);}


However Im not sure how im going to pass the drag events from the canvas to the jpanel holding the canvas.


Is thier any way i can bind the canvas to the JPanel so that when i click anywhere in the Jpanel it passes through the canvas to the JPanel?


Thanks


Ali




Aucun commentaire:

Enregistrer un commentaire