Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4074958

Toolkit.getScreenResolution() doesn't return right resolution on Win95.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 1.1.1, 1.1.5
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_95

      Description



      Name: tb29552 Date: 08/27/97


      company - Battelle PNNL , email - ###@###.###
      On my windows 95 box, the call of

      ToolKit tk = Toolkit.getDefaultToolKit();
      int dpi = tk.getScreenResolution();
      System.out.println("Screen Resolution in dpi is " + dpi);

      always returns 120 dpi. This result is always 120 , even though
      I may be running windows at 72 or 96 dpi.

      I have run the program on a Sun machine and I get the correct results there,
      so I suspect this may be a Win 95 bug, or may be something to do
      with my hardware device drivers. Any clues ?

      ======================================================================
      daniel.indrigo@Canada 1998-01-15


      The Toolkit.getScreenResolution doesn't work correctly. It returns hardcoded values for the screen resolution based on the use of small or large fonts, rather than calling the GetDeviceCaps function in the Win32 API. Please fix this in the next release because it greatly complicates the ability to draw anything to scale on the display and the printer. The hardcoded values are 96 for any resolution using small fonts, and 120 for any resolution using large fonts. This means that 1600x1280 resolution (configured with small fonts) is less than 640x480 resolution (configured with large fonts). It also means that the same resolution is different when using large fonts vs small. Fonts have nothing to do with screen resolution. This issue is complicated by the fact that the point sizes used for creating fonts use the true resolution - which can't be determined.

      To verify this try the following with small and large font configurations in any resolution:

      System.out.println( "Resolution: " +
        Toolkit.getDefaultToolkit().getScreenResolution() );

      You can use the following code from the Win32 API to solve the problem in AWT:

      dpi = GetDeviceCaps( myDC, LOGPIXELSX );

      Please fix it. You are probably already using it in PrintJob.getResolution().

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rraysunw Richard Ray (Inactive)
              Reporter:
              tbell Tim Bell
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: