Swing team reveals their secrets !
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
swing.defaultlaf
see here for
more info, e.g. the following command:
java -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel <YourApp>
allows you to have the Windows LaF to be set for your application by default;
or let's take the
java.awt.headless
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
swing.grayrect.color
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
swing.grayrect.color=Violet
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:
swing.runtwiceasfast=true*|false
Make the Swing two times faster
swing.completeleremoveawt=true|false*
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 !
- Login or register to post comments
- Printer-friendly version
- alexfromsun's blog
- 2927 reads





