aspose file tools*
The moose likes Applets and the fly likes build applet from existing application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "build applet from existing application " Watch "build applet from existing application " New topic
Author

build applet from existing application

liana lim
Greenhorn

Joined: Oct 12, 2008
Posts: 8
i already have a small application using JFrame. How to turn it into a Applet??

I already make some applet code, that code work in applet viewer but not in a browser. It say applet started, but thre's nothing just a gray box. I think My browser is ok, because it can open other applet.
Is there something wrong??? please help

Here is the applet code to call NewJFrame.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
Hello "liana liana"-

Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

As to your question, applets work a bit different than applications. For starters, what you might try is to replace these two lines:

by

Assuming that NewJFrame extends JFrame, there's no need for the "a" JFrame. You also can't add a JFrame (which is a window) to the content pane of another window.

This will open a new window, though. Is that what you want? If not, then you should refactor the code to put whatever goes into NewJFrame (most likely some JComponents) to go in the content pane of the JApplet.


Ping & DNS - my free Android networking tools app
liana lim
Greenhorn

Joined: Oct 12, 2008
Posts: 8
is there other way to make my java application run on web??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
Java Web Start would be another option.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
"but thre's nothing just a gray box. "
Is there anything in the browser's java console?
Copy and paste it here.
liana lim
Greenhorn

Joined: Oct 12, 2008
Posts: 8
i already fix my problem.
not use jframe, i call panel from the applet and it works
thanks anyway
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
[ UD: Please do not post unrelated questions into existing topics. That's called "hijacking", and is generally frowned upon. ]
[ November 13, 2008: Message edited by: Ulf Dittmer ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: build applet from existing application