tags:

views:

192

answers:

1

Is there a way to set DPI in swing ? For the whole application ? And if there is how do I set it to the value of system DPI ? I guess there must be a way to do it as I mentioned this feature must have benn added to NetBeans in some of latest versions...

Thank you for reading

+2  A: 

I think it would depend on the Look and Feel you're using.

As far as I know Substance LAF honors the current desktop DPI settings.

Here is some related info https://pushingpixels.dev.java.net/files/documents/7463/95862/dpi-bof.pdf

eugener
Can you please suggest some code that would show how Substance LAF is used ? I've read something about it and it seems that Substance LAF may look like system Look and Feel - that is what I'm trying to do. I would like my swing application to look and behave exactly like native application written for OS including DPI settings.
drasto
Unfortunately Substance cannot be made to look like native application. You have use UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()). This will set system look and feel for OS you are running. Most of these LAFs do not guarantee correct work under different DPI settings.
eugener
But that Substance LAF look a lot like native OS or am I wrong ? I have just seen some screenshots...
drasto
Not really. It is LAF with custom drawn themes. It has no dependency on OS.
eugener
OK than :( . Do you know about a way to set DPI of some system LAF manually(I mean programatically?). Can I modify LAF classes(inherit from them) so that I can set DPI of that LAF ? Or can I wrap the whole LAF into some custom LAF that will allow to set DPI?
drasto
I don't think it is possible. You can set DPI on your OS and hope that system LAF will pick it up, but I don't think you can set it for the application.
eugener