I don't know why but nothing is appearing?

I suppose to have a applet of a house.

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.applet.Applet;
import java.awt.Graphics;


public class color extends JApplet
{
	public void init()
	{
		addMouseListener(new MyMouseListener());
		getContentPane().setBackground(Color.white);
	}
	public class MyMouseListener implements MouseListener
	{
	public void mouseClicked(MouseEvent e) 
	{
	       int x = e.getX();
	       int y = e.getY();
	       boolean closeDoors = true;
	       
	       if(x>330 && x<280 && y>20 && y<20)
	       {
	    	   closeDoors = false;
	           repaint();
	      
	       }
	      
	}
	public void mouseEntered(MouseEvent e) { }
	public void mouseExited(MouseEvent e) { }
	public void mousePressed(MouseEvent e) { }
	public void mouseReleased(MouseEvent e) { }
	}
	public void paint ( Graphics g, boolean closeDoors)
	       {
	    	    super.paint (g);
	    	  
	    	    do
	    	    {
	    	   g.drawLine (35, 50, 570, 50);
				g.drawLine (35, 50, 250, 0);
				g.drawLine (250, 0, 570, 50);
				g.drawRect (50, 50, 500, 350);
				g.fillRect (100, 75, 80, 80);
				g.fillRect (400, 75, 80, 80);
				g.fillRect (240, 200, 125, 200);
	    	    }
				 while (closeDoors = true);
				 
				 if (closeDoors = false);
				{
				g.drawLine (35, 50, 570, 50);
				g.drawLine (35, 50, 250, 0);
				g.drawLine (250, 0, 570, 50);
				g.drawLine (180, 120, 100, 120);
				g.drawLine (400, 120, 480, 120);
				g.drawLine (140, 75, 140, 160);
				g.drawLine (450, 75, 450, 160);
				g.drawRect (50, 50, 500, 350);
				g.drawRect (100, 75, 80, 80);
				g.drawRect (400, 75, 80, 80);
				g.drawRect (240, 200, 125, 200);
				g.drawOval (330,280, 20, 20);
				}
	    	}
}

if(x>330 && x<280 && y>20 && y<20)

x cannot be both >300 and <280 at the same time
similarly, y cannot be greater than and less than 20 at the same time

so this will always evaluate to false, for all possible values of x and y

I think you need y == 20?

Unlikely.
@kingofdrew needs to have another look at how && works.
Also
public void paint ( Graphics g, boolean closeDoors)
is probably a mistake. It looks like a failed attempt to override the inherited
public void paint ( Graphics g)
but because of the additional parameter this is just an ordinary method, not an override, and it doesn't get called anywhere.

This article has been dead for over six months. Start a new discussion instead.