subject

What does the following code do?

package shop. ui;
import javax. swing. JOptionPane;
//import java. io. IOException;

final class PopupUI implements UI {
PopupUI() {}
public void displayMessage(String message) {
JOptionPane. showMessageDialog(null, message);
}
public void displayError(String message) {
JOptionPane. showMessageDialog(null, message,"Error",JOptionPane. ERROR_MESSAGE);
}
public void processMenu(UIMenu menu) {
StringBuffer b = new StringBuffer();
b. append(menu. getHeading());
b. append("\n");
b. append("Enter choice by number:");
b. append("\n");
for (int i = 1; i < menu. size(); i++) {
b. append(" " + i + ". " + menu. getPrompt(i));
b. append("\n");
}
String response = JOptionPane. showInputDialog(b. toString());
int selection;
try {
selection = Integer. parseInt(response, 10);
if ((selection < 0) || (selection >= menu. size()))
selection = 0;
} catch (NumberFormatException e) {
selection = 0;
}
menu. runAction(selection);
}
public String[] processForm(UIForm form) {
// TODO
String[]formArray = new String[form. size()];
for(int i=0;i {
String message = JOptionPane. showInputDialog(form. getPrompt(i));
formArray[i] = message;
}
return formArray;
}
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:30, artursino
Me2540 week 5 assignment what do i want to know?
Answers: 1
image
Computers and Technology, 23.06.2019 04:00, china236
In a word processing program, such as microsoft word, which feature to you choose the desired picture enhancement?
Answers: 2
image
Computers and Technology, 23.06.2019 08:00, Buddy01
Match the items with their respective descriptions.
Answers: 1
image
Computers and Technology, 23.06.2019 12:40, Emilyvite6251
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
You know the right answer?
What does the following code do?

package shop. ui;
import javax. swing. JOptionPan...

Questions in other subjects:

Konu
Mathematics, 09.04.2021 18:40
Konu
Mathematics, 09.04.2021 18:40
Konu
Mathematics, 09.04.2021 18:40