Kbase 17644: Apptivity - Change in screen resolution changes applet size
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
Apptivity - Change in screen resolution changes applet size
The following describes how screen resolution affects
applet size and ways in which HTML for an applet can
be written to size the applet as a percentage of the
browser window size or screen size, regardless of the
resolution being used on the client machine.
The size of an applet in the HTML code which Apptivity
generates is specified in pixels. So if the applet is
600x400 it will just about fill the entire screen if the
resolution is 640x480. If you change the resolution to
800x600 and run the same applet, the space occupied is
approximately 2/3 of the screen. Up the resolution
to 1024x768 and the space occupied is now a little over
1/2 of the screen size. The changes in applet size are
reflected by the mathematics of pixels and screen
resolution.
This is a general problem in any application (not just
Netscape, or Apptivity, or java) that combines absolute
pixel measurements with text specified in point sizes.
This problem is not specific to Apptivity generated
applets that use pixels in HTML to specify applet size.
While pixels will vary with the resolution of the monitor,
fonts that are specified in "pts" (points) will not
necessarily scale the same way. This is because points
are a measure of characters per inch (approximately)
and has very little to do with pixels.
SIZING AN APPLET BASED ON PERCENTAGE OF BROWSER WINDOW SIZE
You can make the APPLET occupy a certain percentage of
the browser window using the following HTML syntax:
WIDTH = "50%" HEIGHT="25%"
SIZING AN APPLET BASED ON PERCENTAGE OF SCREEN SIZE
If you want to size to a percent of the SCREEN size, you
can do that too. For example:
<HTML>
<HEAD>
</HEAD>
<BODY>
<center>
<BR><B>Applet sized explicitly to a number of pixels</B><BR>
<APPLET CODE="notthere" WIDTH=320 HEIGHT=100>
</APPLET>
<br>
<BR><B>Applet sized to 50%x25% of the Browser Window</B><BR>
<APPLET CODE="notthere" WIDTH="50%" HEIGHT="25%">
</APPLET>
<br>
<BR><B>Applet sized to 50%x25% of the screen size</B><BR>
<SCRIPT LANGUAGE="JavaScript">
// Proportionally size the Applet to 50%x25% of the screen
// size
// NOTE that only newer browsers support the "screen" object
if (screen == null) document.write ('<APPLET CODE="notthere"
WIDTH=320 HEIGHT=100>');
else {
window.alert ("Sizing to: " + (screen.width / 2) + " by
" + (screen.height / 4) + ".");
var appletTag =
'<APPLET CODE="notthere3" WIDTH="' + (screen.width / 2) +
'" HEIGHT="' + (screen.height / 4) + '">';
document.writeln(appletTag);
}
</SCRIPT>
</APPLET>
</center>
</BODY>
</HTML>
Note: Sample HTML is for illustrative purposes only and is not
guaranteed to be supported by all browsers. If you plan to code
your HTML as noted above, it is recommended that you test your
applet explicitly with all the browsers you wish to support.
UTF: 2 Feb 1998
Progress Software Technical Support Note # 17644