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);
}
}
}