Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » SWT Font handling in VE
SWT Font handling in VE [message #611307] Wed, 09 November 2005 09:25
Thomas Mauch is currently offline Thomas MauchFriend
Messages: 8
Registered: July 2009
Junior Member
I try to create a visual class based on a composite with VE. If I set
the font a control, a line like

button.setFont(new Font(Display.getDefault(), "Tahoma", 14, SWT.NORMAL));

is inserted by VE. Now as I have learnt, SWT fonts must be disposed
after use. Do I have to do this manullay or how is it supposed to work?

If I change the font of another control to the same font, a duplicate of
the line shown is inserted. So two fonts get created, where one would be
enough. As far as I understand, each construction of a SWT Font will use
valuable OS resources...

So I tried to declare a variable holding the font used for several controls:

Font font = new Font(Display.getDefault(), "Tahoma", 16, SWT.NORMAL);

As long this variable is local to the initialize() method, everything
works fine. If I try to make a instance field variable, however it does
not work any longer. A warning icon in the VE tells me:

font: java.lang.IllegalAccessException(Class
org.eclipse.jem.internal.proxy.initParser.tree.ExpressionPro cesser can
not access a member of class org.eclipse.swt.graphics.Font with
modifiers "")

When browsing the newsgroup, I found a message referring to bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=93533
but this bug is fixed and closed. I tried as well to add
@jve:decl-index=0:visual-constraint="" to the declaration, but this did
not help either.

So what do you think? What is the concept for disposing fonts created by
VE? Any thoughts about supportingthe JFace FontRegistry for this?

Thomas
Previous Topic:MoreSwingComponents fails 3.2M2
Next Topic:Moving legacy SWT classes to VE
Goto Forum:
  


Current Time: Fri Apr 26 22:58:57 GMT 2024

Powered by FUDForum. Page generated in 0.03104 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top