Intermediate Java Tutorial – 22 – init for Applets

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

36 responses to “Intermediate Java Tutorial – 22 – init for Applets”

  1. Edward Liu Avatar

    Why don't we need a main method to start the program?

  2. Badar Saleem Avatar

    why we dont use main method.?? public static void main(String args[ ])

  3. silas gabriel Avatar

    Chrome doesn't support Applets anymore :/

  4. Patrick Adjarho Avatar

    When I tried to run my program, I got "Launch Error: Editor does not contain an applet". Please guys how do solve this?

  5. Jake van Manen Avatar

    Is this the same as in the init method from HttpServlet?

  6. Ghori Aaqil Avatar

    what we write super.class(g)

  7. Jeremy Chen Avatar

    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);
        }
    }

  8. Sterling H Avatar

    Wouldn't you want to put the "double n1 = Double.parseDouble(fn);" in a try and catch?

  9. PigKing107 Avatar

    I am init for applets!
    🙂

  10. Aidan Siener Avatar

    if you press ctrl + Shift + o in eclipse it imports every thing your program needs to run correctly  

  11. god Avatar

    bucky where is Tutorial -23

  12. Manish Tiwari Avatar

    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

  13. Brian West Avatar

    I think bucky shouldn't have dropped out of Elementary school, and learned grammar and pronunciation.

  14. Shawn Avatar

    you didnt do:

    sum = n1+n2;
    n1 and n2 being the string converted doubles

  15. Ntiamoah Emmanuel Avatar

    catch (EOFException eofException)
    pls can you explained this more to me. i do not understand that line of code

  16. USAsuperstore Avatar

    always get a sum of 0.0. Anybody know why?

  17. GigabyteDX Avatar

    why are the intermediate tutorials easier than the beginner ones?

  18. J Vids Avatar

    Ok, so I run the applet and the prompts work, but nothing displays in the applet at the end. Any help???

  19. metemer001 Avatar

    i think he was attempting to say initializate, he couldnt choose one >.<

  20. ChrisPTY507 Avatar

    And whats the method next to "paint"?

  21. Erram Vipanch Avatar

    but paint method vasn't called. Hov did it egjigoot?

  22. Charsept Avatar

    Dr. Java in the house bitches 😀

  23. Aaron Avatar

    Eclipse is more user-friendly, I perfer eclipse… not that it really matters though.

  24. 360felix Avatar

    init is short for isn't it.. British slang.

  25. Ravushika01 Avatar

    Really Worked!, Thanks!!

  26. MrLolPvP Avatar

    @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).

  27. MrLolPvP Avatar

    @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.

  28. OOchriOO Avatar

    you gotta put the new class in the ftp .-.

  29. inurdreamsfuzzy Avatar

    applets runs inside a container, that's why they don't need a staic main method

  30. Santiago Scacchi Avatar

    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…

  31. Micael Campos Avatar

    hey bucky !!!
    why is my code not working in the browser ??
    it works in eclipse but not in the browser….

  32. Nicholos Tyler Avatar

    @sciman001 If you follow MyBringBack he's doing a very good Java Game Development tutorial using Applets.

  33. Lim ChewChuan Avatar

    why need to call?
    super.paint(g);
    calling overriding function ?

Leave a Reply

Your email address will not be published. Required fields are marked *