Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Java Applets, Web Browser Zoom and DPI settings  (Read 566 times)
0 Members and 2 Guests are viewing this topic.
Offline zeroone

Sr. Member
**

Posts: 295
Medals: 10



« on: 2012-02-05 17:53:36 »

If you zoom into a webpage containing an applet, you'll discover that the applet does not scale.  It remains the same size and a solid-colored rectangle will appear around it. 

Unfortunately, fewer people have their browser set to 100% zoom any more.  It's a consequence of larger monitors and higher native resolutions.  Everything will appear tiny unless you adjust the DPI settings and if you increase DPI, you'll also have to increase the zoom level in web browsers to compensate.

Is there anything we can do within the applet or within the page containing the applet to scale the applet size appropriately based on zoom and DPI settings? 
Offline SimonH

JGO Strike Force
***

Posts: 896
Medals: 14



« Reply #1 on: 2012-02-05 19:36:53 »

Good question!
Opera is particularly bad as by default it has a zoom slider on the status bar.
I once accidentally set it to 101% zoom and it took me ages to find out why the applet was not displaying properly in opera.

BTW I just checked how flash dealt with the opera zoom - it scaled flawlessly, but when I closed opera the flash soundtrack carried on to the end even though opera had closed. Huh, what's new - opera sux.

Stickmen Wars 2 is in development.
Meanwhile try Bloodridge
Online kappa
« League of Dukes »

JGO Kernel
*****

Posts: 2360
Medals: 59


★★★★★


« Reply #2 on: 2012-02-05 19:50:28 »

IIRC once zoomed, the getWidth() and getHeight() of the Applet container should reflect the new size, thus allowing you to use the new values to resize your game.
Games published by our own members! Go get 'em!
Offline ra4king

JGO Kernel
*****

Posts: 3155
Medals: 196


I'm the King!


« Reply #3 on: 2012-02-05 22:03:50 »

Once zoomed, it should also throw a ResizedEvent, which you can process with a ComponentListener.

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.088 seconds with 19 queries.