error:
The method paint(Graphics, main) in the type player is not applicable for the arguments (Graphics, main.Display)
on line: player_class.paint(g)
main.java
public class main extends JApplet
{
Timer timer;
Display display_class;
Player player_class;
/*** init method ***/
public void init()
{
setSize(800, 400);
display_class = new Display();
setContentPane(display_class);
}/*** end of init method ***/
/*** stat method ***/
public void start()
{ player_class = new player();
timer = new Timer(30, this);
timer.start();
}/*** end of start method ***/
/*** game loop ***/
public void actionPerformed(ActionEvent e)
{
repaint();
}/*** end of run method ***/
/*** paint method ***/
public class Display extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
player_class.paint(g);
}/** end of paint component method ***/
}/*** end of display class ***/
}/*** end of main class ***/
player.java
public class player
{
/*** PLAYER VARIABLES ***/
private int x = 10;
private int y = 200;
private int width = 15;
private int height = 100;
/*** CONSTRUCTOR METHOD ***/
public player()
{
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.fillRect(x, y, width, height);
}
}