Skip to main content

Swing team reveals their secrets !

Posted by alexfromsun on April 1, 2006 at 12:00 AM PST

Everybody knows that Swing and AWT behaviour can be changed with command line properties,
for example you may set the desirable Look and Feel with help of the following command line property


see here for
more info
, e.g. the following command:

java <YourApp>

allows you to have the Windows LaF to be set for your application by default;
or let's take the


which switches your application to a mysterious headless mode (don't try it at home, by the way)

But the same time it is not widely known that Swing has much more exciting undocumented properties, and even Swing team members are not
aware of the complete list of them.

You might spend a lot of time implementing a feature, and after that bump into the property wich can solve the problem straight away

Remember the famous grayrect improvement which is implemented for Mustang?

It turned out that the the only thing you should do to solve the problem is set the


from Gray (it was the default value) to Transparent, with:

java -Dswing.grayrect.color=Transparent

your will never see the gray rect and what is the most interesting
that it works even for java 1.1 !

if you don't like the grayrect to be transparent, you can fill it with you favourite color,
for instance

turns the boring grayrect to a beautiful Violet !

Here the list of additional properties, with valid values which are devided with | symbol, the default value marked with asterisk:


Make the Swing two times faster


This one is in progress, AWT team doubts that we really need it

swing.bugsnumber=ALOT | MEDIUM | AFEW* | NONE

NONE value is not completely tested yet,
so I don't recommend trying it out

java2d.speedofpainting=LOW | MEDIUM | FAST* | UNIMAGINABLE

If you set UNIMAGINABLE value for this property the Swing components will be painted so fast that it will hardly be possible to notice them

I am absolutely sure that there are more properties to be added in this list,
so if you know any ones which are not mentioned here, please let me know !

Related Topics >>