|
Re: should I dispose of a font when... [message #448147 is a reply to message #448028] |
Mon, 03 January 2005 18:21 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Yes you should. You created the font so you need to dispose of it when
no longer needed.
Liam Morley wrote:
> So far, I've been assigning a value to a font and disposing of the font
> when I dispose of the parent object. However, I'm about to change the
> font while the object is still around- should I dispose of the old font
> before reassigning the new font?
>
> For example, in the following basic class structure, should I call
> "font.dispose()" in the changeFont method?
>
> MyClass {
> private Font font;
> public MyClass() {
> Font font = ...;
> }
>
> public void changeFont(FontData fd) {
> // should I call font.dispose() here?
> font = new Font(null, fd);
> }
>
> protected void widgetDisposed() {
> // called from dispose listener
> font.dispose();
> }
> }
>
> Many thanks.
>
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.03978 seconds