Results 1 to 2 of 2

Thread: Java applet help...

  1. #1
    FLAC
    Join Date
    Apr 2005
    Location
    Queens, New York
    Posts
    1,386

    Java applet help...

    can any1 help me i am trying to get this to run as a java applet and i am having a lot of trouble:

    Code:
    import java.awt.Graphics;       // program uses class Graphics
    import javax.swing.JApplet;     // program uses class JApplet
    import javax.swing.JOptionPane; // program uses class JOptionPane
            
    public class Converter extends JApplet 
        {
    String output;
    String degreesResult = null;
     
    public static final double PI = 3.14;
     
    public void init()
        {
    double celsius;
    double temperature = 0;
     
    for (int x=0; x < 3; x++)
    {    
        celsius = 5*(temperature - 32)/9;
        degreesResult+=output.format("%d degrees farenheit = %.2f celsius.\n", temperature, celsius);    
        temperature += 1;
    }
     
        }
     
    public void paint( Graphics g )
        {
        super.paint( g ); // call superclass version of method paint
              
        g.drawString( output , 500, 300 );
        
     
     } // end method paint
    } // end class
    2002 Mitsubishi Galant
    Progress: 90% [-▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓- ->

    Carputer Specs:
    Via M10K
    512mb Ram
    60GB HDD
    Souund Blaster Audigy2 NX
    OPUS ITX PC Case


  2. #2
    FLAC
    Join Date
    Apr 2005
    Location
    Queens, New York
    Posts
    1,386
    I edited the program a bit but it still doesnt output any data im so confused....anybody?

    Code:
    import java.awt.Graphics;       
    import javax.swing.JApplet;     
    import javax.swing.JOptionPane; 
    		
    public class Converter extends JApplet 
    	{
    
    String outputStr;
    
    public void init()
    	{
    double celsius;
    double temperature = 0;   
    String degreeResult;          
    
    
          
    for (int x=0; x < 3; x++)
    {   
        celsius = 5.*(temperature - 32.0)/9.0;
         degreeResult =
             outputStr.format("%d degrees farenheit = %.2f celsius.\n", temperature, celsius);	
    	temperature += 1;
    }                                         
    
    outputStr = degreeResult;
    
    	}
    	
    public void paint( Graphics g )
    	{
    		
    	super.paint( g );  
    	g.drawString( outputStr , 500, 300 );
    
    
     } 
    }
    2002 Mitsubishi Galant
    Progress: 90% [-▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓- ->

    Carputer Specs:
    Via M10K
    512mb Ram
    60GB HDD
    Souund Blaster Audigy2 NX
    OPUS ITX PC Case


Similar Threads

  1. Java FE
    By eljimbo in forum General MP3Car Discussion
    Replies: 5
    Last Post: 08-28-2007, 11:45 AM
  2. Java and Roadrunner
    By obrienj in forum Road Runner
    Replies: 0
    Last Post: 11-19-2006, 07:21 AM
  3. Replies: 5
    Last Post: 01-14-2006, 03:34 PM
  4. $125 for Java Program
    By SnyperBob in forum Off Topic
    Replies: 24
    Last Post: 04-23-2005, 06:59 AM
  5. Java based #mp3car irc??
    By Tidder in forum Mp3car Forum Suggestions/Comments
    Replies: 5
    Last Post: 02-02-2005, 06:56 PM

Bookmarks

Posting Permissions

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