I am doing a project in c++ where I need to embed a java applet/java program.( like we usually see on webpages). I was wondering what is the easiest way to do this. Right now, I am using Qt designer. Thanks.
If you use QWebPage in your application you can load a url that has the JApplet embedded.
Edit:
You may not have JRE installed on the target machine if it's not loading the applet. If you do something like below it should spit out a message if something goes wrong with Java. This is just an untested example to give you the basic idea of what I meant.
An example webpage:
<html>
<head>
<title>Java Applet</title>
</head>
<body>
<applet code="YourApplet.class" width=400 height=400>Java not supported or not installed</applet>
</body>
</html>
Save this as MyPageName.html
A simplistic example of using this in Qt:
// the QWebView has a QWebFrame and QWebPage to make it easy
QWebView* webView = new QWebView(parentWidget); // MainWindow or whatever as parent
webView->load(QUrl("MyPageName.html")); // local page or valid URL
webView->show();
Hope that helps a bit more
In version 4.8 of Qt, java applets are not supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With