oktober 15, 2010

Global font size

This is a really nice trick. I usually think that the font size of a Netbeans RCP application is too big. Even if it's possible to change the font size on swing components the over all user interface can't be changed from there.

So this is a trick I have been using for some time but always forget where to put it and the syntax.. So here it is.. To change the global font size setting just add the following line to project.properties (I always put it in both the suite and my modules)


run.args.extra=--fontsize 11

And voila.. the global font size is much better now.

Now you are happy.. you finally have changed that fontsize problem! Let's build the JNLP application and deploy it on the server! 5 minutes later you stand at your boss desk.. cleaning the jnlp java cache just to be sure that everything works! So the application launches.. Nice splash screen showing.. and eeehh.. what? the font size is still to big? Damn Nicklas!!! lying about this stuff in his blog!!!!!

So.. this doesn't seem to work when running the application as a webstart application.. you actually need to add two more lines in that case.. In your suite open the JNLP Descriptor that can be found in the Important Files folder. Look for this part:

  <application-desc>
        <argument>--branding</argument>
        <argument>${branding.token}></argument>
    </application-desc>

This is the part of the jnlp file that sends extra argument to java when the application is started. So we need to add two lines so it looks like this:

<application-desc>
        <argument>--branding</argument>
        <argument>${branding.token}</argument>
        <argument>--fontsize</argument>
        <argument>11</argument>
    </application-desc>

[sourcecode language="xml"] [/sourcecode]

And voila.. now you can walk to your boss desk again and show the application.. (but remember to clear the java cache first.. you never know...)