import java.awt.*; import java.applet.*; import java.awt.event.*; public class Pie extends Applet { Image image,image2; Dimension size; public void init() { size=getSize(); image=createImage(size.width,size.height); image2=createImage(size.width,size.height); addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { Graphics g2=image2.getGraphics(); g2.drawImage(image,0,0,size.width,size.height/2, 0,0,size.width/2,size.height,Pie.this); g2.drawImage(image,0,size.height/2,size.width,size.height, size.width/2,0,size.width,size.height,Pie.this); g2.dispose(); Graphics g=image.getGraphics(); g.drawImage(image2,0,0,Pie.this); g.dispose(); repaint(); } }); } public void start() { Image image3=getImage(getCodeBase(),getParameter("filename")); MediaTracker mt=new MediaTracker(this); mt.addImage(image3,0); try { mt.waitForAll(); } catch (InterruptedException e) { e.printStackTrace(); } Graphics g=image.getGraphics(); g.drawImage(image3,0,0,size.width,size.height,this); g.dispose(); } public void paint (Graphics g) { g.drawImage(image,0,0,this); } }