KJavaAppletWidget Class Reference
A widget for displaying Java applets. More...
#include <kjavaappletwidget.h>
Inheritance diagram for KJavaAppletWidget:


Public Member Functions | |
KJavaAppletWidget (QWidget *parent=0, const char *name=0) | |
KJavaApplet * | applet () |
void | showApplet () |
QSize | sizeHint () const |
void | resize (int, int) |
Protected Slots | |
void | setWindow (WId w) |
Protected Member Functions | |
void | showEvent (QShowEvent *) |
Static Protected Attributes | |
static int | appletCount = 0 |
Detailed Description
A widget for displaying Java applets.KJavaAppletWidget provides support for the inclusion of Java applets in Qt and KDE applications. To create an applet, you must first create a context object in which it will run. There can be several applets and contexts in operation at a given time, for example in a web browser there would be one context object for each web page. Applets in the same context can communicate with each other, applets in different contexts cannot. Once you have created a KJavaAppletContext, you can create as many applets in it as you want.
Once you have created the applet widget, you should access the applet() method to call the various setXXX methods to configure the applet, They correspond to the HTML tags used to embed applets in a web page. Once the applet is configured, call the create() method to set things in motion. The applet is running when it first appears, but you can start or stop it when you like (for example if it scrolls off the screen).
This widget works by using the KJavaAppletServer, which fires off a Java server process with which it communicates using the KDE Java Applet Server (KJAS) protocol over stdin and stdout. The applet windows are swallowed and attached to the QWidget, but they are actually running in a different process. This has the advantage of robustness and reusability. The details of the communication are hidden from the user in the KJASAppletServer class. Normally only a single server process is used for all of the applets in a given application, this is all sorted automatically. The KJAS server is 100% pure Java, and should also prove useful for people wishing to add java support to other systems (for example a perl/Tk binding is perfectly feasible). All you need to do is implement the protocol and (optionally) swallow the applet windows.
The applet support in KDE is still dependent on the KWin Window Manager. The applet swallowing will not work under other Window Managers. Hopefully this will be fixed in the future.
For a description of the KJAS protocol, please see the KJAS_GRAMMAR.txt file.
- Author:
- Richard J. Moore, rich@kde.org
Wynn Wilkes, wynnw@caldera.com
Definition at line 78 of file kjavaappletwidget.h.
Member Function Documentation
|
Returns a pointer to the KJavaApplet. Use this to configure the applet's parameters. You can also use it to start and stop the Applet. Definition at line 91 of file kjavaappletwidget.h. |
|
Tells the AppletServer to create, initialize, and show the Applet.
Definition at line 67 of file kjavaappletwidget.cpp. References KJavaApplet::create(), KJavaApplet::isCreated(), and setWindow(). |
|
This slot is called by KWin when new windows are added. We check to see if the window has the title we set. If so we embed it. Definition at line 79 of file kjavaappletwidget.cpp. References QXEmbed::embed(), endl(), kdDebug(), and QWidget::setFocus(). Referenced by showApplet(). |
The documentation for this class was generated from the following files: