RE: Mix SVG and Swing components

2005-02-10 Thread Venkataramana_Jaladurgam
Original Message-
From: Thomas DeWeese
To: batik-dev@xml.apache.org
Sent: 1/27/2005 6:35 PM
Subject: Re: Mix SVG and Swing components

Venkataramana_Jaladurgam wrote:

> Is there any way I can scale the swing components along the lines of
SVG
> elements if I choose to add Swing components to JSVGCanvas directly.

Only if you can insert yourself in the components repaint chain.
So for example if you were to override the paintChildren method from
JComponent you might be able to adjust the graphics object prior
to drawing the children to scale/translate them as desired.

> 
> 
> -Original Message-
> From: Tonny Kohar [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, January 19, 2005 9:16 PM
> To: 'batik-dev@xml.apache.org'
> Subject: Re: Mix SVG and Swing components
> 
> Hi,
> 
> 
>>  I am required to add Swing components to the SVG canvas. I want to
use
> 
> the
> 
>>batik extensions.
>> The trouble I am facing is in the actual rendering class:
> 
> 
>>The output I am getting in the JSVGCanvas is a static version of
> 
> JTextField.
> 
>>I cannot enter characters or do anything with it. 
>>Any ideas? I believe if I can access JSVGCanvas or the related class
where
>>the components are being rendered, then I can directly add my swing
>>component to it. But couldn't get how to get it. Batik developers pls.
> 
> help.
> 
> I do not know how to solve your problem, but as far as I know the
batik
> GVT part is render the SVG stuff into Image that will be painted into
> the JSVGCanvas. The package org.apache.batik.gvt.renderer is where the
> rendering stuff.
> 
> How about extending JSVGCanvas or its parent paintComponent method and
> adding your textField there. Or maybe wrap JSVGCanvas and your
textfield
> into custom component and using Java JComponent layer or z-order
> capability.
> 
> Regards
> Tonny Kohar


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Mix SVG and Swing components

2005-01-25 Thread Venkataramana_Jaladurgam
Is there any way I can scale the swing components along the lines of SVG
elements if I choose to add Swing components to JSVGCanvas directly.


-Original Message-
From: Tonny Kohar [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 19, 2005 9:16 PM
To: 'batik-dev@xml.apache.org'
Subject: Re: Mix SVG and Swing components

Hi,

>   I am required to add Swing components to the SVG canvas. I want to use
the
> batik extensions.
>  The trouble I am facing is in the actual rendering class:

> The output I am getting in the JSVGCanvas is a static version of
JTextField.
> I cannot enter characters or do anything with it. 
> Any ideas? I believe if I can access JSVGCanvas or the related class where
> the components are being rendered, then I can directly add my swing
> component to it. But couldn't get how to get it. Batik developers pls.
help.

I do not know how to solve your problem, but as far as I know the batik
GVT part is render the SVG stuff into Image that will be painted into
the JSVGCanvas. The package org.apache.batik.gvt.renderer is where the
rendering stuff.

How about extending JSVGCanvas or its parent paintComponent method and
adding your textField there. Or maybe wrap JSVGCanvas and your textfield
into custom component and using Java JComponent layer or z-order
capability.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Mix SVG and Swing components

2005-01-20 Thread Venkataramana_Jaladurgam
Thanks for the suggestion. The problem with this approach is the swing
components will not be scalable. 
I have created a class that extends AbstractGraphicsNode to display the
swing component.

public class SwingGraphicsNode
extends AbstractGraphicsNode
implements GraphicsNodeMouseListener,
   GraphicsNodeKeyListener,
   GraphicsNodeChangeListener {

JButton fButton = null;

public SwingGraphicsNode() {
//Test code
fButton = new JButton("Button");
setPointerEventType(ALL);
}

public void paint(Graphics2D g2d) {
primitivePaint(g2d);
}

public void primitivePaint(Graphics2D g2d) {
Rectangle2D bounds = getBounds();
g = g2d.create();
g.translate((int)bounds.getX(), (int)bounds.getY());
fButton.getModel().setPressed(true);
fButton.paint(g);
   }

   //The mouse events are registered in Bridge Extension class
   //Think that mousePressed is called whenever mouse is pressed on the
respective button   
   public void mousePressed(GraphicsNodeMouseEvent evt) {
// TODO Auto-generated method stub
System.out.println("[mouse pressed]");
//fButton.getModel().setPressed(true);
fButton.setForeground(Color.RED);
fButton.setBackground(Color.GREEN);
Rectangle2D bounds = getBounds();
fButton.repaint();
setVisible(false);
setVisible(true);
  }
}

The button's foreground and background color are changed only when mouse
button is released. I expected that the color of the button will change
immediately when the mouse button is pressed.

Any issues in the program? Any workarounds? Glad to know.



-Original Message-
From: Tonny Kohar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 19, 2005 9:16 PM
To: 'batik-dev@xml.apache.org'
Subject: Re: Mix SVG and Swing components


Hi,

>   I am required to add Swing components to the SVG canvas. I want to use
the
> batik extensions.
>  The trouble I am facing is in the actual rendering class:

> The output I am getting in the JSVGCanvas is a static version of
JTextField.
> I cannot enter characters or do anything with it. 
> Any ideas? I believe if I can access JSVGCanvas or the related class where
> the components are being rendered, then I can directly add my swing
> component to it. But couldn't get how to get it. Batik developers pls.
help.

I do not know how to solve your problem, but as far as I know the batik
GVT part is render the SVG stuff into Image that will be painted into
the JSVGCanvas. The package org.apache.batik.gvt.renderer is where the
rendering stuff.

How about extending JSVGCanvas or its parent paintComponent method and
adding your textField there. Or maybe wrap JSVGCanvas and your textfield
into custom component and using Java JComponent layer or z-order
capability.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Mix SVG and Swing components

2005-01-19 Thread Venkataramana_Jaladurgam
Hello,
  I am required to add Swing components to the SVG canvas. I want to use the
batik extensions.
 The trouble I am facing is in the actual rendering class:

public class SwingGraphicsNode extends AbstractGraphicsNode
{
JTextField fComponent = new JTextField(10);

public void primitivePaint(Graphics2D g2d) {
   Rectangle2D bounds = getBounds();
   g = g2d.create();
   g.translate(20,20); //Example translation
   fComponent.paint(g);
} 

}
  

The output I am getting in the JSVGCanvas is a static version of JTextField.
I cannot enter characters or do anything with it. 
Any ideas? I believe if I can access JSVGCanvas or the related class where
the components are being rendered, then I can directly add my swing
component to it. But couldn't get how to get it. Batik developers pls. help.


** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]