Results 1 to 4 of 4
  1. #1
    LittleZoppo is offline Member
    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Default I am a super noob with a super noob question.

    Hey Guys,

    So I'm actually a graphic designer ([url=http://linkremoved[/url] < my site) but I ran into some old java files I made back in the day. They are really stupid, and it's just a stupid game I made but I'd like to play it again for nostalgic purposes. It was back in high school when I made the program on a PC and now I'm using a mac. I'm just trying to run the damn thing in an applet but it won't launch and I believe it's because I'm not declaring a main method. Here is the code

    Java Code:
     
    import java.util.*; 
    import java.awt.Graphics.*; 
    import java.awt.*; 
    import java.applet.*; 
    //import javax.swing.*; 
    //import javax.*; 
     
    
        
    public class MyGame extends Applet 
    { 
      
     int x = 8; 
     int y = 6 ; 
     int x1 = 12; 
     int y1 = 13; 
     int scale = 60 ; 
     int xformula; 
     int yformula; 
     int toplimitx; 
     int botlimitx; 
     int toplimity; 
     int botlimity; 
     int xCoord, yCoord; 
     int appletWidth;  //  width of the Applet window 
     int appletHeight;  //  height of the Applet window 
        Image virtualMem; 
     Graphics gBuffer; 
     boolean firstPaint; 
      
     public void init() 
     { 
          
         int x = 0; 
      int y = 0; 
      int x1 = 0; 
      int y1 = 0; 
      int scale = 0; 
          
         appletWidth = getWidth(); 
      appletHeight = getHeight();  
      virtualMem = createImage(appletWidth,appletHeight); 
      gBuffer = virtualMem.getGraphics(); 
      gBuffer.setColor(Color.white); 
      gBuffer.fillRect(0,0,appletWidth,appletHeight); 
     
     }//END INIT 
      
      
     public void paint(Graphics g) 
     { 
       
     
      
       
      Random generator = new Random(); 
      int speedgenerator; 
       
      System.out.println(" "); 
      System.out.println(" "); 
      System.out.println("MOUSE BEGING " + xCoord + " " + yCoord ); 
      System.out.println("------------------------------------------"); 
      System.out.println("BALL BEGINING " + x + " " + y); 
      System.out.println("------------------------------------------"); 
      System.out.println(" "); 
      System.out.println(" "); 
       
      x = x + x1; 
      y = y + y1; 
      
      
      
      if(x >= 900) 
      { 
       xformula = x - x1; 
       yformula = y - y1; 
       toplimitx = xformula + 15; 
       botlimitx = xformula - 15; 
       toplimity = yformula + 15; 
       botlimity = yformula - 15; 
        
       System.out.println("FORMUAL IN PROCESS BY MIKEY ZOPPO"); 
       System.out.println("X is " + x + " x1 is " + x1 + "X Formula is " + xformula); 
       System.out.println("Y is " + y + " y1 is " + y1 + "Y Formula is " + yformula); 
       System.out.println("FORMUAL end PROCESS BY MIKEY ZOPPO"); 
        
       if(xCoord >= botlimitx && xCoord <= toplimitx && yCoord >= botlimity && yCoord <= toplimity ) 
       { 
       scale = scale + 60; 
       } 
        
       speedgenerator = generator.nextInt(49) + 13; 
       x1 = 0 - speedgenerator; 
      } 
      if(x <= 0) 
      { 
       xformula = x - x1; 
       yformula = y - y1; 
       toplimitx = xformula + 15; 
       botlimitx = xformula - 15; 
       toplimity = yformula + 15; 
       botlimity = yformula - 15; 
        
       System.out.println("FORMUAL IN PROCESS BY MIKEY ZOPPO"); 
       System.out.println("X is " + x + " x1 is " + x1 + "X Formula is " + xformula); 
       System.out.println("Y is " + y + " y1 is " + y1 + "Y Formula is " + yformula); 
       System.out.println("FORMUAL end PROCESS BY MIKEY ZOPPO"); 
        
       if(xCoord >= botlimitx && xCoord <= toplimitx && yCoord >= botlimity && yCoord <= toplimity ) 
       { 
       scale = scale + 60; 
       } 
        
       
       speedgenerator = generator.nextInt(49) + 23; 
       x1  = speedgenerator; 
      } 
      if(y >= 600) 
      { 
       xformula = x - x1; 
       yformula = y - y1; 
       toplimitx = xformula + 15; 
       botlimitx = xformula - 15; 
       toplimity = yformula + 15; 
       botlimity = yformula - 15; 
        
       System.out.println("FORMUAL IN PROCESS BY MIKEY ZOPPO"); 
       System.out.println("X is " + x + " x1 is " + x1 + "X Formula is " + xformula); 
       System.out.println("Y is " + y + " y1 is " + y1 + "Y Formula is " + yformula); 
       System.out.println("FORMUAL end PROCESS BY MIKEY ZOPPO"); 
        
       if(xCoord >= botlimitx && xCoord <= toplimitx && yCoord >= botlimity && yCoord <= toplimity ) 
       { 
       scale = scale + 60; 
       } 
        
       
        
       speedgenerator = generator.nextInt(49) + 13; 
       y1 = 0 -  speedgenerator; 
      } 
      if(y <= 0) 
      { 
       xformula = x - x1; 
       yformula = y - y1; 
       toplimitx = xformula + 15; 
       botlimitx = xformula - 15; 
       toplimity = yformula + 15; 
       botlimity = yformula - 15; 
        
       System.out.println("FORMUAL IN PROCESS BY MIKEY ZOPPO"); 
       System.out.println("X is " + x + " x1 is " + x1 + "X Formula is " + xformula); 
       System.out.println("Y is " + y + " y1 is " + y1 + "Y Formula is " + yformula); 
       System.out.println("FORMUAL end PROCESS BY MIKEY ZOPPO"); 
        
       if(xCoord >= botlimitx && xCoord <= toplimitx && yCoord >= botlimity && yCoord <= toplimity ) 
       { 
       scale = scale + 60; 
       } 
       
       speedgenerator = generator.nextInt(42) + 13; 
       y1 = speedgenerator; 
      } 
      
       
      System.out.println("MOUSE " + xCoord + " " + yCoord ); 
      System.out.println("------------------------------------------"); 
      System.out.println("BALL " + x + " " + y); 
      
      gBuffer.setColor(Color.black); 
      gBuffer.fillOval(x,y,scale,scale);//BALL 
      g.drawImage (virtualMem,0,0, this);   
       
      for (long delay = 1; delay < 10000000; delay++); 
       
      gBuffer.setColor(Color.white); 
      gBuffer.fillOval(x,y,scale,scale);//ERASER 
      g.drawImage (virtualMem,0,0, this); 
       
     
     
      
       
     } 
     
     
     public boolean mouseMove(Event e, int x, int y) 
     { 
      xCoord = x; 
      yCoord = y; 
      repaint(); 
      return true; 
     } 
     
     
    }
    I just need to know what code to add where so this will actually launch in an applet. Please excuse my idiocy, as I am not a developer/programer.

    Thanks guys
    Last edited by DarrylBurke; 04-27-2012 at 04:49 AM. Reason: Removed link

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: I am a super noob with a super noob question.

    Applets don't have main methods but rather are launched by a browser's applet launcher. You would do well to read the tutorials on this: Applet Tutorial

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: I am a super noob with a super noob question.

    it won't launch
    Are there any error messages in the browser's java console?
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: I am a super noob with a super noob question.

    The link is irrelevant to the question, so it has been removed.

    Also, please use a meaningful subject line.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. noob question. plz help tho!
    By swp in forum New To Java
    Replies: 2
    Last Post: 09-28-2011, 07:16 AM
  2. Probably Really Noob Question
    By bpx95 in forum New To Java
    Replies: 2
    Last Post: 05-16-2011, 02:44 AM
  3. Please help super noob understand
    By elecleoalune in forum New To Java
    Replies: 9
    Last Post: 04-02-2011, 10:22 AM
  4. calling variable using super super..
    By Stephen Douglas in forum New To Java
    Replies: 7
    Last Post: 08-16-2010, 07:12 AM
  5. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 04:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •