[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Intermediate Java Tutorial – 22 – init for Applets
by
Tags:
Comments
36 responses to “Intermediate Java Tutorial – 22 – init for Applets”
-
Why don't we need a main method to start the program?
-
why we dont use main method.?? public static void main(String args[ ])
-
Chrome doesn't support Applets anymore :/
-
When I tried to run my program, I got "Launch Error: Editor does not contain an applet". Please guys how do solve this?
-
Is this the same as in the init method from HttpServlet?
-
what we write super.class(g)
-
import java.awt.*;
import javax.swing.*;public class julian extends JApplet{
private double sum;
public void init() {
String fn = JOptionPane.showInputDialog("Enter first number:");
String sn = JOptionPane.showInputDialog("Enter second number:");double n1 = Double.parseDouble(fn);
double n2 = Double.parseDouble(sn);sum = n1 + n2;
}public void paint(Graphics g){
super.paint(g);
g.drawString("The sum is "+sum, 25, 25);
}
} -
Wouldn't you want to put the "double n1 = Double.parseDouble(fn);" in a try and catch?
-
I am init for applets!
🙂 -
if you press ctrl + Shift + o in eclipse it imports every thing your program needs to run correctly
-
bucky where is Tutorial -23
-
I have one doubt . what if I enter wrong data like instead double i enter something like "22.2.2" . is there any way to pass this exception ? please help
-
I think bucky shouldn't have dropped out of Elementary school, and learned grammar and pronunciation.
-
you didnt do:
sum = n1+n2;
n1 and n2 being the string converted doubles -
catch (EOFException eofException)
pls can you explained this more to me. i do not understand that line of code -
OMG!
480p!!!!!!! -
always get a sum of 0.0. Anybody know why?
-
Done and dusted
-
why are the intermediate tutorials easier than the beginner ones?
-
Ok, so I run the applet and the prompts work, but nothing displays in the applet at the end. Any help???
-
i think he was attempting to say initializate, he couldnt choose one >.<
-
And whats the method next to "paint"?
-
but paint method vasn't called. Hov did it egjigoot?
-
lol
-
Dr. Java in the house bitches 😀
-
Eclipse is more user-friendly, I perfer eclipse… not that it really matters though.
-
init is short for isn't it.. British slang.
-
Really Worked!, Thanks!!
-
@micaelc Make sure you give give permmision for Java to run in the browser, and it may take a few seconds for it to load (depending on internet/connection and computer speed).
-
@Santiago Scacchi delete the old class from the ftp or file (depending on where your testing it). If its in eclipse, make sure its saved + working properly.
-
you gotta put the new class in the ftp .-.
-
applets runs inside a container, that's why they don't need a staic main method
-
Guys, im starting to pissing off, why when i change an applet it stills run the old applet we first built? It seems like the Apples.java does change but the Apple.class doesnt, and it keeps running the first applet we built…
-
hey bucky !!!
why is my code not working in the browser ??
it works in eclipse but not in the browser…. -
@sciman001 If you follow MyBringBack he's doing a very good Java Game Development tutorial using Applets.
-
why need to call?
super.paint(g);
calling overriding function ?
Leave a Reply