Hi,
I try to use JLayeredPane to display a JButton above JWebBrowser,but the JButton always below the JWebBrowser.
And I have found the link:http://stackoverflow.com/questions/6627979/component-overlaping-in-jlayeredpane
which tells to use " new JWebBrowser(JWebBrowser.constrainVisibility());",but I get error below:
on in thread "AWT-EventQueue-0" java.lang.IllegalStateException: The JNA libraries are required to use the visibility constraints!
at chrriis.dj.nativeswing.NativeComponentWrapper.createEmbeddableComponent(NativeComponentWrapper.java:201)
at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent.createEmbeddableComponent(SWTNativeComponent.java:1164)
at chrriis.dj.nativeswing.swtimpl.components.core.NativeWebBrowser.createEmbeddableComponent(NativeWebBrowser.java:1187)
at chrriis.dj.nativeswing.swtimpl.components.JWebBrowser.(JWebBrowser.java:191)
at chrriis.dj.nativeswing.swtimpl.components.JFlashPlayer.(JFlashPlayer.java:237)
My jna is jna-3.2.4.jar, which comes from the download DJNativeSwing package.
If I run the demo "ConstrainVisibility.java", I get the same error too.
Is there someone knows how to make the JWebBrowser do not show at the top layer ???
Hi,
There are 2 libraries that are needed, both shipped in the distribution:
Are you sure you have both libraries in your classpath?
-Christopher
Hi,
The problem solved with your advice.
I used to only import one of them. :P
Thank you so much!!!
Hi
When I run the demo "ConstrainVisibility.java" on Ubuntu, the swing button can cover the JWebBrowser successfully, but on Mac, the JWebBrowser still on the top layer, it covers the swing button.
My environment list below:
Mac os X:
10.7.5
java -version:
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11G63)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
DJ Native Swing:
DJNativeSwing-SWT-1-0-2-20120308
SWT:
swt-4.2.1-cocoa-macosx-x86_64
jna:
jna-3.2.4.jar and jna_WindowUtils.jar
Please help me, I need it works on Mac.
To be honest, I hate Mac because the JRE has lots of unexpected behaviors: things never work as expected.
This feature would require hiding the native area which is covered by applying a clip composed of a collection of rectangles: this does not work on the Mac.
In Java 6, there is an API that allows applying a clip to components. I could use that API to apply a non-rectangular clip and achieve the desired effect of overlapping components. Unfortunately, this API is considered not mandatory and was not implemented on Mac. In fact, the new lightweight/heavyweight mixing that Sun implemented in Java 6 uses that internal API and does not work on Mac.
We would think that maybe this is implemented on Java 7, but unfortunately, Java 7 integration of SWT native components does not work due to limitations in the JRE. They know about it but I don't think they have done any work on it yet.
Hope this helps,
-Christopher
Hi,
I have found that if I use AWT Button instead of swing JButton, the button can cover the JWebBrowser successfully, but there is still a problem I can't fix:
What I want to do is to dispaly google map in JWebBrowser, If I set this HTML to browser:
and go to the map page, the button can still cover the map, but if I call the google map api directly:
the AWT Button will be covered by the JWebBrowser.
I don't know why this happens, Is there some features in google map api lead to this problem? Do you have some idea about how to add a button above the google map which loaded by JWebBrowser?
Last edit: ritter 2012-11-16
Mac mixing is messed up and the AWT and SWT teams are working on it. Until they resolve it we are a bit stuck...
-Christopher