bader houmad wrote:
re

thanks a lot

I used the first option.

but, for the second option, the method getStyle() is not defined for the type Element.

Correct this is defined by the 'org.w3c.dom.svg.SVGStylable' interface which almost all SVG elements implement. So in Java you need to cast the Element to SVGStylable first.

 >bader houmad wrote:
 >
 >>I want to change the attributes of an element, but not all of them:
 >>(ex: myElement is a rectangle, "fill:BLACK" "stroke:RED"and
 >>"stroke-width:15")
 >>
 >>myElement.setAttributeNS(null,"style", "fill:BLUE");
 >
 >    You have a couple of options here.  One is to use presentation
 >attributes.  So instead of saying:
 > style="fill:black; stroke:red; stroke-width:15"
 >Use:
 > fill="black" stroke="red" stroke-width="15"
 >
 >   Then you can use: myElement.setAttributeNS(null, "fill", "blue")
 >
 >>this way myRectangle becomes BLUE but its stroke is set by default
 >>to black and stroke-width to zero.
 >>
 >>is there a method to change only the "fill" for example?
 >
 >    The other option is to use the CSSStyleDeclaration:
 >
 >    myElement.getStyle().setProperty("fill", "blue", "");
 >
 >    The last parameter can be "!important" to make the
 >property specification 'important' as per the CSS specification.
 >
 >    HTH
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail:
 >[EMAIL PROTECTED]
 >For additional commands, e-mail:
 >[EMAIL PROTECTED]
 >

Essayez le nouveau MSN Search : plus performant, plus pr�cis. <http://g.msn.com/8HMAFRFR/2743??PS=47575> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


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



Reply via email to