Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using java applet in c++ program

Tags:

java

c++

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.

like image 481
nate Avatar asked Jul 26 '26 22:07

nate


2 Answers

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

like image 182
AJG85 Avatar answered Jul 29 '26 12:07

AJG85


In version 4.8 of Qt, java applets are not supported.

like image 36
Rodrigo Avatar answered Jul 29 '26 10:07

Rodrigo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!