Membuat pesan pilhan dengan JOptionPane (ya dan tidak)


/*
* Program ini dibuat oleh Rachmad Hadi Wijoyo
* anda boleh mengunakan dan mendistribusikan dengan bebas
* asalkan tidak mengubah license ini.
* copyright by Rachmad Hadi Wijoyo
*/

package cobacoba;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.TrayIcon.MessageType;
import javax.swing.Icon;
import javax.swing.JOptionPane;

/**
*
* @author rahw
*/
public class OptionDialog {
public OptionDialog(){

String pil[] = {“Ya”,”Tidak”};

if(JOptionPane.showOptionDialog(null, “Anda yakin da pengen keluar? “, “Coba ShowOptionDialog”,JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, pil, this)==JOptionPane.YES_OPTION){
System.exit(0);
}
}
public static void main(String args[]){
new OptionDialog();
}
}

http://rachmad-hw.blogspot.com/2008/09/kumpulan-e-book-java.html

Advertisements

One thought on “Membuat pesan pilhan dengan JOptionPane (ya dan tidak)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s