Results 1 to 6 of 6
  1. #1
    rolfius is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Question Avoid using systems DPI settings ?

    Hello

    Im building a Java Application, and i using the following to set the "visual settings":

    javax.swing.UIManager.setLookAndFeel(javax.swing.U IManager.
    getSystemLookAndFeelClassName());

    My question is: How do i ignore the systems DPI font setting, or get around the problem in some way. ?

    Thanks

    / Rolf

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Is this a Linux related question? I saw some posts in other forums having to do with setting screen properties...

  3. #3
    rolfius is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default

    No, this in a Windows question, sry for not revealing that earlier :rolleyes:.

    / Rolf

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I know just enough to be dangerous; hopefully, someone who is an expert in this area will jump in.

    Swing sits on top of AWT, which works directly with the underlying OS. As far as overriding system settings, such as DPI, I don't know of any way of doing that. In general, Java tries to get along with the OS; it's definitely not something to use if you want to get around the OS.

    AFAIK, the Windows DPI setting is generally there to scale fonts for screens with high pixels per inch, so that everything is not tiny. What sort of problems are you having? There is a system property, "swing.aatext=true", that turns on anti-aliasing, and that helps immensely in keeping fonts from pixelating...

  5. #5
    rolfius is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default

    Okej, thanks for the reply.

    My problem is, when i run my Java application on a computer with higher DPI setting then default, my textfield, labels and so on also increases, not only the font size. So the application looks "ugly" and the components are not well organised on the GUI. And the labels och textfield "comes over" each other.

    Maybe there is some other solution to this problem, some settings on components, or something else ?

    Thanks

    /Rolf

  6. #6
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I have found that using anything except the "normal" setting can lead to problems for certain programs, not just Java. I think the programs have to be aware of the dpi setting and take it into account, and not all of them do that. I understand why M$ did what they did, but they seem to have taken short cuts in doing it.
    My only question is whether you are allowing Swing to lay out the screen by using a layout manager that adjusts UI component size automatically, or if you are using "null", which leads to absolute positioning. Absolute positioning is easier to get started with, but it is sensitive to how the font is drawn, which can vary. Personally, I tend to use GridBagLayout the most, because it provides a great deal of flexibility.

Similar Threads

  1. Replies: 0
    Last Post: 05-31-2009, 07:11 AM
  2. how to run chat application on multiple systems
    By jayeth in forum Advanced Java
    Replies: 4
    Last Post: 03-27-2009, 03:25 PM
  3. how to avoid input errors?
    By Sinnergy in forum New To Java
    Replies: 5
    Last Post: 02-02-2009, 11:25 PM
  4. Replies: 3
    Last Post: 06-22-2008, 07:25 PM
  5. wikis systems
    By Peter in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 07:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •