Answers for "processing id create"

0

processing id create

/** 
 * No Repeat ID Input (v1.10)
 * by GoToLoop (2013/Nov)
 * 
 * forum.processing.org/two/discussion/869
 * /check-array-contents-with-arraylist
 */
 
import static javax.swing.JOptionPane.*;
 
final StringList ids = new StringList( new String[] {
  "Eric", "Beth", "Katniss"
} 
);
 
void draw() {
  println(ids);
 
  final String id = showInputDialog("Please enter new ID");
 
  if (id == null)   exit();
 
  else if ("".equals(id))
    showMessageDialog(null, "Empty ID Input!!!", 
    "Alert", ERROR_MESSAGE);
 
  else if (ids.hasValue(id))
    showMessageDialog(null, "ID \"" + id + "\" exists already!!!", 
    "Alert", ERROR_MESSAGE);
 
  else {
    showMessageDialog(null, "ID \"" + id + "\" successfully added!!!", 
    "Info", INFORMATION_MESSAGE);
    ids.append(id);
  }
}
Posted by: Guest on November-03-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language