Tampilann pertanyaannya:
Kalau Jawabannya Ya/yes tampillannya:
Kalau jawabannya tidak/No tampilannya:
java code nya:
import javax.swing.*;
{
public static void main(String args[])
{
int i = JOptionPane.showConfirmDialog(null,
"Do you like the color red?",
"My Swing Application",
JOptionPane.YES_NO_OPTION);
if( i==JOptionPane.YES_OPTION )
{
JOptionPane.showMessageDialog(
null,
"Good, I like it too!",
"My Swing Application",
JOptionPane.ERROR_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(
null,
"Why? It is a very nice color!",
"My Swing Application",
JOptionPane.ERROR_MESSAGE);
}
}
}