Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Observed Image Load Java source code
#1

Code:
import java.awt.*;
import java.applet.*;

/*
<applet code=ObservedImageLoad width=300 height=300>
<param name="img" value="smile.jpg">
</applet>
*/

public class ObservedImageLoad extends Applet
{
  Image img;
  boolean error=false;
  String imgname;
  public void init()
  {
  setBackground(Color.blue);
  imgname = getParameter("img");
  img = getImage(getDocumentBase(), imgname);
  }
  public void paint(Graphics g)
  {
  if(error)
  {
  Dimension d = getSize();
  g.setColor(Color.red);
  g.fillRect(0,0,d.width,d.height);
  g.setColor(Color.black);
  g.drawString("Image not found" + imgname,10,d.height/2);
  }
  else
  {
  g.drawImage(img,0,0,this);
  }
  }
  public void update(Graphics g)
  {
  paint(g);
  }
  public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
  {
  if((flags & SOMEBITS) != 0 )
  {
  //repaint();
  repaint(x,y,w,h);
  }
  else if((flags & ABORT) != 0)
  {
  error = true;
  repaint();
  }
  return (flags & (ALLBITS ABORT)) == 0;
  }
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: faults observed by buchholz relay, fayol s principles of management observed in tata motors, fayol principles of management observed in the any departmental store, fayols principles observed in kfc images, fayols principle which observed and applied in the amul organisation, considering their level and the changes that chris has observed his students lately what islike affecting his students, considering their level and the changes that chris has observed in his students lately what is likely affecting his students,

Forum Jump:


Users browsing this thread: 1 Guest(s)