Can anyone find me the way of getting screen size and make the Applet view full screened. I supposed to say that, I want to make a applet which will be used in a web page and the applet will be screen sized of user machine.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Can anyone find me the way of getting screen size and make the Applet view full screened. I supposed to say that, I want to make a applet which will be used in a web page and the applet will be screen sized of user machine.
An applet is embedded within a web browser, and thus by definition cannot be made screen size. If you actually mean screen size, use a Webstart app. If you mean browser size, this can change based upon what the user does so you may need to try to have your applet communicate with javascript.
anm_brr (October 22nd, 2010)
Here is the code to make Applet's size always equals to browser size.
<script type="text/javascript"> window.onresize = doResize; function doResize() { if (navigator.appName == "Netscape") { document.OptionsWindowApplet.width = window.innerWidth; document.OptionsWindowApplet.height = window.innerHeight; } if (navigator.appName.indexOf("Microsoft") != -1) { document.OptionsWindowApplet.width = document.documentElement.clientWidth; document.OptionsWindowApplet.height = document.documentElement.clientHeight; } } </script>
Where OptionsWindowApplet is your Applet name/id defined by <object /> tag or <applet /> tag.
immutable objects
Last edited by ha.minh.nam; December 4th, 2011 at 07:26 PM.