jLabel.setFont(font); [message #89193] |
Mon, 02 May 2005 10:48  |
Eclipse User |
|
|
|
Hello,
is there a possibility to set font, that is a variable. For example:
private Font font = new Font("Dialog", Font.PLAIN, 12);
jLabel.setFont(font);
If I do it so I get an exception: java.lang.IllegalArgumentException.... I
tried it also with VE_1.1.
If I have a class derived from JLabel and set the font within the class I
do not get any exception.
Is this different behavior ok?
Thanks
Elena
|
|
|
|
|
|
Re: jLabel.setFont(font); [message #607293 is a reply to message #89193] |
Mon, 02 May 2005 12:19  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
For now you need to tell VE that font is something of interest. Try
using this:
private Font font = new Font("Dialog", Font.PLAIN, 12); //
@jve:decl-index=0:visual-constraint=""
(Note: It must be one line, if it looks wrapped above it is due to the
line being wrapped).
This should work.
--
Thanks,
Rich Kulp
|
|
|
Re: jLabel.setFont(font); [message #607308 is a reply to message #89222] |
Tue, 03 May 2005 02:59  |
Eclipse User |
|
|
|
Hello,
I tried it with the line you recommended but it didn't work. Although the
definition of the label and the annotation were in the same line.
If the variable font is a local variable then no exception will be caused.
Only if the variable is global then an exception will be caused.
Thanks
Elena
|
|
|
|
Powered by
FUDForum. Page generated in 0.04301 seconds