Advertisement
DizzyFoxkit

getText()

May 3rd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. public void actionPerformed(ActionEvent e) {
  2.             try { inputtext = gui.input.getText().toUpperCase(); }
  3.             catch (IllegalArgumentException x) {
  4.                 gui.output.setText("Please enter either a Roman Numeral or a Number");
  5.             }
  6.             for (int i = 0; i < inputtext.length(); i++) {
  7.                     if (constants.contains(inputtext.charAt(i))) {
  8.                     charinput = inputtext.toCharArray();
  9.                 } else { gui.output.setText("Please enter a Roman Numeral");}
  10.             }
  11.            
  12.             for (int i = 0; i < charinput.length; i++) {
  13.                 /*
  14.                 // Order:
  15.                 // 1) checks to see if previous is a roman numeral
  16.                 // 2) checks to see if previous is a higher number
  17.                 // 3) minuses from total based on previous
  18.                 // 4) adds to toal based on current place in loop
  19.                 */
  20.                 if (constants.contains(previous)) {
  21.                     System.out.println(charinput.length);
  22.                     for (int x = 0; x < charinput.length; x ++) {
  23.                         System.out.println(charinput[x]);
  24.                     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement