Results 1 to 5 of 5
Thread: I need simple java applet
- 07-18-2007, 05:17 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 35
- Rep Power
- 0
- 08-07-2007, 05:42 AM #2
Member
- Join Date
- Jul 2007
- Posts
- 40
- Rep Power
- 0
Check this:
chapter1
Decent tutorials to get started with and it shows you source code to look at.
Greetings.
- 01-01-2008, 12:23 PM #3
Member
- Join Date
- Jan 2008
- Posts
- 2
- Rep Power
- 0
Hi i'm a newbie and i tried that hello world example except that i renamed it to HelloApplet.java . I tried to view it on a html page using hotjava 3.0 and i get these exceptions when i do
My HTML document looks like this (html.html)PHP Code:?HelloApplet.class?: java.lang.ClassNotFoundException: ?HelloApplet.class? at sunw.hotjava.applet.BasicAppletManager.createApplet(BasicAppletManager.java:245) at sunw.hotjava.applet.BrowserAppletManager.createApplet(BrowserAppletManager.java:109) at sunw.hotjava.applet.AppletPanel.runLoader(AppletPanel.java:480) at sunw.hotjava.applet.AppletPanel.processEvent(AppletPanel.java:338) at sunw.hotjava.applet.AppletPanel.run(AppletPanel.java:323) at java.lang.Thread.run(Thread.java:466)
And my HelloApplet.java :PHP Code:<HTML> <HEAD> <TITLE>This page has an applet on it</TITLE> </HEAD> <BODY> <P>My second Java applet says: <BR> <APPLET CODE = ”HelloApplet.class” WIDTH=200 HEIGHT=50> There would be an applet here if your browser supported Java. </APPLET> </BODY> </HTML>
I compiled HelloApplet.java on Forte for Java 4.0 CEPHP Code:/* By Bavo Bruylandt (Http://www.realapplets.com") */ // and now The inevidable "Hello World" example :) // tell the compiler where to find the methods you will use. // required when you create an applet import java.applet.*; // required to paint on screen import java.awt.*; // the start of an applet - HelloWorld will be the executable class // Extends applet means that you will build the code on the standard Applet class public class HelloApplet extends Applet { // The method that will be automatically called when the applet is started public void init() { // It is required but does not need anything. } // This method gets called when the applet is terminated // That's when the user goes to another page or exits the browser. public void stop() { // no actions needed here now. } // The standard method that you have to use to paint things on screen // This overrides the empty Applet method, you can't called it "display" for example. public void paint(Graphics g) { //method to draw text on screen // String first, then x and y coordinate. g.drawString("Hey hey hey",20,20); g.drawString("Hellooow World",20,40); } } // That's it. Next is drawing special shapes on screen and using fonts. // Go to DrawExample.java.
All files i.e HelloApplet.java , HelloApplet.class and html.html are in the same directory i.e C:\forte_jdk\forte4j\bin\ide-userdir\sampledir
Could someone pls tell me where i went wrong ...
- 01-01-2008, 12:54 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Have you check that code as it is?
- 01-27-2008, 07:50 AM #5
Member
- Join Date
- Jan 2008
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
2 simple java questions
By jimJohnson in forum New To JavaReplies: 2Last Post: 02-02-2008, 09:35 AM -
Simple java
By abhiN in forum New To JavaReplies: 0Last Post: 01-16-2008, 02:44 PM -
Simple java
By abhiN in forum New To JavaReplies: 1Last Post: 01-16-2008, 10:13 AM -
help with simple program in java
By katie in forum New To JavaReplies: 2Last Post: 08-06-2007, 08:03 PM -
help with simple java program
By leonard in forum New To JavaReplies: 3Last Post: 07-30-2007, 09:40 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks