Thread View: borland.public.jbuilder.java.swing
1 messages
1 total messages
Started by Aris
Wed, 04 May 2005 17:37
A little code problem
Author: Aris
Date: Wed, 04 May 2005 17:37
Date: Wed, 04 May 2005 17:37
75 lines
2168 bytes
2168 bytes
I've tried to make the beginning of a known game.
You got a paddle and you move it to repulse a ball
coming of above. But my code here failed.
The compiler didn't warned of something but the applet viewer
answered this:
<<Start: applet not initialized.>>
Is there anyone who can help me?
--------------------------------------------
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public abstract class paddle extends Applet implements
MouseListener,MouseMotionListener
{
public int x,y;
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
}
public void setState(int x1,int y1){
x=x1;
y=y1;
}
public void mouseMoved(MouseEvent e)
{
setState(e.getX(),e.getY());
}
public void paint(Graphics g)
{
setBackground(Color.gray);
g.setColor(Color.blue);
g.fillRect(190,450,160,20);
g.setColor(Color.blue);
g.fillRect(x,y,160,20);
repaint();
}
}
------------------------------------------------
the HTML file:
------------------------------------------------
<HTML>
<HEAD>
<TITLE>.....</TITLE>
</HEAD>
<BODY>
<P>
<APPLET code=paddle.class width=540 height=480>
</APPLET>
</P>
</BODY>
</HTML>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads