aspose file tools*
The moose likes Applets and the fly likes applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "applets" Watch "applets" New topic
Author

applets

Rajani kanth Pandiri
Greenhorn

Joined: Jan 28, 2006
Posts: 13
when im trying to execute the following code, it has been compiled but it doesn't execute can anyone help

import java.awt.*;
import java.awt.BorderLayout;
import java.applet.*;
import java.util.*;

/*
<applet code="BorderLayoutDemo" width=400 height=200>
</applet>
*/

public class BorderLayoutDemo extends Applet
{
public void init()
{
setLayout(new BorderLayout());
add(new Button("Top"), BorderLayout.NORTH);
add(new Button("Bottom"), BorderLayout.SOUTH);
add(new Button("Right"), BorderLayout.EAST);
add(new Button("Left"), BorderLayout.WEST);
String message="Hello welcome to the world of Heaven";
add(new TextArea(message));
}
}
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
You can't execute it with the interpreter. You have to create an HTML file for the applet that contains an applet tag and then either load that using appletviewer or a Java-enabled browser.
Rajani kanth Pandiri
Greenhorn

Joined: Jan 28, 2006
Posts: 13
thank you..

I executed this with appletviewer. still it is giving error as IO Exception while reading..
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Could you post the error you get?
Rajani kanth Pandiri
Greenhorn

Joined: Jan 28, 2006
Posts: 13
I/O exception while reading: C:\Rajani Kanth\Java\Programs\BorderLayoutDemo (The
system cannot find the file specified)
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Did you compile the class and is the .class in the same directory as the .html?
Rajani kanth Pandiri
Greenhorn

Joined: Jan 28, 2006
Posts: 13
ya i got thankyou.
Rajani kanth Pandiri
Greenhorn

Joined: Jan 28, 2006
Posts: 13
Mr, keith..
when i do it with browser i get it. but when i tried with appletviewer i dint get. whyy
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41816
    
  62
Have you tried:


Ping & DNS - my free Android networking tools app
Rajani kanth Pandiri
Greenhorn

Joined: Jan 28, 2006
Posts: 13
yes. it has compiled but not executed with appletviewer
Sant
Greenhorn

Joined: Jan 28, 2006
Posts: 15
u can run the applets using appletviewr <filename>.java
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
What happened when you used appletviewer?
Rajani kanth Pandiri
Greenhorn

Joined: Jan 28, 2006
Posts: 13
ye i got it... thank you very much...
Sant
Greenhorn

Joined: Jan 28, 2006
Posts: 15
It's ok
ashok r
Greenhorn

Joined: Aug 28, 2005
Posts: 9
use this code

<applet code="BorderLayoutDemo.class" width=400 height=200>
</applet>

and save it with extension .html

it is working


ASH RULES
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61196
    
  66

"SANT" and "ashok r",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: applets