What does the following code do?
package shop. ui;
import javax. swing. JOptionPan...
Computers and Technology, 29.05.2020 17:59 Pizzapegasus1
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;
}
}
Answers: 2
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
Health, 09.04.2021 18:40
Mathematics, 09.04.2021 18:40
Mathematics, 09.04.2021 18:40
Mathematics, 09.04.2021 18:40
Mathematics, 09.04.2021 18:40
Biology, 09.04.2021 18:40
Mathematics, 09.04.2021 18:40
History, 09.04.2021 18:40