aspose file tools*
The moose likes Applets and the fly likes Convert Swing class to Applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Convert Swing class to Applet?" Watch "Convert Swing class to Applet?" New topic
Author

Convert Swing class to Applet?

Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Hello,

I am not sure if 'Subject' is correct to this post, if not, sorry for the confusion.

I am new to applets, Swing, AWT.
To start with I took an example and changed as shown below, which works fine if main() is un-commented.


Below listed class is used in the above class.


Both classes are working fine.

Now I tried to convert them into an Applet as shown below:


Applet is called on my webpage as shown below:



Applet is loaded on my webpage, but none of the functionality is available for use, ie nothing happens when buttons are clicked. Please tell me where I went wrong.

Thanks,
Kriss.
Girish Limaye
Greenhorn

Joined: Jan 14, 2010
Posts: 1
Implement the listener interfaces. It might work properly.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41579
    
  54
So every time you click that button a new applet is created? I would not expect that to work at all, especially as it happens after the page has initially been created. Make the applet a proper part of the page from the beginning, and then call its public methods from JavaScript as necessary; search the FAQ for "LiveConnect" for more information.


Ping & DNS - my free Android networking tools app
Kriss Reddy
Ranch Hand

Joined: Mar 29, 2005
Posts: 54
Hi Girish,
Could you please tell me what those listener interfaces are?

Hi Ulf,
Make the applet a proper part of the page from the beginning

Does that mean, placing applet on the page instead of calling from javascript, as shown below?

I placed the applet on the page, applet is loaded properly but none of the buttons worked.

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41579
    
  54
Yes, that's what I meant.
I placed the applet on the page, applet is loaded properly but none of the buttons worked.

Have you considered investigating why that is, instead of trying to running the applet in a much more convoluted way?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert Swing class to Applet?