Javafx Pie Menu (with Fish Eye Effect)

Here’s a simple pie menu (context menu) using javafx. 

 

use right click to show (context) menu and left click to hide it. 

try this here:   

fyi, i also post it at javafxstudio.

here it is the source code 
Read More »

Iklan

Javafx Media Player (2) – Simple Playlist

Terima kasih buat mas pemula yang telah merequest di buatkan contoh media player dengan playlist pada javafx :).

ini dia contohnya:

/*
 * MPlayer.fx
 *
 * Created on 17 Mei 09, 7:12:19
 */

package mymediaplayer;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.media.MediaView;

/**
 * @author Hakim
 */

def mediaURLs = ["file:///F:/Movies/video6.flv","file:///F:/Harmony.flv",
"file:///F:/TEDtalk.flv"];
var slide = Media { source: mediaURLs[0] }
var counter = 0;

function getMedia(idx:Integer):Media{
 return Media{source: mediaURLs[idx]};
}

// play media repeatedly
def mediaplayer:MediaPlayer = MediaPlayer {
 media : slide
 onEndOfMedia: function():Void{
 // stop current media
 mediaplayer.stop();
 // play next media
 def x = counter + 1;
 if (x> sizeof mediaURLs - 1 )
 counter = 0
 else
 counter = x;
 mediaplayer.media = getMedia(counter);
 mediaplayer.play();
 }
};

mediaplayer.play();

def mediaview = MediaView {
 preserveRatio: true
 mediaPlayer : mediaplayer
 x: 30
 y: 30
}

Stage {
 title : "Media Player"
 scene: Scene {
 width: 500
 height: 500
 content: mediaview
 }
}

dalam contoh ini, saya menyimpan daftar alamat file multimedia dalam array of string, file – file ini nantinya akan dimainkan, secara bergantian.  yang perlu diperhatikan hanyalah event onEndOfMedia, yang merupakan salah satu properti mediaplayer, dari sini kita bisa mendeteksi kapan player memainkan media. dengan mengetahui waktu media telah memainkan satu file multimedia (video), kita bisa mengganti media dengan media file selanjutnya, dan seterusnya.

untuk membuat aplikasi yang lebih serius tentu tidak seperti ini. ini hanya sebuah contoh yang sederhana saja.

happy coding mas pemula atau dhev atau vebry, wish u luck :)

Javafx Game : Swine Shooter

Barusan membuat game sederhana dengan javafx, swine shooter. mengingat lagi rame flu babi, jadi bikin gamenya ya berburu babi (baca: menembak babi), tapi ini bukan babi biasa, ini babi yang telah terinfeksi virus (jadi warnanya ijo), dan ternyata yang menyebarkan babi – babi yang sudah terinfeksi ini adalah Alien :D (apaan sih :toe: )

intinya, game shooter sederhana ini, tugasnya adalah nembak babi yang di jatuhkan alien, dan nembak alien (ufo) untuk bisa naik level (ada 5 level), tiap level dibedakan oleh kecepatan babi – babi yang di jatuhkan dan jumlah babi yang dijatuhkan. 

Setiap babi yang tertembak, skor bertambah 10 poin, tapi jika babi sampai jatuh ke tanah, skor minus 10 poin. Adapun jika si pahlawannya :P terkena babi, maka nyawanya berkurang satu. Jika berhasil naik level, nyawa akan bertambah sesuai levelnya.

without further ado, nih screenshotnya:

start  play1 

play2 play3 

Instruksi

1. Mouse : klik kiri untuk tembak, gerak kanan/kiri untuk menggerakkkan hero-nya

2. Keyboard: panah kiri untuk gerak ke kiri, panah kanan untuk ke kanan, dan panah atas untuk tembak

3. Pause:  tombol P

4. Resume:  Tombol R

5. Exit: klik tanda X merah di pojok kanan atas window :D :P

kalau mau main, klik sini   (file .jnlp akan di download, klik file tersebut)

o iya, hati – hati, game ini banyak menggunakan memori :p

untuk mendapatkan efek suaranya, maka pastikan anda terkoneksi dengan internet saat memainkan game ini. hal ini karena javafx masih belum bisa memainkan file audio yang di embed dalam file jar (bugs), sehingga saya memilih menaruh file audio di server dan di stream oleh game.

jadi jika anda tidak terkoneksi internet, ya akan sepi, gak akan terdengar suara ledakan.

 

Selamat bermain belajar. :)

Terjemah Al-Quran Berbahasa Jawa

for recent update, please visit: http://code.google.com/p/myqurantranslation/source/browse/#svn/trunk/Jawa


Alhamdulillahirabbil’aalamiin, segala puji hanya milik Allah, penggenggam alam semesta. Shalawat serta Salam semga selalu tercurah dari-Nya kepada Rasulullah SAW. Akhirnya Milestone I. Terjemah Al-Quran berbahasa jawa telah terlampaui. Pada milestone I ini telah tesedia terjemah al-Quran surah pertama al-Fatihah, Surah ke-18 al-Kahfi, dan surah ke 39Az-Zumar  sampai surah ke-114 An-Naas.

Penulisan terjemah ini boleh dikatakan sangat lambat, karena hanya menggunakan waktu sisa (senggang) sebelum jam 7, atau di tengah hari jam 12-13 atau di malam hari. itupun tidak istiqamah tiap hari :(.  Setelah sampai milestone I, maka saya mengajak semua sahabat sekalian yang ingin turut serta dalam ibadah (insya Allah) ini.  Tidak harus menulis terjemahan, sahabat bisa memeriksa kesalahan terjemahan, kesalahan pengetikan, menambahkan cara baca (alih aksara), ataupun menuliskan ayat al-Quran (bahasa arab). Adapun daftar surah yang telah tersedia terjemahannya adalah sebagai berikut (lihat selengkapnya di wikisource):

Notes: Sepertinya ada beberapa link yang tidak valid, oleh karena itu silahkan pergunakan link surat al-fatihah sebagai starting point untuk melihat surat – surat yang lain.

No. Surat Jml. ayat
1 Al Faatihah 7
2 Al Baqarah 286
3 Ali ‘Imran 200
4 An Nisaa’ 176
5 Al Maa-idah 120
6 Al An’am 165
7 Al A’raaf 206
8 Al Anfaal 75
9 At Taubah 129
10 Yunus 109
11 Huud 123
12 Yusuf 111
13 Ar Ra’d 43
14 Ibrahim 52
15 Al Hijr 99
16 An Nahl 128
17 Al Israa’ 111
18 Al Kahfi 110
19 Maryam 98
20 Thaahaa 135
21 Al Anbiyaa’ 112
22 Al Hajj 78
23 Al Mu’minuun 118
24 An Nuur 64
25 Al Furqaan 77
26 Asy Syu’araa’ 227
27 An Naml 93
28 Al Qashash 88
29 Al ‘Ankabuut 69
30 Ar Ruum 60
31 Luqman 34
32 As Sajdah 30
33 Al Ahzab 73
34 Saba’ 54
35 Faathir 45
36 Yaasiin 83
37 Ash Shaaffat 182
38 Shaad 88
39 Az Zumar 75
40 Al Mu’min 85
41 Fushshilat 54
42 Asy Syuura 53
43 Az Zukhruf 89
44 Ad Dukhaan 59
45 Al Jaatsiyah 37
46 Al Ahqaaf 35
47 Muhammad 38
48 Al Fath 29
49 Al Hujuraat 18
50 Qaaf 45
51 Adz Dzariyaat 60
52 Ath Thuur 49
53 An Najm 62
54 Al Qamar 55
55 Ar Rahmaan 78
56 Al Waaqi’ah 96
57 Al Hadiid 29
No. Surat Jml. ayat
58 Al Mujaadilah 22
59 Al Hasyr 24
60 Al Mumtahanah 13
61 Ash Shaff 14
62 Al Jumu’ah 11
63 Al Munaafiquun 11
64 At Taghaabun 18
65 Ath Thalaaq 12
66 At Tahriim 12
67 Al Mulk 30
68 Al Qalam 52
69 Al Haaqqah 52
70 Al Ma’aarij 44
71 Nuh 28
72 Al Jin 28
73 Al Muzzammil 20
74 Al Muddatstsir 56
75 Al Qiyaamah 40
76 Al Insaan 31
77 Al Mursalaat 50
78 An Naba’ 40
79 An Nazi’at 46
80 ‘Abasa 42
81 At Takwiir 29
82 Al Infithaar 19
83 Al Muthaffifiin 36
84 Al Insyiqaaq 25
85 Al Buruuj 22
86 Ath Thaariq 17
87 Al A’laa 19
88 Al Ghaasyiyah 26
89 Al Fajr 30
90 Al Balad 20
91 Asy Syams 15
92 Al Lail 21
93 Adh Dhuhaa 11
94 Alam Nasyrah 8
95 At Tiin 8
96 Al ‘Alaq 19
97 Al Qadr 5
98 Al Bayyinah 8
99 Al Zalzalah 8
100 Al ‘Aadiyaat 11
101 Al Qaari’ah 11
102 At Takaatsur 8
103 Al ‘Ashr 3
104 Al Humazah 9
105 Al Fiil 5
106 Quraisy 4
107 Al Maa’uun 7
108 Al Kautsar 3
109 Al Kaafiruun 6
110 An Nashr 3
111 Al Lahab 5
112 Al Ikhlash 4
113 Al Falaq 5
114 An Naas 6

Blocking Website

Hari ini, saya memutuskan untuk melindungi diri saya sendiri (dan siapapun yang memakai laptop saya), dengan mengarahkan DNS laptop saya
ke alamat IP ini:

  1. 180.131.144.144 (primary)
  2. 180.131.145.145 (secondary)

Semoga usaha ini bisa salah satu cara untuk melindungi diri, dari hal – hal yang membahayakan kita semua. Dengan melakukan ini, saya juga memiliki alasan untuk memposting tentang hal ini ke dalam blog saya.

Ok, yang ingin tahu atau penasaran dengan apa yang saya lakukan, langsung baca di blog tetangga saja, Nawala Project

Yuk, sama – sama lindungi diri, keluarga dan (pengguna) warnet (jika punya usaha warnet) anda , dengan mengarahkan DNS ke alamat tersebut*.

*dan masih banyak alternatif cara yang lain.

Larry Page’s University of Michigan Commencement Address

Full transcript:  

Class of 2009! First I’d like you to get up, wave and cheer your supportive family and friends! Show your love!

It is a great honor for me to be here today.

Now wait a second. I know: that’s such a cliché. You’re thinking: every graduation speaker says that — It’s a great honor. But, in my case, it really is so deeply true — being here is more special and more personal for me than most of you know. I’d like to tell you why.

A long time ago, in the cold September of 1962, there was a Steven’s co-op at this very university. That co-op had a kitchen with a ceiling that had been cleaned by student volunteers every decade or so. Picture a college girl named Gloria, climbing up high on a ladder, struggling to clean that filthy ceiling. Standing on the floor, a young boarder named Carl was admiring the view. And that’s how they met. They were my parents, so I suppose you could say I’m a direct result of that kitchen chemistry experiment, right here at Michigan. My Mom is here with us today, and we should probably go find the spot and put a plaque up on the ceiling that says: “Thanks Mom and Dad!”

Everyone in my family went to school here at Michigan: me, my brother, my Mom and Dad — all of us. My Dad actually got the quantity discount: all three and a half of his degrees are from here. His Ph.D. was in Communication Science because they thought Computers were just a passing fad. He earned it 44 years ago. He and Mom made a big sacrifice for that. They argued at times over pennies, while raising my newborn brother. Mom typed my Dad’s dissertation by hand. This velvet hood I’m wearing, this was my Dad’s. And this diploma, just like the one you’re are about to get, that was my Dad’s. And my underwear, that was… oh never mind.

My father’s father worked in the Chevy plant in Flint, Michigan. He was an assembly line worker. He drove his two children here to Ann Arbor, and told them: That is where you’re going to go to college. Both his kids did graduate from Michigan. That was the American dream. His daughter, Beverly, is with us today. My Grandpa used to carry an “Alley Oop” hammer — a heavy iron pipe with a hunk of lead melted on the end. The workers made them during the sit-down strikes to protect themselves. When I was growing up, we used that hammer whenever we needed to pound a stake or something into the ground. It is wonderful that most people don’t need to carry a heavy blunt object for protection anymore. But just in case, I have it here.

My Dad became a professor at uh… Michigan State, and I was an incredibly lucky boy. A professor’s life is pretty flexible, and he was able to spend oodles of time raising me. Could there be a better upbringing than university brat?

What I’m trying to tell you is that this is WAY more than just a homecoming for me. It’s not easy for me to express how proud I am to be here, with my Mom, my brother and my wife Lucy, and with all of you, at this amazing institution that is responsible for my very existence. I am thrilled for all of you, and I’m thrilled for your families and friends, as all of us join the great, big Michigan family I feel I’ve been a part of all of my life.

What I’m also trying to tell you is that I know exactly what it feels like to be sitting in your seat, listening to some old gasbag give a long-winded commencement speech. Don’t worry. I’ll be brief.

I have a story about following dreams. Or maybe more accurately, it’s a story about finding a path to make those dreams real.

You know what it’s like to wake up in the middle of the night with a vivid dream? And you know how, if you don’t have a pencil and pad by the bed to write it down, it will be completely gone the next morning?

Well, I had one of those dreams when I was 23. When I suddenly woke up, I was thinking: what if we could download the whole web, and just keep the links and… I grabbed a pen and started writing! Sometimes it is important to wake up and stop dreaming. I spent the middle of that night scribbling out the details and convincing myself it would work. Soon after, I told my advisor, Terry Winograd, it would take a couple of weeks to download the web — he nodded knowingly, fully aware it would take much longer but wise enough to not tell me. The optimism of youth is often underrated! Amazingly, I had no thought of building a search engine. The idea wasn’t even on the radar. But, much later we happened upon a better way of ranking webpages to make a really great search engine, and Google was born. When a really great dream shows up, grab it!

When I was here at Michigan, I had actually been taught how to make dreams real! I know it sounds funny, but that is what I learned in a summer camp converted into a training program called Leadershape. Their slogan is to have a “healthy disregard for the impossible”. That program encouraged me to pursue a crazy idea at the time: I wanted to build a personal rapid transit system on campus to replace the buses. It was a futuristic way of solving our transportation problem. I still think a lot about transportation — you never loose a dream, it just incubates as a hobby. Many things that people labor hard to do now, like cooking, cleaning, and driving will require much less human time in the future. That is, if we “have a healthy disregard for the impossible” and actually build new solutions.

I think it is often easier to make progress on mega-ambitious dreams. I know that sounds completely nuts. But, since no one else is crazy enough to do it, you have little competition. There are so few people this crazy that I feel like I know them all by first name. They all travel as if they are pack dogs and stick to each other like glue. The best people want to work the big challenges. That is what happened with Google. Our mission is to organize the world’s information and make it universally accessible and useful. How can that not get you excited? But we almost didn’t start Google because my co-founder Sergey and I were too worried about dropping out of our Ph.D. program. You are probably on the right track if you feel like a sidewalk worm during a rainstorm! That is about how we felt after we maxed out three credit cards buying hard disks off the back of a truck. That was the first hardware for Google. Parents and friends: more credit cards always help. What is the one sentence summary of how you change the world? Always work hard on something uncomfortably exciting!

As a Ph.D. student, I actually had three projects I wanted to work on. Thank goodness my advisor said, “why don’t you work on the web for a while”. He gave me some seriously good advice because the web was really growing with people and activity, even in 1995! Technology and especially the internet can really help you be lazy. Lazy? What I mean is a group of three people can write software that millions can use and enjoy. Can three people answer the phone a million times a day? Find the leverage in the world, so you can be more lazy!

Overall, I know it seems like the world is crumbling out there, but it is actually a great time in your life to get a little crazy, follow your curiosity, and be ambitious about it. Don’t give up on your dreams. The world needs you all!

So here’s my final story:

On a day like today, you might feel exhilarated — like you’ve just been shot out of a cannon at the circus — and even invincible. Don’t ever forget that incredible feeling. But also: always remember that the moments we have with friends and family, the chances we have to do things that might make a big difference in the world, or even to make a small difference to someone you love — all those wonderful chances that life gives us, life also takes away. It can happen fast, and a whole lot sooner than you think.

In late March 1996, soon after I had moved to Stanford for grad school, my Dad had difficultly breathing and drove to the hospital. Two months later, he died. And that was it. I was completely devastated. Many years later, after a startup, after falling in love, and after so many of life’s adventures, I found myself thinking about my Dad. Lucy and I were far away in a steaming hot village walking through narrow streets. There were wonderful friendly people everywhere, but it was a desperately poor place — people used the bathroom inside and it flowed out into the open gutter and straight into the river. We touched a boy with a limp leg, the result of paralysis from polio. Lucy and I were in rural India — one of the few places where Polio still exists. Polio is transmitted fecal to oral, usually through filthy water. Well, my Dad had Polio. He went on a trip to Tennessee in the first grade and caught it. He was hospitalized for two months and had to be transported by military DC-3 back home — his first flight. My Dad wrote, “Then, I had to stay in bed for over a year, before I started back to school”. That is actually a quote from his fifth grade autobiography. My Dad had difficulty breathing his whole life, and the complications of Polio are what took him from us too soon. He would have been very upset that Polio still persists even though we have a vaccine. He would have been equally upset that back in India we had polio virus on our shoes from walking through the contaminated gutters that spread the disease. We were spreading the virus with every footstep, right under beautiful kids playing everywhere. The world is on the verge of eliminating polio, with 328 people infected so far this year. Let’s get it done soon. Perhaps one of you will do that.

My Dad was valedictorian of Flint Mandeville High School 1956 class of about 90 kids. I happened across his graduating speech recently, and it blew me away. 53 years ago at his graduation my Dad said: “…we are entering a changing world, one of automation and employment change where education is an economic necessity. We will have increased periods of time to do as we wish, as our work week and retirement age continue to decline. … We shall take part in, or witness, developments in science, medicine, and industry that we can not dream of today. … It is said that the future of any nation can be determined by the care and preparation given to its youth. If all the youths of America were as fortunate in securing an education as we have been, then the future of the United States would be even more bright than it is today.”

If my Dad was alive today, the thing I think he would be most happy about is that Lucy and I have a baby in the hopper. I think he would have been annoyed that I hadn’t gotten my Ph.D. yet (thanks, Michigan!). Dad was so full of insights, of excitement about new things, that to this day, I often wonder what he would think about some new development. If he were here today — well, it would be one of the best days of his life. He’d be like a kid in a candy store. For a day, he’d be young again.

Many of us are fortunate enough to be here with family. Some of us have dear friends and family to go home to. And who knows, perhaps some of you, like Lucy and I, are dreaming about future families of your own. Just like me, your families brought you here, and you brought them here. Please keep them close and remember: they are what really matters in life.

Thanks, Mom; Thanks, Lucy.
And thank you, all, very much.