Is there a way to have an option to go the a previous message dialog box or a next one? I have a program where after all the input and math calculations is done, a message dialog box appears with the information for "Person 1" then you press ok and the one for "Person 2" appears. It would be nice if there could be an option to be able to navigate between the different dialog boxes. Here is the part of the program that prints the messages.
for (i = 0; i < NumEmployees; i++)
{
JOptionPane.showMessageDialog(null,
"Employee: " + names[i] + "\n" +
"ID: " + data[i][0] + "\n" +
"Hours worked: " + (data[i][1] + data[i][2]) + "\n" +
"Overtime: " + data[i][2] + "hours" + "\n" +
"Amount earned: " + payment[i]);
}
Use
Action
"to separate functionality and state from a component." In the example below, the actions change theindex
andupdate()
aJLabel
from aList<String>
. Your application might update aJTextArea
from aList<Employee>
.