Skip to main content

Applet support

13 replies [Last post]
mortennobel
Offline
Joined: 2004-11-03
Points: 0

What are the status for applet support?

I think it is very weird, since the project is the closest Java has ever been to Flash.

The problem between applets and Scene Graph is that the second time a user opens the same Scene Graph applet, none of the Scene Graph events (from the animation package) are dispatched correct.

I think the problem is related to the class sharing in applets, so that the second time a applet is loaded, the Scene Graph's static fields is 'set up' for the first applet's resources (repaint manager and event dispatcher).

If my assumption is correct, a solution for the issue could be something like the code-snippet below. Please not that this does not work correct, but I still think that idea maybe could work.

Kind regards,
Morten

public class SwingGlueLayer{
...
private SwingGlueLayer() {
repaintManager = (repaintManagerClass != null)
? RepaintManagerRegister.createRepaintManager()
: null;
eventQueue = new SGEventQueue();

Runnable r =new Runnable() {
public void run() {
PopupFactory.setSharedInstance(new SGPopupFactory());
eventQueue.register();
}
};
if (SwingUtilities.isEventDispatchThread()){
r.run();
}
else{
try{
EventQueue.invokeAndWait(r);
}catch (Exception e){
// wait for execution
e.printStackTrace();
}
}
}

private static EventQueue currentEventQueue;
public static SwingGlueLayer getSwingGlueLayer() {
EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
if (eventQueue!=currentEventQueue){
instance = new SwingGlueLayer();
currentEventQueue = instance.eventQueue;
}
return instance;
}
...
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mortennobel
Offline
Joined: 2004-11-03
Points: 0

Hi Igor

Unfortunately I disagree. The bug still exists and has nothing to do with issue 6686436. My testcase don't actually use embedded components. It doesn't even use the JSGPanel - only the animation package.

I have rewritten a testcase without any listeners class and the bug still apears. The second time the applet is reloaded, the animation stops receiving events :-(

I have tried to solve the bug myself, but I have no clue why it occurs. And the bug is hard to debug, since the problem only exist in a real browser. In the applet viewer the problem does not occur.

Kind regards,

Morten

// testcase

public class AnimationTest extends JApplet {
public void init(){
Runnable r = new Runnable() {
public void run() {
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.setBackground(Color.WHITE);
JLabel label = new JLabel("Blinking text_2");
Clip clip2 = Clip.create(5000,Clip.INDEFINITE, label, "foreground",Color.white,Color.BLACK);
contentPane.add(label, BorderLayout.NORTH);
clip2.start();
}
};
SwingUtilities.invokeLater(r);
}
}

idk
Offline
Joined: 2005-01-12
Points: 0

Hi Morten,

> Unfortunately I disagree. The bug still exists and has nothing to do with issue 6686436. My testcase don't actually use embedded components. It doesn't even use the JSGPanel - only the animation package.

As I said my changes meant to resolve 6686436 [after applet reload mouse events are not delivered to an embedded component] only and have nothing to do with 6652576 [Applet animation problem when the page is reloaded].

In any case this animation problem should not take long to resolve. I will update this thread when it is done.

Thanks,
Igor

idk
Offline
Joined: 2005-01-12
Points: 0

Hi,

I checked in the fix for this bug into the repository (r231)

Thanks,
Igor

mortennobel
Offline
Joined: 2004-11-03
Points: 0

Hi Igor

It works much better now.

But I still have some problems that I think could be related.

I have used the last test-applet I posted in this thread.

Issue 1.
The applet plugin freezes and blocks the browser. This bug seems to happen if I reload applet two or three times within a second. The browser process must to shut down from the Task Manager.

Issue 2.
The bug 6652576 still appear, in about one 1 of 30 reloads.

I have created a thread dump of the situation.

Kind regards,
Morten

Java Plug-in 1.6.0_05
Using JRE version 1.6.0_05 Java HotSpot(TM) Client VM
User home directory = C:\Users\Morten

----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to
----------------------------------------------------

Dump thread stack ...
----------------------------------------------------
2008-04-14 21:19:33
Full thread dump Java HotSpot(TM) Client VM (10.0-b19 mixed mode, sharing):

"TimerQueue" daemon prio=6 tid=0x08f3ac00 nid=0xcf0 in Object.wait() [0x0349f000..0x0349fb00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at javax.swing.TimerQueue.run(Unknown Source)
- locked <0x23280068> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Unknown Source)

"ConsoleWriterThread" daemon prio=6 tid=0x08f3c800 nid=0xa8c in Object.wait() [0x08cdf000..0x08cdfb80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(Unknown Source)
- locked <0x23705220> (a java.lang.Object)

"AWT-EventQueue-1" prio=6 tid=0x08f3cc00 nid=0xdd8 waiting on condition [0x08adf000..0x08adfc00]
java.lang.Thread.State: RUNNABLE
at com.sun.deploy.util.ConsoleHelper.dumpAllStacksImpl(Native Method)
at com.sun.deploy.util.ConsoleHelper.dumpAllStacks(Unknown Source)
at sun.plugin.util.PluginConsoleController.dumpAllStacks(Unknown Source)
at com.sun.deploy.util.ConsoleWindow$2.actionPerformed(Unknown Source)
at javax.swing.JComponent$ActionStandin.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

"TimerQueue" daemon prio=6 tid=0x08f3f400 nid=0x818 in Object.wait() [0x08bdf000..0x08bdfc80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at javax.swing.TimerQueue.run(Unknown Source)
- locked <0x23885690> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Unknown Source)

"Thread-170" prio=6 tid=0x08f3d400 nid=0x5e0 runnable [0x00000000..0x0854f790]
java.lang.Thread.State: RUNNABLE

"AWT-EventQueue-85" prio=4 tid=0x08f3bc00 nid=0x16c0 in Object.wait() [0x09b0f000..0x09b0fa00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.awt.EventQueue.getNextEvent(Unknown Source)
- locked <0x237aec98> (a com.sun.scenario.scenegraph.SGEventQueue)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:447)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:467)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

"TimerQueue" daemon prio=4 tid=0x08f3b800 nid=0x119c in Object.wait() [0x0980f000..0x0980fa80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at javax.swing.TimerQueue.run(Unknown Source)
- locked <0x2374a200> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Unknown Source)

"thread applet-AnimationTest" prio=4 tid=0x08f40000 nid=0x1330 in Object.wait() [0x0990f000..0x0990fc00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at sun.applet.AppletPanel.getNextEvent(Unknown Source)
- locked <0x2374a278> (a sun.plugin.AppletViewer)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

"AWT-EventQueue-49" prio=4 tid=0x08f3c000 nid=0x1730 in Object.wait() [0x08e0f000..0x08e0fd80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.awt.EventQueue.getNextEvent(Unknown Source)
- locked <0x237364b0> (a com.sun.scenario.scenegraph.SGEventQueue)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:447)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:467)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

"AWT-EventQueue-0" prio=6 tid=0x08f58400 nid=0x1264 in Object.wait() [0x0940f000..0x0940fa80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.awt.EventQueue.getNextEvent(Unknown Source)
- locked <0x2369aba0> (a java.awt.EventQueue)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

"CacheCleanUpThread" daemon prio=6 tid=0x07cf0000 nid=0x11e4 in Object.wait() [0x0844f000..0x0844fb80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x236fb210> (a com.sun.deploy.cache.CleanupThread)
at java.lang.Object.wait(Object.java:485)
at com.sun.deploy.cache.CleanupThread.run(Unknown Source)
- locked <0x236fb210> (a com.sun.deploy.cache.CleanupThread)

"traceMsgQueueThread" daemon prio=6 tid=0x07ce5400 nid=0x1564 in Object.wait() [0x0834f000..0x0834fc00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x236bedb0> (a java.util.ArrayList)
at java.lang.Object.wait(Object.java:485)
at com.sun.deploy.util.Trace$TraceMsgQueueChecker.run(Unknown Source)
- locked <0x236bedb0> (a java.util.ArrayList)
at java.lang.Thread.run(Unknown Source)

"AWT-Windows" daemon prio=6 tid=0x07cda000 nid=0x13fc runnable [0x0824f000..0x0824fc80]
java.lang.Thread.State: RUNNABLE
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

"AWT-Shutdown" prio=6 tid=0x07cd9c00 nid=0xdb0 in Object.wait() [0x0814f000..0x0814fd00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at sun.awt.AWTAutoShutdown.run(Unknown Source)
- locked <0x236bd5c8> (a java.lang.Object)
at java.lang.Thread.run(Unknown Source)

"Java2D Disposer" daemon prio=10 tid=0x07cd8000 nid=0x1518 in Object.wait() [0x0804f000..0x0804fd80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <0x236bd658> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at sun.java2d.Disposer.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

"Low Memory Detector" daemon prio=6 tid=0x052ab800 nid=0x1184 runnable [0x00000000..0x00000000]
java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=10 tid=0x052a7800 nid=0x1238 waiting on condition [0x00000000..0x0799f7ac]
java.lang.Thread.State: RUNNABLE

"Attach Listener" daemon prio=10 tid=0x052a6c00 nid=0x1638 runnable [0x00000000..0x00000000]
java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=10 tid=0x0529e000 nid=0x6e0 runnable [0x00000000..0x00000000]
java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=0x05295400 nid=0x115c in Object.wait() [0x0769f000..0x0769fc80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <0x236bd8a8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

"Reference Handler" daemon prio=10 tid=0x05294400 nid=0x145c in Object.wait() [0x0759f000..0x0759fd00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
- locked <0x236bd480> (a java.lang.ref.Reference$Lock)

"main" prio=6 tid=0x01eba400 nid=0x1634 runnable [0x00000000..0x0012def8]
java.lang.Thread.State: RUNNABLE

"VM Thread" prio=10 tid=0x05293000 nid=0x1378 runnable

"VM Periodic Task Thread" prio=10 tid=0x052ac800 nid=0x1750 waiting on condition

0x0012def8]
java.lang.Thread.State: RUNNABLE

"VM Thread" prio=10 tid=0x05293000 nid=0x1378 runnable

"VM Periodic Task Thread" prio=10 tid=0x052ac800 nid=0x1750 waiting on condition

----------------------------------------------------
Done.

idk
Offline
Joined: 2005-01-12
Points: 0

Hi mortennobel,

Very interesting thread dump. How many scenario applets did you have running? I guess only one.

Thread dump however shows two AWT-EventQueues for scenario applets running at the same time:

"AWT-EventQueue-85" prio=4 tid=0x08f3bc00 nid=0x16c0 in Object.wait() [0x09b0f000..0x09b0fa00]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.awt.EventQueue.getNextEvent(Unknown Source)
- locked <0x237aec98> (a com.sun.scenario.scenegraph.SGEventQueue)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:447)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:467)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

"AWT-EventQueue-49" prio=4 tid=0x08f3c000 nid=0x1730 in Object.wait() [0x08e0f000..0x08e0fd80]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.awt.EventQueue.getNextEvent(Unknown Source)
- locked <0x237364b0> (a com.sun.scenario.scenegraph.SGEventQueue)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:447)
at com.sun.scenario.scenegraph.SGEventQueue.getNextEvent(SGEventQueue.java:467)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Here is what the problem scenario could be.
AWT-EventQueue-85 is for newer instance of reloaded applet.
AWT-EventQueue-49 is for older instance of reloaded applet and is about to quit.

The problem could be that scenario applet in AWT-EventQueue-49 keep clearing Scenario's swingGlueLayer and because of that animation in the current applet in AWT-EventQueue-85 does not work.

In any case it seems to me there should not be two AWT-EventQueues running for a reloaded applet at the same time ever. Let me ask some one from AWT team about this.

Thanks,
Igor

mortennobel
Offline
Joined: 2004-11-03
Points: 0

Hi Igor

Yes, I had one applet instance running, that had been reloaded many times.

Kind regards,
Morten

idk
Offline
Joined: 2005-01-12
Points: 0

Hi Morten,

Could you try if the problem is reproducible on 6u10?
( https://jdk6.dev.java.net/6u10ea.html )

Thanks,
Igor

mortennobel
Offline
Joined: 2004-11-03
Points: 0

Hi Igor

It works fine using the 6u10 ... But it does prints a few exceptions (See end of post).

I think the bug should be resolved on all 1.5 /1.6 versions (if possible).

I found a workaround to the problem ... but it's not pretty ;-) If I delay the animation start for 500 ms, I don't experience any problems. See source code below.

Kind regards,
Morten

________________ AnimationTest2 - workaround ___________________________
import com.sun.scenario.animation.Clip;
import javax.swing.*;
import java.awt.*;
public class AnimationTest2 extends JApplet {
public void init(){
final Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(new JSGPanel(),BorderLayout.CENTER);
contentPane.setBackground(Color.WHITE);
final JLabel label = new JLabel("Blinking text_6");
label.setForeground(Color.red);
contentPane.add(label, BorderLayout.NORTH);
Runnable r = new Runnable() {
public void run() {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Clip clip2 = Clip.create(1000,Clip.INDEFINITE, label, "foreground",Color.white,Color.BLACK);
clip2.start();
}
});
}
};
Thread t = new Thread(r);
t.start();
}
}

________________ Exceptions in 6u10 ___________________________
Exception in thread "TimerQueue" java.lang.IllegalThreadStateException: forbid thread creation in disposed TG
at sun.plugin.security.ActivatorSecurityManager.checkAccess(Unknown Source)
at java.lang.ThreadGroup.checkAccess(Unknown Source)
at java.lang.Thread.init(Unknown Source)
at java.lang.Thread.(Unknown Source)
at java.awt.EventDispatchThread.(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.EventQueue.initDispatchThread(Unknown Source)
at java.awt.EventQueue.postEventPrivate(Unknown Source)
at java.awt.EventQueue.postEvent(Unknown Source)
at java.awt.EventQueue.invokeLater(Unknown Source)
at javax.swing.SwingUtilities.invokeLater(Unknown Source)
at javax.swing.Timer.post(Unknown Source)
at javax.swing.TimerQueue.postExpiredTimers(Unknown Source)
at javax.swing.TimerQueue.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "AWT-EventQueue-4" java.lang.NullPointerException
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

etc.

idk
Offline
Joined: 2005-01-12
Points: 0

Hi,

I have started working on this problem Yesterday. It should not take long to resolve it.

Thanks,
Igor

idk
Offline
Joined: 2005-01-12
Points: 0

I checked in the fix for this problem into the repository (r226).

Thanks,
Igor

mortennobel
Offline
Joined: 2004-11-03
Points: 0

Hi Igor

The problem is not fully solved yet.

If you reload the applet while a clip is running, the new applet does not recieve any timing events.

Kind regards,
Morten

Example:

public class AnimationTest extends JApplet {
public void init(){
Color bgColorSrc = Color.white;
Color bgColorDest = Color.black;
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.setBackground(bgColorSrc);
Clip clip = Clip.create(5000,contentPane,"background",bgColorSrc,bgColorDest);
clip.setInterpolator(Interpolators.getLinearInstance());
contentPane.addMouseListener(new MouseTrigger(clip, MouseTriggerEvent.ENTER,true));
}
}

idk
Offline
Joined: 2005-01-12
Points: 0

Hi Morten,

There were two known problems in scenario related to applet reloading.
6652576 [Applet animation problem when the page is reloaded]
6686436 [after applet reload mouse events are not delivered to an embedded component]
(note: these bugids are not visible on bugs.sun.com.)

My changes resolved only the second issue.

Thanks,
Igor

Joshua Marinacci

Our goal is full applet support by javaone, so please keep reporting
bugs like this. Thanks!
Josh

On Apr 10, 2008, at 7:28 AM, scenario@javadesktop.org wrote:

> What are the status for applet support?
>
> I think it is very weird, since the project is the closest Java has
> ever been to Flash.
>
> The problem between applets and Scene Graph is that the second time
> a user opens the same Scene Graph applet, none of the Scene Graph
> events (from the animation package) are dispatched correct.
>
> I think the problem is related to the class sharing in applets, so
> that the second time a applet is loaded, the Scene Graph's static
> fields is 'set up' for the first applet's resources (repaint manager
> and event dispatcher).
>
> If my assumption is correct, a solution for the issue could be
> something like the code-snippet below. Please not that this does not
> work correct, but I still think that idea maybe could work.
>
> Kind regards,
> Morten
>
> public class SwingGlueLayer{
> ...
> private SwingGlueLayer() {
> repaintManager = (repaintManagerClass != null)
> ? RepaintManagerRegister.createRepaintManager()
> : null;
> eventQueue = new SGEventQueue();
>
> Runnable r =new Runnable() {
> public void run() {
> PopupFactory.setSharedInstance(new SGPopupFactory());
> eventQueue.register();
> }
> };
> if (SwingUtilities.isEventDispatchThread()){
> r.run();
> }
> else{
> try{
> EventQueue.invokeAndWait(r);
> }catch (Exception e){
> // wait for execution
> e.printStackTrace();
> }
> }
> }
>
> private static EventQueue currentEventQueue;
> public static SwingGlueLayer getSwingGlueLayer() {
> EventQueue eventQueue =
> Toolkit.getDefaultToolkit().getSystemEventQueue();
> if (eventQueue!=currentEventQueue){
> instance = new SwingGlueLayer();
> currentEventQueue = instance.eventQueue;
> }
> return instance;
> }
> ...
> }
> [Message sent by forum member 'mortennobel' (mortennobel)]
>
> http://forums.java.net/jive/thread.jspa?messageID=268562
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>

Joshua Marinacci, Sun Engineer
http://weblogs.java.net/blog/joshy/
http://joshy.org/
joshua@marinacci.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net