Wednesday, February 21, 2007

java and animate gif

Recently, I got a question about how to draw an animated gif using java. Drawing an image is not trivial in Java, you can use graphics.drawImage, but to draw an animated gif?

I look up in javadoc, and curious about ImageObserver, well I never use this object,  and always pass a null object when  drawing an image. Apperently ImageObserver object has a ImageUpdate method, so I tried when drawing animated gif, I specified and extend the ImageUpdate method.
Whoalla, the fact is when an image need to update (change the frame in animated gif), it will call imageUpdate method, so to refresh the image, the hook is in ImageObsert imageUpdate.

perhaps the code is

public void paint(Graphics g)
  {
    g.drawImage(img,0,0,this); 
  }

  public boolean imageUpdate( Image img, int flags, int x, int y, 
    int w, int h ) 
  {
   
    repaint();
    return true;
  }

Monday, July 03, 2006

Sad Ending for England

For me, World Cup 2006 is over. Yes, its over because england once again is defeated by the lucky :) Portugal for the 3rd times, and this time that make me more depressed, that England is defeated by penalty shoot out. I don't want to talk about the games neither how that rooney get red carded ( Well, I dislike those MancS anyway) still very hard for me to memorize that.

Friday, July 29, 2005

Say hello again.

mau apa ya? udah lama gak nulis disini? cuma say hello aja deh :P

Monday, November 29, 2004

Sometime people can be soooooooo dumb :P

here is some of the stories:

  1. An Illinois man pretending to have a gun, kidnapped a motorist and forced him to drive to two different automated teller machines. The kidnapper then proceeded to withdraw money from his own bank accounts...
  2. A Florida man, who robbed two men at gunpoint in their homes, dropped his wallet as he left and then called police to ask if they found the wallet.  They said they did.  They asked him to come down and claim it.  He did.
  3. Drug Possession Defendant Christopher Jansen, on trial in March in Pontiac, Michigan, said he had been searched without a warrant. The prosecutor said the officer didn't need a warrant because a "bulge" in Christopher's jacket could have been a gun.  "Nonsense," said Christopher, who happened to be wearing the same jacket that day in court. He handed it over so the judge could see it. The judge discovered a packet of cocaine in the pocket and laughed so hard he required a five minute recess to compose himself.

more dumb stories on : www.amusingfacts.com/dumbestm

Thursday, November 25, 2004

Apa yang calvin bilang kayaknya emang merefleksikan kebanyakan orang2 di indonesia (politisi, tentara, polisi, ato mungkin aku?) yang seperti anak kecil.

calvin: I'm always right and everybody else is always wrong!!!!
Sound familiar eh?

Wednesday, October 20, 2004

Test

Hi there, this is just test from w.blogger

Friday, October 15, 2004

Hari ini puasa hari pertama,  Ramadhan memang selalu istimewa, semua orang bersiap2 menyambut ramadhan. Ada yang bersiap2 dari secara individu berniat untuk menjalankan ibadah puasa dengan ikhlas dan sungguh, tapi ada juga yang bersiap siap dengan cara mengatur bagaimana orang lain bersikap.

Kalo misalnya yang mengatur itu memang tugasnya seperti pemerintah daerah, saya masih bisa mengerti tapi yang saya sayangkan bagaimana sekelompok orang berdemo menuntut supaya warung2 makan ditutup pada bulan puasa. Yang kita inginkan dalam hidup ini adalah saling pengertian, seharusnya kita tidak usah ribut2 menuntut orang lain supaya menghormati puasa kita, toh puasa adalah ibadah individu kepada Tuhannya, selain itu juga tidaklah baik untuk menghalangi pencarian nafkah orang lain, sekali lagi yang penting adalah saling pengertian, misalnya yang punya warung untuk menutupi warungnya dengan kain supaya tidak terlihat sudah cukup sehingga yang berpuasa tidak tergoda, kalo misalnya yang berpuasa masih tergoda, berarti memang yang berpuasalah yang mentalnya harus diperbaiki.

Ada juga sekelompok orang yang menuntut pada bulan puasa, agar semua kemaksiatan dihilanglan seperti judi dan sebgainya, pertanyaannya adalah apakah perbuatan2 maksiat itu hanya dihilangkan pada bulan puasa ato kah memang harus segera dibrantas dan tidak timbul lagi?, mungkin itu yang harus dipertajam, jangan setelah bulan puasa segala maksiat2 itu kembali lagi seperti semula.