I have been programming for almost 2 years in Visual Basic. Reciently I have decided to learn Java because it can be in .html files and is able to run on many operating systems. I attempted to write a small program that would say “<-the mouse is here.” by the mouse pointer on the Java applet. I don’t see anything wrong with the code but I am sure there is. Here it is. (Im sure you will see a lot of dumb mistakes, remember, I am new to the Java language)
import java.awt.*;
/*Hopefully... this will use the mouse input info*/
public class MouseInput extends java.applet.Applet implements Runnable
{
private int mouseXvar, mouseYvar;
private boolean isactive;
mouseXvar = 0;
mouseYvar = 0;
isactive = true;
function_start()
public void function_start()
{
while(isactive)
{
mouseXvar = getX()
mouseYvar = getY()
paint()
}
}
public void paint(Graphics g)
{
g.drawString("<- the mouse is here.", mouseXvar, mouseYvar);
}
}
</pre><BR>Here are the errors I got.<BR>line 10:<identifier> expected.<BR> mouseXvar = 0;<BR>(points to = )<BR><BR>Line 11:<identifier> expected.<BR> mouseYvar = 0;<BR>(points to = )<BR><BR>Line 12:<identifier> expected.<BR> isactive = true;<BR>(points to = )<BR><BR>Line 14: invalid method declaration; return type required.<BR> function_start()<BR>(points to f)<BR><BR>Line 15: ';' expected<BR><BR>Also could you explain some of these lines of code, I have no idea what they do but they seem to be in every program.<BR><pre class="ip-ubbcode-code-pre">
public class MouseInput extends java.applet.Applet implements Runnable
</pre><BR><pre class="ip-ubbcode-code-pre">
public void paint(Graphics g)
And also, what does void and static mean??? < these faces are cool.