Categories

a simple dialog box using swing

the nhonoured tradition of hello world in a dialog box

a simple dialog box using swing

import javax.swing.JOptionPane;

public class Tester {

public static void main(String[] args) {

JOptionPane.showMessageDialog(null

Bookmark It

accept users input using input dialog box

this example accepts users input using the input dialog box and then displays a message

accept users input using input dialog box

import javax.swing.JOptionPane;

public class Tester {

public static void main(String[] args) { String name; //get users name using input dialog box name = JOptionPane.showInputDialog("Please enter your name"); //display users name JOptionPane.showMessageDialog(null

Bookmark It

user input simple calculation example

process user input and add 2 numbers then display the result

user input simple calculation example

import javax.swing.JOptionPane;

public class Tester {

public static void main(String[] args) { String Number1; String Number2; int num1; int num2; int result;

//get users name using input dialog box Number1 = JOptionPane.showInputDialog("Please enter number 1"); Number2 = JOptionPane.showInputDialog("Please enter number 2"); [...]