By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,738 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,738 IT Pros & Developers. It's quick & easy.

Casting Font object into Element--- Need Help!!

P: 18
Hi all

I really need a solution for the following::
-------------------------------------------------------------------------------------
Font newFont= domainAxis.getTickLabelFont();
Element newFont = (Element)newFont;

newFont.setAttribute("kerning", "no");
newFont.setAttribute("family","SansSerif");
newFont.setAttribute("name","SansSerif");
newFont.setAttribute("style","plain");
newFont.setAttribute("size","10");

domainAxis.setsetTickLabelFont((Font)newFont);
-------------------------------------------------------------------------------------

But this gives a Casting exception!!
Ho to do the casting

Regards
Madumm
Jan 18 '07 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
Hi all

I really need a solution for the following::
-------------------------------------------------------------------------------------
Font newFont= domainAxis.getTickLabelFont();
Element newFont = (Element)newFont;

newFont.setAttribute("kerning", "no");
newFont.setAttribute("family","SansSerif");
newFont.setAttribute("name","SansSerif");
newFont.setAttribute("style","plain");
newFont.setAttribute("size","10");

domainAxis.setsetTickLabelFont((Font)newFont);
-------------------------------------------------------------------------------------

But this gives a Casting exception!!
Ho to do the casting

Regards
Madumm
Ok now post the code that gave you the class cast exception because the code you posted does not compile. You declared two variables called newFont

Expand|Select|Wrap|Line Numbers
  1. Font newFont= domainAxis.getTickLabelFont();
  2. Element newFont = (Element)newFont;
(notice how I used code tags there) that will not compile and will say newFont is already defined.
Jan 18 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.