You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by ra...@blueyonder.co.uk on 2006/04/08 22:23:36 UTC
Dragable rectangle
Hi there,
I'm trying to create a dragable rectangle on my JSVGCanvas so that the
area that is selected within the rectangle is zoomed-in, has anyone got
any ideas how I should go about doing this ...my thoughts are that I
create a mouseListener, to listen for mouseDown, whilst the mouse is kept
down to drag the rectangle until the mouseRelease event and upon
mouseRelease the svgMap then zoomIn to the selected area... in effect I'm
trying to replicate the key-board short cut 'CTRL_MouseDown' ...and assign
it to a Jbutton.
Pls advice :(
Thanx
yasmin
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by Javid Alimohideen <ja...@gmail.com>.
Yasmin,
I am not sure if this is the right way but you could try.
Have a boolean variable isButtonClicked. Change the status of the the
variable when you click the button
Check for the status of the boolean in the startInteraction method:
return ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked == true
Hope it helps,
Javid
-----Original Message-----
From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
Sent: Sunday, April 09, 2006 11:51 AM
To: batik-users@xmlgraphics.apache.org
Subject: RE: Dragable rectangle
Hi Javid,
I followed ur instructions below ...but (mods & InputEvent.select) != 0;
doesn't recognise by button (select), so I kept the original code:
(mods & InputEvent.BUTTON1_MASK) != 0; but I'm still left with the
problem of how to tell the MyCanvas that it is the button 'select' that is
used for InputEvent ....ummm any thoughts?
Thanx
yasmin
> Yasmin,
> Your canvas has to extend the JSVGCanvas and you add the code that you had
> posted. Also, Change the variable name from zoomInteractor2 to
> zoomInteractor.
>
> All, you have to do is just overload the variable in your canvas class.
> I haven't tried this before, so kindly excuse me if it doesn't work.
>
> Class MyCanvas extends JSVGCanvas {
>
> // All your stuff goes here
>
> public MyCanvas() {
> super();
> }
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.select) != 0; //select is my button
>
> }
> };
> }
>
> Thanks,
> Javid
>
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Sunday, April 09, 2006 6:36 AM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Dragable rectangle
>
>
> Hi meAgain!
>
> ...is the following code correct:
>
> protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.select) != 0; //select is my button
>
> }
> };
>
>
> But now I'm not sure where I would need to put this code, do I need to
> directly add the code in JSVGCanvas, I rly dnt have a clue what to do,
> please advice?
>
> Many thanx
>
> yasmin
>
>
>
>
>> Hi Yasmin,
>>
>> You just need to create a new subclass of
>> AbstractZoomInteractor.startInteraction, the one in
>> the Canvas has:
>>
>> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
>> public boolean startInteraction(InputEvent ie) {
>> int mods = ie.getModifiers();
>> return
>> ie.getID() == MouseEvent.MOUSE_PRESSED &&
>> (mods & InputEvent.BUTTON1_MASK) != 0 &&
>> (mods & InputEvent.CTRL_MASK) != 0;
>> }
>> };
>>
>> You will want to check that it's mouse down and that the user
>> has
>> clicked your button, instead of just checking if it is a button1 with
>> ctrl
>> down.
>>
>> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>>
>>>
>>> Hi Javid,
>>>
>>> Yes, the JSVGCanvas already does what I want to do, you know when u
>> wantto
>>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
>> &
>>> MouseDown' ...well, I want to achieve the same by assigning this to a
>>> button, so the user can just click the button and then drag a rectangle
>> to
>>> select the area ...so, that my UI is user friendly, assuming that the
>> user
>>> does not know about the 'Key' shortCuts... hope that make sense :(
>>>
>>> yasmin
>>>
>>>
>>> > Yasmin,
>>> > What do you mean by assign it to JButton? To me, it looks like
>> whatever
>>> > you
>>> > are trying to do JSVGCanvas already does that.
>>> > Can you explain a bit more?
>>> >
>>> > Javid
>>> >
>>> > -----Original Message-----
>>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>>> > Sent: Saturday, April 08, 2006 3:24 PM
>>> > To: batik-users@xmlgraphics.apache.org
>>> > Subject: Dragable rectangle
>>> >
>>> >
>>> > Hi there,
>>> >
>>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that
>>> the
>>> > area that is selected within the rectangle is zoomed-in, has anyone
>> got
>>> > any ideas how I should go about doing this ...my thoughts are that I
>>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
>> kept
>>> > down to drag the rectangle until the mouseRelease event and upon
>>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
>> I'm
>>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
>> assign
>>> > it to a Jbutton.
>>> >
>>> > Pls advice :(
>>> >
>>> > Thanx
>>> >
>>> > yasmin
>>> >
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail:
>>> batik-users-help@xmlgraphics.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by ra...@blueyonder.co.uk.
Hi Javid,
I followed ur instructions below ...but (mods & InputEvent.select) != 0;
doesn't recognise by button (select), so I kept the original code:
(mods & InputEvent.BUTTON1_MASK) != 0; but I'm still left with the
problem of how to tell the MyCanvas that it is the button 'select' that is
used for InputEvent ....ummm any thoughts?
Thanx
yasmin
> Yasmin,
> Your canvas has to extend the JSVGCanvas and you add the code that you had
> posted. Also, Change the variable name from zoomInteractor2 to
> zoomInteractor.
>
> All, you have to do is just overload the variable in your canvas class.
> I haven't tried this before, so kindly excuse me if it doesn't work.
>
> Class MyCanvas extends JSVGCanvas {
>
> // All your stuff goes here
>
> public MyCanvas() {
> super();
> }
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.select) != 0; //select is my button
>
> }
> };
> }
>
> Thanks,
> Javid
>
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Sunday, April 09, 2006 6:36 AM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Dragable rectangle
>
>
> Hi meAgain!
>
> ...is the following code correct:
>
> protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.select) != 0; //select is my button
>
> }
> };
>
>
> But now I'm not sure where I would need to put this code, do I need to
> directly add the code in JSVGCanvas, I rly dnt have a clue what to do,
> please advice?
>
> Many thanx
>
> yasmin
>
>
>
>
>> Hi Yasmin,
>>
>> You just need to create a new subclass of
>> AbstractZoomInteractor.startInteraction, the one in
>> the Canvas has:
>>
>> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
>> public boolean startInteraction(InputEvent ie) {
>> int mods = ie.getModifiers();
>> return
>> ie.getID() == MouseEvent.MOUSE_PRESSED &&
>> (mods & InputEvent.BUTTON1_MASK) != 0 &&
>> (mods & InputEvent.CTRL_MASK) != 0;
>> }
>> };
>>
>> You will want to check that it's mouse down and that the user
>> has
>> clicked your button, instead of just checking if it is a button1 with
>> ctrl
>> down.
>>
>> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>>
>>>
>>> Hi Javid,
>>>
>>> Yes, the JSVGCanvas already does what I want to do, you know when u
>> wantto
>>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
>> &
>>> MouseDown' ...well, I want to achieve the same by assigning this to a
>>> button, so the user can just click the button and then drag a rectangle
>> to
>>> select the area ...so, that my UI is user friendly, assuming that the
>> user
>>> does not know about the 'Key' shortCuts... hope that make sense :(
>>>
>>> yasmin
>>>
>>>
>>> > Yasmin,
>>> > What do you mean by assign it to JButton? To me, it looks like
>> whatever
>>> > you
>>> > are trying to do JSVGCanvas already does that.
>>> > Can you explain a bit more?
>>> >
>>> > Javid
>>> >
>>> > -----Original Message-----
>>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>>> > Sent: Saturday, April 08, 2006 3:24 PM
>>> > To: batik-users@xmlgraphics.apache.org
>>> > Subject: Dragable rectangle
>>> >
>>> >
>>> > Hi there,
>>> >
>>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that
>>> the
>>> > area that is selected within the rectangle is zoomed-in, has anyone
>> got
>>> > any ideas how I should go about doing this ...my thoughts are that I
>>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
>> kept
>>> > down to drag the rectangle until the mouseRelease event and upon
>>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
>> I'm
>>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
>> assign
>>> > it to a Jbutton.
>>> >
>>> > Pls advice :(
>>> >
>>> > Thanx
>>> >
>>> > yasmin
>>> >
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail:
>>> batik-users-help@xmlgraphics.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by Javid Alimohideen <ja...@gmail.com>.
Yasmin,
Your canvas has to extend the JSVGCanvas and you add the code that you had
posted. Also, Change the variable name from zoomInteractor2 to
zoomInteractor.
All, you have to do is just overload the variable in your canvas class.
I haven't tried this before, so kindly excuse me if it doesn't work.
Class MyCanvas extends JSVGCanvas {
// All your stuff goes here
public MyCanvas() {
super();
}
protected Interactor zoomInteractor = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED &&
(mods & InputEvent.select) != 0; //select is my button
}
};
}
Thanks,
Javid
-----Original Message-----
From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
Sent: Sunday, April 09, 2006 6:36 AM
To: batik-users@xmlgraphics.apache.org
Subject: RE: Dragable rectangle
Hi meAgain!
...is the following code correct:
protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED &&
(mods & InputEvent.select) != 0; //select is my button
}
};
But now I'm not sure where I would need to put this code, do I need to
directly add the code in JSVGCanvas, I rly dnt have a clue what to do,
please advice?
Many thanx
yasmin
> Hi Yasmin,
>
> You just need to create a new subclass of
> AbstractZoomInteractor.startInteraction, the one in
> the Canvas has:
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.BUTTON1_MASK) != 0 &&
> (mods & InputEvent.CTRL_MASK) != 0;
> }
> };
>
> You will want to check that it's mouse down and that the user has
> clicked your button, instead of just checking if it is a button1 with ctrl
> down.
>
> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>
>>
>> Hi Javid,
>>
>> Yes, the JSVGCanvas already does what I want to do, you know when u
> wantto
>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
> &
>> MouseDown' ...well, I want to achieve the same by assigning this to a
>> button, so the user can just click the button and then drag a rectangle
> to
>> select the area ...so, that my UI is user friendly, assuming that the
> user
>> does not know about the 'Key' shortCuts... hope that make sense :(
>>
>> yasmin
>>
>>
>> > Yasmin,
>> > What do you mean by assign it to JButton? To me, it looks like
> whatever
>> > you
>> > are trying to do JSVGCanvas already does that.
>> > Can you explain a bit more?
>> >
>> > Javid
>> >
>> > -----Original Message-----
>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> > Sent: Saturday, April 08, 2006 3:24 PM
>> > To: batik-users@xmlgraphics.apache.org
>> > Subject: Dragable rectangle
>> >
>> >
>> > Hi there,
>> >
>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
>> > area that is selected within the rectangle is zoomed-in, has anyone
> got
>> > any ideas how I should go about doing this ...my thoughts are that I
>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
> kept
>> > down to drag the rectangle until the mouseRelease event and upon
>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
> I'm
>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
> assign
>> > it to a Jbutton.
>> >
>> > Pls advice :(
>> >
>> > Thanx
>> >
>> > yasmin
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> >
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by ra...@blueyonder.co.uk.
Hi meAgain!
...is the following code correct:
protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED &&
(mods & InputEvent.select) != 0; //select is my button
}
};
But now I'm not sure where I would need to put this code, do I need to
directly add the code in JSVGCanvas, I rly dnt have a clue what to do,
please advice?
Many thanx
yasmin
> Hi Yasmin,
>
> You just need to create a new subclass of
> AbstractZoomInteractor.startInteraction, the one in
> the Canvas has:
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.BUTTON1_MASK) != 0 &&
> (mods & InputEvent.CTRL_MASK) != 0;
> }
> };
>
> You will want to check that it's mouse down and that the user has
> clicked your button, instead of just checking if it is a button1 with ctrl
> down.
>
> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>
>>
>> Hi Javid,
>>
>> Yes, the JSVGCanvas already does what I want to do, you know when u
> wantto
>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
> &
>> MouseDown' ...well, I want to achieve the same by assigning this to a
>> button, so the user can just click the button and then drag a rectangle
> to
>> select the area ...so, that my UI is user friendly, assuming that the
> user
>> does not know about the 'Key' shortCuts... hope that make sense :(
>>
>> yasmin
>>
>>
>> > Yasmin,
>> > What do you mean by assign it to JButton? To me, it looks like
> whatever
>> > you
>> > are trying to do JSVGCanvas already does that.
>> > Can you explain a bit more?
>> >
>> > Javid
>> >
>> > -----Original Message-----
>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> > Sent: Saturday, April 08, 2006 3:24 PM
>> > To: batik-users@xmlgraphics.apache.org
>> > Subject: Dragable rectangle
>> >
>> >
>> > Hi there,
>> >
>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
>> > area that is selected within the rectangle is zoomed-in, has anyone
> got
>> > any ideas how I should go about doing this ...my thoughts are that I
>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
> kept
>> > down to drag the rectangle until the mouseRelease event and upon
>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
> I'm
>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
> assign
>> > it to a Jbutton.
>> >
>> > Pls advice :(
>> >
>> > Thanx
>> >
>> > yasmin
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> >
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by ra...@blueyonder.co.uk.
Hi Thomas,
I'm not sure how to assign my button to AbstractZoomInteractor, i.e. say I
have a 'button2' and when the user clicks it provokes the
AbsractZoomIneractor() class ...so, is my code going to be very similar to
the one below only changes are:
ie.getID() == MouseEvent.MOUSE_PRESSED &&
(mods & InputEvent.BUTTON1_MASK) != 0 &&
(mods & InputEvent.CTRL_MASK) != 0;
> Hi Yasmin,
>
> You just need to create a new subclass of
> AbstractZoomInteractor.startInteraction, the one in
> the Canvas has:
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.BUTTON1_MASK) != 0 &&
> (mods & InputEvent.CTRL_MASK) != 0;
> }
> };
>
> You will want to check that it's mouse down and that the user has
> clicked your button, instead of just checking if it is a button1 with ctrl
> down.
>
> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>
>>
>> Hi Javid,
>>
>> Yes, the JSVGCanvas already does what I want to do, you know when u
> wantto
>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
> &
>> MouseDown' ...well, I want to achieve the same by assigning this to a
>> button, so the user can just click the button and then drag a rectangle
> to
>> select the area ...so, that my UI is user friendly, assuming that the
> user
>> does not know about the 'Key' shortCuts... hope that make sense :(
>>
>> yasmin
>>
>>
>> > Yasmin,
>> > What do you mean by assign it to JButton? To me, it looks like
> whatever
>> > you
>> > are trying to do JSVGCanvas already does that.
>> > Can you explain a bit more?
>> >
>> > Javid
>> >
>> > -----Original Message-----
>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> > Sent: Saturday, April 08, 2006 3:24 PM
>> > To: batik-users@xmlgraphics.apache.org
>> > Subject: Dragable rectangle
>> >
>> >
>> > Hi there,
>> >
>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
>> > area that is selected within the rectangle is zoomed-in, has anyone
> got
>> > any ideas how I should go about doing this ...my thoughts are that I
>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
> kept
>> > down to drag the rectangle until the mouseRelease event and upon
>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
> I'm
>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
> assign
>> > it to a Jbutton.
>> >
>> > Pls advice :(
>> >
>> > Thanx
>> >
>> > yasmin
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> >
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by ra...@blueyonder.co.uk.
Hi Thomas,
I'm not sure how to assign my button to AbstractZoomInteractor, i.e. say I
have a 'button2' and when the user clicks it provokes the
AbsractZoomIneractor() class ...so, is my code going to be very similar to
the one below only changes are:
ie.getID() == MouseEvent.MOUSE_PRESSED &&
(mods & InputEvent.BUTTON1_MASK) != 0 &&
(mods & InputEvent.CTRL_MASK) != 0;
> Hi Yasmin,
>
> You just need to create a new subclass of
> AbstractZoomInteractor.startInteraction, the one in
> the Canvas has:
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.BUTTON1_MASK) != 0 &&
> (mods & InputEvent.CTRL_MASK) != 0;
> }
> };
>
> You will want to check that it's mouse down and that the user has
> clicked your button, instead of just checking if it is a button1 with ctrl
> down.
>
> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>
>>
>> Hi Javid,
>>
>> Yes, the JSVGCanvas already does what I want to do, you know when u
> wantto
>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
> &
>> MouseDown' ...well, I want to achieve the same by assigning this to a
>> button, so the user can just click the button and then drag a rectangle
> to
>> select the area ...so, that my UI is user friendly, assuming that the
> user
>> does not know about the 'Key' shortCuts... hope that make sense :(
>>
>> yasmin
>>
>>
>> > Yasmin,
>> > What do you mean by assign it to JButton? To me, it looks like
> whatever
>> > you
>> > are trying to do JSVGCanvas already does that.
>> > Can you explain a bit more?
>> >
>> > Javid
>> >
>> > -----Original Message-----
>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> > Sent: Saturday, April 08, 2006 3:24 PM
>> > To: batik-users@xmlgraphics.apache.org
>> > Subject: Dragable rectangle
>> >
>> >
>> > Hi there,
>> >
>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
>> > area that is selected within the rectangle is zoomed-in, has anyone
> got
>> > any ideas how I should go about doing this ...my thoughts are that I
>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
> kept
>> > down to drag the rectangle until the mouseRelease event and upon
>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
> I'm
>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
> assign
>> > it to a Jbutton.
>> >
>> > Pls advice :(
>> >
>> > Thanx
>> >
>> > yasmin
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> >
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle - Why its not working???
Posted by ra...@blueyonder.co.uk.
Hey Javid,
ThankU so much itz working!!!
tc
yasmin :)
> Yasmin,
> Make sure you add the interactor the canvas interactors list
>
> like: getInteractors().add(zoomInteractor2); // add this in your canvas
> class
>
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafictqy@blueyonder.co.uk]
> Sent: Sunday, April 09, 2006 1:32 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Dragable rectangle - Why its not working???
>
>
> Javid,
>
> This is myCode, the reason why I haven't changed the name to
> zoomInteractor is because I dnt want to overide that I still want to keep
> the key-board shortcut too ...anyway even if i do change the name it stil
> dnt work :
>
> public class MyCanvas extends JSVGCanvas
> {
> public boolean isButtonClicked = false;
>
> public MyCanvas() {
> super();
> }
>
> protected Interactor zoomInteractor2 = new AbstractZoomInteractor()
> {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
>
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked ==
> true;
>
> }
> };
>
>
> }
>
> ...and here is a snippet of the code from my Client class:
>
> MyCanvas canvas = new MyCanvas();
>
> ..........
> ..........
> ..........
>
> select.addActionListener(new ActionListener() {
>
> public void actionPerformed(ActionEvent ae)
> {
> canvas.isButtonClicked = true;
>
> }
>
>
> ummmm I rly cant see what I'm doing wrong?
>
> yasmin
>
>
>
>> Yasmin,
>> I hope, you have created a button action listener for the select button
>> and
>> chaning the value of the boolean. Also, try changing the name from
>> zoomInteractor2 to zoomInteractor.
>>
>> Javid
>>
>> -----Original Message-----
>> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> Sent: Sunday, April 09, 2006 12:48 PM
>> To: batik-users@xmlgraphics.apache.org
>> Subject: RE: Dragable rectangle - Why its not working???
>>
>>
>> Hi,
>>
>> I've created a new subclass as follows:
>>
>> protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
>> public boolean startInteraction(InputEvent ie) {
>> int mods = ie.getModifiers();
>>
>> return
>> ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked ==
>> true;
>> }
>> };
>>
>> That is checking that it's mouse down and that the user has
>> clicked my button, instead of just checking if it is a button1 with ctrl
>> down. But when I run the code, and click the button nothing happens :(
>>
>> Pls Help
>>
>> yasmin
>>
>>
>>> Hi Yasmin,
>>>
>>> You just need to create a new subclass of
>>> AbstractZoomInteractor.startInteraction, the one in
>>> the Canvas has:
>>>
>>> protected Interactor zoomInteractor = new AbstractZoomInteractor()
>>> {
>>> public boolean startInteraction(InputEvent ie) {
>>> int mods = ie.getModifiers();
>>> return
>>> ie.getID() == MouseEvent.MOUSE_PRESSED &&
>>> (mods & InputEvent.BUTTON1_MASK) != 0 &&
>>> (mods & InputEvent.CTRL_MASK) != 0;
>>> }
>>> };
>>>
>>> You will want to check that it's mouse down and that the user
>>> has
>>> clicked your button, instead of just checking if it is a button1 with
>>> ctrl
>>> down.
>>>
>>> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>>>
>>>>
>>>> Hi Javid,
>>>>
>>>> Yes, the JSVGCanvas already does what I want to do, you know when u
>>> wantto
>>>> select an area on ur canvas to zoomIn, you do that by holding the
>>>> 'CTRL
>>> &
>>>> MouseDown' ...well, I want to achieve the same by assigning this to a
>>>> button, so the user can just click the button and then drag a
>>>> rectangle
>>> to
>>>> select the area ...so, that my UI is user friendly, assuming that the
>>> user
>>>> does not know about the 'Key' shortCuts... hope that make sense :(
>>>>
>>>> yasmin
>>>>
>>>>
>>>> > Yasmin,
>>>> > What do you mean by assign it to JButton? To me, it looks like
>>> whatever
>>>> > you
>>>> > are trying to do JSVGCanvas already does that.
>>>> > Can you explain a bit more?
>>>> >
>>>> > Javid
>>>> >
>>>> > -----Original Message-----
>>>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>>>> > Sent: Saturday, April 08, 2006 3:24 PM
>>>> > To: batik-users@xmlgraphics.apache.org
>>>> > Subject: Dragable rectangle
>>>> >
>>>> >
>>>> > Hi there,
>>>> >
>>>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that
>>>> the
>>>> > area that is selected within the rectangle is zoomed-in, has anyone
>>> got
>>>> > any ideas how I should go about doing this ...my thoughts are that I
>>>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
>>> kept
>>>> > down to drag the rectangle until the mouseRelease event and upon
>>>> > mouseRelease the svgMap then zoomIn to the selected area... in
>>>> effect
>>> I'm
>>>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
>>> assign
>>>> > it to a Jbutton.
>>>> >
>>>> > Pls advice :(
>>>> >
>>>> > Thanx
>>>> >
>>>> > yasmin
>>>> >
>>>> >
>>>> >
>>>> > ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail:
>>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>>> > For additional commands, e-mail:
>>> batik-users-help@xmlgraphics.apache.org
>>>> >
>>>> >
>>>> > ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail:
>>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>>> > For additional commands, e-mail:
>>> batik-users-help@xmlgraphics.apache.org
>>>> >
>>>> >
>>>> >
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>>> For additional commands, e-mail:
>>>> batik-users-help@xmlgraphics.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail:
>>> batik-users-help@xmlgraphics.apache.org
>>>
>>>
>>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle - Why its not working???
Posted by Javid Alimohideen <ja...@gmail.com>.
Yasmin,
Make sure you add the interactor the canvas interactors list
like: getInteractors().add(zoomInteractor2); // add this in your canvas
class
Javid
-----Original Message-----
From: rafiqy@blueyonder.co.uk [mailto:rafictqy@blueyonder.co.uk]
Sent: Sunday, April 09, 2006 1:32 PM
To: batik-users@xmlgraphics.apache.org
Subject: RE: Dragable rectangle - Why its not working???
Javid,
This is myCode, the reason why I haven't changed the name to
zoomInteractor is because I dnt want to overide that I still want to keep
the key-board shortcut too ...anyway even if i do change the name it stil
dnt work :
public class MyCanvas extends JSVGCanvas
{
public boolean isButtonClicked = false;
public MyCanvas() {
super();
}
protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked == true;
}
};
}
...and here is a snippet of the code from my Client class:
MyCanvas canvas = new MyCanvas();
..........
..........
..........
select.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae)
{
canvas.isButtonClicked = true;
}
ummmm I rly cant see what I'm doing wrong?
yasmin
> Yasmin,
> I hope, you have created a button action listener for the select button
> and
> chaning the value of the boolean. Also, try changing the name from
> zoomInteractor2 to zoomInteractor.
>
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Sunday, April 09, 2006 12:48 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Dragable rectangle - Why its not working???
>
>
> Hi,
>
> I've created a new subclass as follows:
>
> protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
>
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked ==
> true;
> }
> };
>
> That is checking that it's mouse down and that the user has
> clicked my button, instead of just checking if it is a button1 with ctrl
> down. But when I run the code, and click the button nothing happens :(
>
> Pls Help
>
> yasmin
>
>
>> Hi Yasmin,
>>
>> You just need to create a new subclass of
>> AbstractZoomInteractor.startInteraction, the one in
>> the Canvas has:
>>
>> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
>> public boolean startInteraction(InputEvent ie) {
>> int mods = ie.getModifiers();
>> return
>> ie.getID() == MouseEvent.MOUSE_PRESSED &&
>> (mods & InputEvent.BUTTON1_MASK) != 0 &&
>> (mods & InputEvent.CTRL_MASK) != 0;
>> }
>> };
>>
>> You will want to check that it's mouse down and that the user
>> has
>> clicked your button, instead of just checking if it is a button1 with
>> ctrl
>> down.
>>
>> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>>
>>>
>>> Hi Javid,
>>>
>>> Yes, the JSVGCanvas already does what I want to do, you know when u
>> wantto
>>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
>> &
>>> MouseDown' ...well, I want to achieve the same by assigning this to a
>>> button, so the user can just click the button and then drag a rectangle
>> to
>>> select the area ...so, that my UI is user friendly, assuming that the
>> user
>>> does not know about the 'Key' shortCuts... hope that make sense :(
>>>
>>> yasmin
>>>
>>>
>>> > Yasmin,
>>> > What do you mean by assign it to JButton? To me, it looks like
>> whatever
>>> > you
>>> > are trying to do JSVGCanvas already does that.
>>> > Can you explain a bit more?
>>> >
>>> > Javid
>>> >
>>> > -----Original Message-----
>>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>>> > Sent: Saturday, April 08, 2006 3:24 PM
>>> > To: batik-users@xmlgraphics.apache.org
>>> > Subject: Dragable rectangle
>>> >
>>> >
>>> > Hi there,
>>> >
>>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that
>>> the
>>> > area that is selected within the rectangle is zoomed-in, has anyone
>> got
>>> > any ideas how I should go about doing this ...my thoughts are that I
>>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
>> kept
>>> > down to drag the rectangle until the mouseRelease event and upon
>>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
>> I'm
>>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
>> assign
>>> > it to a Jbutton.
>>> >
>>> > Pls advice :(
>>> >
>>> > Thanx
>>> >
>>> > yasmin
>>> >
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail:
>>> batik-users-help@xmlgraphics.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle - Why its not working???
Posted by ra...@blueyonder.co.uk.
Javid,
This is myCode, the reason why I haven't changed the name to
zoomInteractor is because I dnt want to overide that I still want to keep
the key-board shortcut too ...anyway even if i do change the name it stil
dnt work :
public class MyCanvas extends JSVGCanvas
{
public boolean isButtonClicked = false;
public MyCanvas() {
super();
}
protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked == true;
}
};
}
...and here is a snippet of the code from my Client class:
MyCanvas canvas = new MyCanvas();
..........
..........
..........
select.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae)
{
canvas.isButtonClicked = true;
}
ummmm I rly cant see what I'm doing wrong?
yasmin
> Yasmin,
> I hope, you have created a button action listener for the select button
> and
> chaning the value of the boolean. Also, try changing the name from
> zoomInteractor2 to zoomInteractor.
>
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Sunday, April 09, 2006 12:48 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Dragable rectangle - Why its not working???
>
>
> Hi,
>
> I've created a new subclass as follows:
>
> protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
>
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked ==
> true;
> }
> };
>
> That is checking that it's mouse down and that the user has
> clicked my button, instead of just checking if it is a button1 with ctrl
> down. But when I run the code, and click the button nothing happens :(
>
> Pls Help
>
> yasmin
>
>
>> Hi Yasmin,
>>
>> You just need to create a new subclass of
>> AbstractZoomInteractor.startInteraction, the one in
>> the Canvas has:
>>
>> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
>> public boolean startInteraction(InputEvent ie) {
>> int mods = ie.getModifiers();
>> return
>> ie.getID() == MouseEvent.MOUSE_PRESSED &&
>> (mods & InputEvent.BUTTON1_MASK) != 0 &&
>> (mods & InputEvent.CTRL_MASK) != 0;
>> }
>> };
>>
>> You will want to check that it's mouse down and that the user
>> has
>> clicked your button, instead of just checking if it is a button1 with
>> ctrl
>> down.
>>
>> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>>
>>>
>>> Hi Javid,
>>>
>>> Yes, the JSVGCanvas already does what I want to do, you know when u
>> wantto
>>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
>> &
>>> MouseDown' ...well, I want to achieve the same by assigning this to a
>>> button, so the user can just click the button and then drag a rectangle
>> to
>>> select the area ...so, that my UI is user friendly, assuming that the
>> user
>>> does not know about the 'Key' shortCuts... hope that make sense :(
>>>
>>> yasmin
>>>
>>>
>>> > Yasmin,
>>> > What do you mean by assign it to JButton? To me, it looks like
>> whatever
>>> > you
>>> > are trying to do JSVGCanvas already does that.
>>> > Can you explain a bit more?
>>> >
>>> > Javid
>>> >
>>> > -----Original Message-----
>>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>>> > Sent: Saturday, April 08, 2006 3:24 PM
>>> > To: batik-users@xmlgraphics.apache.org
>>> > Subject: Dragable rectangle
>>> >
>>> >
>>> > Hi there,
>>> >
>>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that
>>> the
>>> > area that is selected within the rectangle is zoomed-in, has anyone
>> got
>>> > any ideas how I should go about doing this ...my thoughts are that I
>>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
>> kept
>>> > down to drag the rectangle until the mouseRelease event and upon
>>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
>> I'm
>>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
>> assign
>>> > it to a Jbutton.
>>> >
>>> > Pls advice :(
>>> >
>>> > Thanx
>>> >
>>> > yasmin
>>> >
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail:
>>> batik-users-unsubscribe@xmlgraphics.apache.org
>>> > For additional commands, e-mail:
>> batik-users-help@xmlgraphics.apache.org
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail:
>>> batik-users-help@xmlgraphics.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle - Why its not working???
Posted by Javid Alimohideen <ja...@gmail.com>.
Yasmin,
I hope, you have created a button action listener for the select button and
chaning the value of the boolean. Also, try changing the name from
zoomInteractor2 to zoomInteractor.
Javid
-----Original Message-----
From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
Sent: Sunday, April 09, 2006 12:48 PM
To: batik-users@xmlgraphics.apache.org
Subject: RE: Dragable rectangle - Why its not working???
Hi,
I've created a new subclass as follows:
protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked == true;
}
};
That is checking that it's mouse down and that the user has
clicked my button, instead of just checking if it is a button1 with ctrl
down. But when I run the code, and click the button nothing happens :(
Pls Help
yasmin
> Hi Yasmin,
>
> You just need to create a new subclass of
> AbstractZoomInteractor.startInteraction, the one in
> the Canvas has:
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.BUTTON1_MASK) != 0 &&
> (mods & InputEvent.CTRL_MASK) != 0;
> }
> };
>
> You will want to check that it's mouse down and that the user has
> clicked your button, instead of just checking if it is a button1 with ctrl
> down.
>
> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>
>>
>> Hi Javid,
>>
>> Yes, the JSVGCanvas already does what I want to do, you know when u
> wantto
>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
> &
>> MouseDown' ...well, I want to achieve the same by assigning this to a
>> button, so the user can just click the button and then drag a rectangle
> to
>> select the area ...so, that my UI is user friendly, assuming that the
> user
>> does not know about the 'Key' shortCuts... hope that make sense :(
>>
>> yasmin
>>
>>
>> > Yasmin,
>> > What do you mean by assign it to JButton? To me, it looks like
> whatever
>> > you
>> > are trying to do JSVGCanvas already does that.
>> > Can you explain a bit more?
>> >
>> > Javid
>> >
>> > -----Original Message-----
>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> > Sent: Saturday, April 08, 2006 3:24 PM
>> > To: batik-users@xmlgraphics.apache.org
>> > Subject: Dragable rectangle
>> >
>> >
>> > Hi there,
>> >
>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
>> > area that is selected within the rectangle is zoomed-in, has anyone
> got
>> > any ideas how I should go about doing this ...my thoughts are that I
>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
> kept
>> > down to drag the rectangle until the mouseRelease event and upon
>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
> I'm
>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
> assign
>> > it to a Jbutton.
>> >
>> > Pls advice :(
>> >
>> > Thanx
>> >
>> > yasmin
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> >
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle - Why its not working???
Posted by ra...@blueyonder.co.uk.
Hi,
I've created a new subclass as follows:
protected Interactor zoomInteractor2 = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED && isButtonClicked == true;
}
};
That is checking that it's mouse down and that the user has
clicked my button, instead of just checking if it is a button1 with ctrl
down. But when I run the code, and click the button nothing happens :(
Pls Help
yasmin
> Hi Yasmin,
>
> You just need to create a new subclass of
> AbstractZoomInteractor.startInteraction, the one in
> the Canvas has:
>
> protected Interactor zoomInteractor = new AbstractZoomInteractor() {
> public boolean startInteraction(InputEvent ie) {
> int mods = ie.getModifiers();
> return
> ie.getID() == MouseEvent.MOUSE_PRESSED &&
> (mods & InputEvent.BUTTON1_MASK) != 0 &&
> (mods & InputEvent.CTRL_MASK) != 0;
> }
> };
>
> You will want to check that it's mouse down and that the user has
> clicked your button, instead of just checking if it is a button1 with ctrl
> down.
>
> rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>
>>
>> Hi Javid,
>>
>> Yes, the JSVGCanvas already does what I want to do, you know when u
> wantto
>> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
> &
>> MouseDown' ...well, I want to achieve the same by assigning this to a
>> button, so the user can just click the button and then drag a rectangle
> to
>> select the area ...so, that my UI is user friendly, assuming that the
> user
>> does not know about the 'Key' shortCuts... hope that make sense :(
>>
>> yasmin
>>
>>
>> > Yasmin,
>> > What do you mean by assign it to JButton? To me, it looks like
> whatever
>> > you
>> > are trying to do JSVGCanvas already does that.
>> > Can you explain a bit more?
>> >
>> > Javid
>> >
>> > -----Original Message-----
>> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> > Sent: Saturday, April 08, 2006 3:24 PM
>> > To: batik-users@xmlgraphics.apache.org
>> > Subject: Dragable rectangle
>> >
>> >
>> > Hi there,
>> >
>> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
>> > area that is selected within the rectangle is zoomed-in, has anyone
> got
>> > any ideas how I should go about doing this ...my thoughts are that I
>> > create a mouseListener, to listen for mouseDown, whilst the mouse is
> kept
>> > down to drag the rectangle until the mouseRelease event and upon
>> > mouseRelease the svgMap then zoomIn to the selected area... in effect
> I'm
>> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
> assign
>> > it to a Jbutton.
>> >
>> > Pls advice :(
>> >
>> > Thanx
>> >
>> > yasmin
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> > For additional commands, e-mail:
> batik-users-help@xmlgraphics.apache.org
>> >
>> >
>> >
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by th...@kodak.com.
Hi Yasmin,
You just need to create a new subclass of
AbstractZoomInteractor.startInteraction, the one in
the Canvas has:
protected Interactor zoomInteractor = new AbstractZoomInteractor() {
public boolean startInteraction(InputEvent ie) {
int mods = ie.getModifiers();
return
ie.getID() == MouseEvent.MOUSE_PRESSED &&
(mods & InputEvent.BUTTON1_MASK) != 0 &&
(mods & InputEvent.CTRL_MASK) != 0;
}
};
You will want to check that it's mouse down and that the user has
clicked your button, instead of just checking if it is a button1 with ctrl
down.
rafiqy@blueyonder.co.uk wrote on 04/08/2006 06:39:16 PM:
>
> Hi Javid,
>
> Yes, the JSVGCanvas already does what I want to do, you know when u
wantto
> select an area on ur canvas to zoomIn, you do that by holding the 'CTRL
&
> MouseDown' ...well, I want to achieve the same by assigning this to a
> button, so the user can just click the button and then drag a rectangle
to
> select the area ...so, that my UI is user friendly, assuming that the
user
> does not know about the 'Key' shortCuts... hope that make sense :(
>
> yasmin
>
>
> > Yasmin,
> > What do you mean by assign it to JButton? To me, it looks like
whatever
> > you
> > are trying to do JSVGCanvas already does that.
> > Can you explain a bit more?
> >
> > Javid
> >
> > -----Original Message-----
> > From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> > Sent: Saturday, April 08, 2006 3:24 PM
> > To: batik-users@xmlgraphics.apache.org
> > Subject: Dragable rectangle
> >
> >
> > Hi there,
> >
> > I'm trying to create a dragable rectangle on my JSVGCanvas so that the
> > area that is selected within the rectangle is zoomed-in, has anyone
got
> > any ideas how I should go about doing this ...my thoughts are that I
> > create a mouseListener, to listen for mouseDown, whilst the mouse is
kept
> > down to drag the rectangle until the mouseRelease event and upon
> > mouseRelease the svgMap then zoomIn to the selected area... in effect
I'm
> > trying to replicate the key-board short cut 'CTRL_MouseDown' ...and
assign
> > it to a Jbutton.
> >
> > Pls advice :(
> >
> > Thanx
> >
> > yasmin
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail:
batik-users-help@xmlgraphics.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail:
batik-users-help@xmlgraphics.apache.org
> >
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by ra...@blueyonder.co.uk.
Hi Javid,
Yes, the JSVGCanvas already does what I want to do, you know when u wantto
select an area on ur canvas to zoomIn, you do that by holding the 'CTRL &
MouseDown' ...well, I want to achieve the same by assigning this to a
button, so the user can just click the button and then drag a rectangle to
select the area ...so, that my UI is user friendly, assuming that the user
does not know about the 'Key' shortCuts... hope that make sense :(
yasmin
> Yasmin,
> What do you mean by assign it to JButton? To me, it looks like whatever
> you
> are trying to do JSVGCanvas already does that.
> Can you explain a bit more?
>
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Saturday, April 08, 2006 3:24 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: Dragable rectangle
>
>
> Hi there,
>
> I'm trying to create a dragable rectangle on my JSVGCanvas so that the
> area that is selected within the rectangle is zoomed-in, has anyone got
> any ideas how I should go about doing this ...my thoughts are that I
> create a mouseListener, to listen for mouseDown, whilst the mouse is kept
> down to drag the rectangle until the mouseRelease event and upon
> mouseRelease the svgMap then zoomIn to the selected area... in effect I'm
> trying to replicate the key-board short cut 'CTRL_MouseDown' ...and assign
> it to a Jbutton.
>
> Pls advice :(
>
> Thanx
>
> yasmin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
RE: Dragable rectangle
Posted by Javid Alimohideen <ja...@gmail.com>.
Yasmin,
What do you mean by assign it to JButton? To me, it looks like whatever you
are trying to do JSVGCanvas already does that.
Can you explain a bit more?
Javid
-----Original Message-----
From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
Sent: Saturday, April 08, 2006 3:24 PM
To: batik-users@xmlgraphics.apache.org
Subject: Dragable rectangle
Hi there,
I'm trying to create a dragable rectangle on my JSVGCanvas so that the
area that is selected within the rectangle is zoomed-in, has anyone got
any ideas how I should go about doing this ...my thoughts are that I
create a mouseListener, to listen for mouseDown, whilst the mouse is kept
down to drag the rectangle until the mouseRelease event and upon
mouseRelease the svgMap then zoomIn to the selected area... in effect I'm
trying to replicate the key-board short cut 'CTRL_MouseDown' ...and assign
it to a Jbutton.
Pls advice :(
Thanx
yasmin
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org