Java How To: Dialog Boxes

preview_player
Показать описание
Today I talk about JDialog boxes, more specifically InputDialog, MessageDialog, and OptionDialog.
SOURCE CODE BELOW:

package jdialog_javatutorial;

/**
*
* @author Vincent
*/
public class JDialog_JavaTutorial {

public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
JFrame window = new JFrame("JDialog: Java Tutorial");
final JPanel TopPanel = new JPanel();
final JButton addButton = new JButton("Add numbers");
final JTextField answerText = new JTextField(10);
Font font1 = new Font("SansSerif", Font.BOLD, 48);
public void actionPerformed(ActionEvent e) {
try {
/*
0 = yes
1 = no
*/
if (confirm != 1) {
} else {
//no
}
} catch (Exception ex) {

}
}
});
}
}
Рекомендации по теме
Комментарии
Автор

Worked perfectly for my program, finally a guy who knows how to make a working tutorial (including you code in the description was great ty :D)

slowpoke
Автор

I've been looking for a good tutorial for making a dialog box popup. This is helpful. I can totally adapt the code for different instances.

katty
Автор

One of the few tutorial creators I enjoy...

KyleD
Автор

On the option or rather dialog, what if you select no. How to you terminate the process from running, because when you select yes, the process continues

leonromo
Автор

I'm still not sure how this works.

AmateurContendr
visit shbcf.ru