Closed Bug 266596 Opened 20 years ago Closed 13 years ago

Java Applet resize: cannot enlarge (or shrink sometimes); ("native" panel is fixed size).

Categories

(Core Graveyard :: Java: Live Connect, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: zen, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Epiphany/1.2.9
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)

1. Go to above URL
2. click "Pool" or "Play Pool Now" or the 1/4 pool table image
3. login if needed
4. enter a pool room
5. try to resize the window that pops up

On MSIE (windows), the applet inside this popped up window expands as one would
expect. In Geko (GNU/Linux) it does not expand.

I have tested this in Mozilla, Firefox and Epiphany and all have the same problem.

The Applet(s) otherwise work for me, including my own, thanks to my installation
of Blackdown J2SDK1.4.2.

There is some example code to create resizable applets that I googled for and
found here:

http://www.javaworld.com/javaworld/javatips/jw-javatip80.html
http://blog.taragana.com/index.php?p=10

Although at least for Firefox I had to add the following code to my applet (but
only on Geko (GNU/Linux)) to make it resize:

   private int initialw;
   private int initialh;

   public void setBounds (int x, int y, int w, int h) {
      if (initialw == 0 || initialh == 0) {
         initialw = w;
         initialh = h;
      } else if (w == initialw && h == initialh) return;
      super.setBounds(x, y, w, h);
      validate();
   }

Resizing applets seems to work on MSIE. I didn't test on Geko on Windows.

Javascript errors saying something like "could not find resize() method" suggest
that the LiveConnect binding has a bug or three.

Additionally, the incoming calls to setBounds() evidently occur in a thread
other than the Event Dispatch Thread. This concerns me, since I'm using a
JApplet, and my understanding is that no swing stuff should occur, except inside
the event dispatch thread, checked with
javax.swing.SwingUtilities.isEventDispatchThread().

If there is a consistent way to resize applets within Geko/Mozilla browsers, I'd
love to know...
---


Reproducible: Always
Steps to Reproduce:
See steps above.
---
Actual Results:  

Of note: in my own example applet, with the added setBounds code above, and
using a .html file as found at the two applet-resizing-URLs as also listed
above, I manage to resize my applets. Based on my debug messages, it is clear
that for each resize, three resize messages (method calls) come in to my applet
- the first with the new applet bounds (not in the AWT event dispatch thread),
the second and third in the event dispatch thread, but with the applets original
bounds from when the browser first started it. This is clearly a bug in whatever
is calling applet.setSize or applet.setBounds - or in the event mechanism. I
wouldn't know if that is JDK specific or somehow related to LiveConnect.

I can resize these applets of mine, and if I resize them smaller, it kind of
works (with the Java hack code I pasted above), but if I try to resize the
applet larger than it's initial size, it's paint region is clipped to the
original size (but the applet's layed out components are apparently at the
correct size).

This is reminiscent of Java's AWT components which are each backed by a "native"
or "window system" level "window" component - justifiably labelled as heavy
weight components (as in very heavyweight!). In this case, it seems that
Moz/FF/Epiphany have created some graphics rendering "context" or "window"
within which the applet is contained, and even though applet resize events
arrive at the applet, this containing "window" is not resized.
---

Expected Results:  
Applets need to be able to be resized. Either with established mechanisms, or
using some new mechanism. Anything will do if I can find out how...

Feel free to email me for further information and/ or testing.
it works for me using mozilla 1.7/jre 1.5.0_01 on Solaris. can you try it again
using the most recent mozilla/firefox and jre builds?
Probable dupes:
Bug 112428 java applet view does not get redrawn correctly
Bug 132978 Mozilla window shows trash when rescaling fullsize applet
Bug 148958 applet won't resize
Bug 190759 applet is not resizing after a window resize operation
Bug 266596 Java Applet resize: cannot enlarge (or shrink sometimes); ("native"
panel is fixed size).
Bug 300346 Redraw errors after resizing a window containing an applet with 100%
width and height
Product: Core → Core Graveyard
Firefox code moved from custom Liveconnect code to the NPAPI/NPRuntime bridge a while back. Mass-closing the bugs in the liveconnect component which are likely invalid. If you believe that this bug is still relevant to modern versions of Firefox, please reopen it and move it the "Core" product, component "Plug-Ins".
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.