Hi,
I am new to Java Programming and I am trying to write code using JOption
pane to prompt user to type information and then have string output command
to display information on the screen.
I am able to prompt for typing the information but the display does not
work. Here is my sample code:
**
/**
* <p>TitleTesting </p>
* <p>Descriptio : Display Movie list</p>
*
*/
//Print Address Labels
import javax.swing.JOp tionPane;
public class Homework1 {
public Homework1() {
}
public static void main(String[] args) {
String movieName;
String theaterName;
//Enter Movie Name
String movieName =
JOptionPane.sho wInputDialog(
null, "Enter the Name of the Movie ",
"Example 1.0 Input",
JOptionPane.QUE STION_MESSAGE);
//Enter Name
String directorName=
JOptionPane.sho wInputDialog(
null, "Enter Name of Director ",
"Example 1.1 Input",
JOptionPane.QUE STION_MESSAGE);
//Display Name of Movie and Director
String output = movieName+ directorName
JOptionPane.sho wMessageDialog( null,output,"Ex ample 1.2 output",
JOptionPane.INF ORMATION_MESSAG E);
System.exit(0);
}
}
I am new to Java Programming and I am trying to write code using JOption
pane to prompt user to type information and then have string output command
to display information on the screen.
I am able to prompt for typing the information but the display does not
work. Here is my sample code:
**
/**
* <p>TitleTesting </p>
* <p>Descriptio : Display Movie list</p>
*
*/
//Print Address Labels
import javax.swing.JOp tionPane;
public class Homework1 {
public Homework1() {
}
public static void main(String[] args) {
String movieName;
String theaterName;
//Enter Movie Name
String movieName =
JOptionPane.sho wInputDialog(
null, "Enter the Name of the Movie ",
"Example 1.0 Input",
JOptionPane.QUE STION_MESSAGE);
//Enter Name
String directorName=
JOptionPane.sho wInputDialog(
null, "Enter Name of Director ",
"Example 1.1 Input",
JOptionPane.QUE STION_MESSAGE);
//Display Name of Movie and Director
String output = movieName+ directorName
JOptionPane.sho wMessageDialog( null,output,"Ex ample 1.2 output",
JOptionPane.INF ORMATION_MESSAG E);
System.exit(0);
}
}
Comment