Can java applet be as big as the browser window

  • Context: Java 
  • Thread starter Thread starter Ulysees
  • Start date Start date
  • Tags Tags
    Java Window
Click For Summary
SUMMARY

The discussion centers on the feasibility of resizing a Java applet to match the browser window dimensions. Users can achieve this by setting the applet's HTML tag width and height to 100%. Additionally, dynamically generating the applet's tag using JavaScript allows for real-time adjustments based on window size changes. For full-screen execution, utilizing Java's appletviewer program is recommended as a more efficient alternative.

PREREQUISITES
  • Understanding of HTML applet tags
  • Basic knowledge of Java programming
  • Familiarity with JavaScript for dynamic content manipulation
  • Experience with browser resizing events
NEXT STEPS
  • Research how to implement Java applet resizing using CSS
  • Learn about JavaScript's window.onresize event for dynamic adjustments
  • Explore the capabilities of Java's appletviewer program for full-screen applications
  • Investigate best practices for embedding Java applets in modern web applications
USEFUL FOR

Web developers, Java programmers, and educators looking to enhance interactive content in web applications will benefit from this discussion.

Ulysees
Messages
515
Reaction score
0
Here's a java applet that shows the electric field of a moving charge (it's actually incorrect, it only gives a rough idea how motion and acceleration affect electric field).

http://www.cco.caltech.edu/~phys1/java/phys1/MovingCharge/MovingCharge.html

Can a java applet like this be the same size as the browser window at all times?
 
Technology news on Phys.org
It might be a little tricky to get resizing working properly, but yes, it should be possible. If you intend to run it full-screen, though, you might as well run it with Java's appletviewer program instead.

- Warren
 
Try using 100% for the width and height on the applet's html tag.

It's also possible to dynamically write a Java applet's tag onto the page using Javascript. So you can obtain the window dimensions in javascript, and then write the applet's tag with the appropriate width/height (you'd need to update the dimensions on page resize, using onresize) - not ideal but it's an option.
 
Last edited:

Similar threads

  • · Replies 8 ·
Replies
8
Views
12K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 34 ·
2
Replies
34
Views
55K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K