mmmm...java
- Chef
- Joined: Mon May 06, 2002 4:41 pm
- Location: Ever seen "Pecker"?
- Contact:
mmmm...java
i know there are a few java programmers on this site...so heres a dumb question: if i write a program, how do i put it on a website? ^_^;
- Eek-1
- Joined: Sat Jun 22, 2002 10:06 am
- Status: 0xc00000e9
- Location: Cyberjaya
once you're done, compile your .java and then write in html
Code: Select all
<html>
...
<applet code="whateverthenameis.class" width="12345" height="67890">
</applet>
...
</html>
- Chef
- Joined: Mon May 06, 2002 4:41 pm
- Location: Ever seen "Pecker"?
- Contact:
- downwithpants
- BIG PICTURE person
- Joined: Tue Dec 03, 2002 1:28 am
- Status: out of service
- Location: storrs, ct
have you written your paint(Graphics); method and it works all right?
if the .class file is in a different directory from the html file, you have to add codebase="location" to the <applet> tag, where location is the location of the directory the .class file is in.
if the .class file is in a different directory from the html file, you have to add codebase="location" to the <applet> tag, where location is the location of the directory the .class file is in.
maskandlayer()|My Guide to WMM 2.x
a-m-v.org Last.fm|<a href="http://www.frappr.com/animemusicvideosdotorg">Animemusicvideos.org Frappr</a>|<a href="http://tinyurl.com/2lryta"> Editors and fans against the misattribution of AMVs</a>
a-m-v.org Last.fm|<a href="http://www.frappr.com/animemusicvideosdotorg">Animemusicvideos.org Frappr</a>|<a href="http://tinyurl.com/2lryta"> Editors and fans against the misattribution of AMVs</a>
- Chef
- Joined: Mon May 06, 2002 4:41 pm
- Location: Ever seen "Pecker"?
- Contact:
i dont know what that is. i dont know much about java ^_^;downwithpants wrote:have you written your paint(Graphics); method and it works all right?
if the .class file is in a different directory from the html file, you have to add codebase="location" to the <applet> tag, where location is the location of the directory the .class file is in.
- downwithpants
- BIG PICTURE person
- Joined: Tue Dec 03, 2002 1:28 am
- Status: out of service
- Location: storrs, ct
hmm, ok
is your program already written in java? and are you familiar with object oriented programming?
if so, to create a java program that will run in a webpage, you need to create a class that extends class Applet or JApplet (a subclass of Applet).
Class Applet has the five methods: (JApplet also has them through inheritance)
init();
start();
paint(Graphics);
stop();
destroy();
the browser calls init(); (either from class Applet or your class) to load the applet. You can write an init(); method in your class to create a modified version of the init(); method that will override the init(); method in class Applet. you can write into your init(); method statements that you want to execute when the applet loads in an init(); method in your class.
the browser calls paint(Graphics); to create the display of the window. you can write statements in a paint(Graphics); method in your class in order to control the display.
is your program already written in java? and are you familiar with object oriented programming?
if so, to create a java program that will run in a webpage, you need to create a class that extends class Applet or JApplet (a subclass of Applet).
Class Applet has the five methods: (JApplet also has them through inheritance)
init();
start();
paint(Graphics);
stop();
destroy();
the browser calls init(); (either from class Applet or your class) to load the applet. You can write an init(); method in your class to create a modified version of the init(); method that will override the init(); method in class Applet. you can write into your init(); method statements that you want to execute when the applet loads in an init(); method in your class.
the browser calls paint(Graphics); to create the display of the window. you can write statements in a paint(Graphics); method in your class in order to control the display.
maskandlayer()|My Guide to WMM 2.x
a-m-v.org Last.fm|<a href="http://www.frappr.com/animemusicvideosdotorg">Animemusicvideos.org Frappr</a>|<a href="http://tinyurl.com/2lryta"> Editors and fans against the misattribution of AMVs</a>
a-m-v.org Last.fm|<a href="http://www.frappr.com/animemusicvideosdotorg">Animemusicvideos.org Frappr</a>|<a href="http://tinyurl.com/2lryta"> Editors and fans against the misattribution of AMVs</a>
- Chef
- Joined: Mon May 06, 2002 4:41 pm
- Location: Ever seen "Pecker"?
- Contact:
how would i do that?downwithpants wrote:hmm, ok
is your program already written in java? and are you familiar with object oriented programming?
if so, to create a java program that will run in a webpage, you need to create a class that extends class Applet or JApplet (a subclass of Applet).
Class Applet has the five methods: (JApplet also has them through inheritance)
init();
start();
paint(Graphics);
stop();
destroy();
the browser calls init(); (either from class Applet or your class) to load the applet. You can write an init(); method in your class to create a modified version of the init(); method that will override the init(); method in class Applet. you can write into your init(); method statements that you want to execute when the applet loads in an init(); method in your class.
the browser calls paint(Graphics); to create the display of the window. you can write statements in a paint(Graphics); method in your class in order to control the display.
im really new at this ^_^;
- downwithpants
- BIG PICTURE person
- Joined: Tue Dec 03, 2002 1:28 am
- Status: out of service
- Location: storrs, ct
it might look something like:
import java.awt.*;
import java.applet.*;
import java.util.*;
public class myProgram extends JApplet{
private int x;
private int y;
public void init() {
Date d= new Date;
x= d.getHours();
y= d.getDay();
}
public void paint (Graphics g){
g.drawString("The hour is" + x +". The day is" + y);
}
}
When the browser calls init(); it will get the statements
{Date d= new Date;
x= d.getHours();
y= d.getDay();}
Then when it calls paint(Graphics g); it will get the statements
{g.drawString("The hour is" + x +". The day is" + y);}
When it calls start(); stop(); or destroy(); it will use the methods defined in Class Applet
import java.awt.*;
import java.applet.*;
import java.util.*;
public class myProgram extends JApplet{
private int x;
private int y;
public void init() {
Date d= new Date;
x= d.getHours();
y= d.getDay();
}
public void paint (Graphics g){
g.drawString("The hour is" + x +". The day is" + y);
}
}
When the browser calls init(); it will get the statements
{Date d= new Date;
x= d.getHours();
y= d.getDay();}
Then when it calls paint(Graphics g); it will get the statements
{g.drawString("The hour is" + x +". The day is" + y);}
When it calls start(); stop(); or destroy(); it will use the methods defined in Class Applet
maskandlayer()|My Guide to WMM 2.x
a-m-v.org Last.fm|<a href="http://www.frappr.com/animemusicvideosdotorg">Animemusicvideos.org Frappr</a>|<a href="http://tinyurl.com/2lryta"> Editors and fans against the misattribution of AMVs</a>
a-m-v.org Last.fm|<a href="http://www.frappr.com/animemusicvideosdotorg">Animemusicvideos.org Frappr</a>|<a href="http://tinyurl.com/2lryta"> Editors and fans against the misattribution of AMVs</a>