Results 1 to 3 of 3

Thread: Ok, whats going on?...

  1. #1

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Angry

    Code:
    public class Applet1 extends Applet
    {
    	public String i_item;
    	
    	
    	/**
    	 * The entry point for the applet. 
    	 */
    	public void init()
    	{
    		
    		xitem = new Class1(i_item);
            	
    	}
               
             public void paint(Graphics g) {
    
     }
    }

    Ok, i want to be able to call the xitem in the paint sub. Sorry this is a basic question but this is my 3rd day doing this hehe

    Anyways, i want to make it so i can do

    Code:
    public void paint(Graphics g) {
    
     xitem.Draw();
    
    {
    But the thing is, when i put in xitem. the submenu wont pop up. It should have Draw inside because my Class1 has it. This is what it looks like.

    Code:
    import java.awt.*;
    
    public class Class1
    {
    	String x_item;
    	public Class1(String x){
    	
    	x_item = x;
    		
    		
    	
    	}
    
    	public void DrawX(Graphics d){
    				d.drawString(x_item,20,20);	 
    
    		  
    	}
    }
    I know there are many errors, but what am i forgeting to make xitem equal to... i tried making it
    public xitem Class1;
    before the init void but that dosent work.

    ??? Please help, im stuck damnit! :\
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    How about:
    Code:
    public class Applet1 extends Applet {
        private String m_xitem;
    
        public init(String x_item) {
            m_xitem = x_item;
        }
    
        public void paint(Graphics g) {
            g.drawString(m_xitem, 5, 50);
        }
    }
    You'd need to use a different way of setting m_xitem, though, such as: getParameter("string"), which is set in the <applet> tag.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Fanatic Member invitro's Avatar
    Join Date
    Jan 2000
    Location
    Outside your window
    Posts
    547

    Thumbs up

    Ahhhhhhh.... now i see it! Thanks for the post! Ill go play around with it right now!
    ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet?

Posting Permissions

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



Click Here to Expand Forum to Full Width