|
52 | 52 | import javax.swing.JFileChooser; |
53 | 53 |
|
54 | 54 | // set the look and feel, if specified |
55 | | -import javax.swing.UIManager; |
56 | 55 |
|
57 | 56 | // used by link() |
58 | 57 | import java.awt.Desktop; |
59 | 58 |
|
60 | 59 | // used by desktopFile() method |
61 | | -import javax.swing.filechooser.FileSystemView; |
62 | 60 |
|
63 | 61 | // loadXML() error handling |
64 | 62 | import javax.xml.parsers.ParserConfigurationException; |
|
78 | 76 | import java.util.concurrent.ThreadFactory; |
79 | 77 | import java.util.regex.*; |
80 | 78 | import java.util.zip.*; |
81 | | -import javax.swing.UnsupportedLookAndFeelException; |
82 | 79 |
|
83 | 80 | import processing.data.*; |
84 | 81 | import processing.event.*; |
@@ -328,7 +325,7 @@ public class PApplet implements PConstants { |
328 | 325 | * is doubled. As a result, all operations that use pixels (like |
329 | 326 | * <b>loadPixels()</b>, <b>get()</b>, <b>set()</b>, etc.) happen in this |
330 | 327 | * doubled space. As a convenience, the variables <b>pixelWidth</b> |
331 | | - * and <b>pixelHeight<b> hold the actual width and height of the sketch in |
| 328 | + * and <b>pixelHeight</b> hold the actual width and height of the sketch in |
332 | 329 | * pixels. This is useful for any sketch that uses the <b>pixels[]</b> |
333 | 330 | * array, for instance, because the number of elements in the array will be |
334 | 331 | * <b>pixelWidth*pixelHeight</b>, not <b>width*height</b>. |
@@ -1451,17 +1448,19 @@ protected int findIndex(Object object) { |
1451 | 1448 | * @param target the target object that should receive the event |
1452 | 1449 | */ |
1453 | 1450 | public void registerMethod(String methodName, Object target) { |
1454 | | - if (methodName.equals("mouseEvent")) { |
1455 | | - registerWithArgs("mouseEvent", target, new Class[]{processing.event.MouseEvent.class}); |
1456 | | - |
1457 | | - } else if (methodName.equals("keyEvent")) { |
1458 | | - registerWithArgs("keyEvent", target, new Class[]{processing.event.KeyEvent.class}); |
1459 | | - |
1460 | | - } else if (methodName.equals("touchEvent")) { |
1461 | | - registerWithArgs("touchEvent", target, new Class[]{processing.event.TouchEvent.class}); |
1462 | | - |
1463 | | - } else { |
1464 | | - registerNoArgs(methodName, target); |
| 1451 | + switch (methodName) { |
| 1452 | + case "mouseEvent": |
| 1453 | + registerWithArgs("mouseEvent", target, new Class[]{processing.event.MouseEvent.class}); |
| 1454 | + break; |
| 1455 | + case "keyEvent": |
| 1456 | + registerWithArgs("keyEvent", target, new Class[]{processing.event.KeyEvent.class}); |
| 1457 | + break; |
| 1458 | + case "touchEvent": |
| 1459 | + registerWithArgs("touchEvent", target, new Class[]{processing.event.TouchEvent.class}); |
| 1460 | + break; |
| 1461 | + default: |
| 1462 | + registerNoArgs(methodName, target); |
| 1463 | + break; |
1465 | 1464 | } |
1466 | 1465 | } |
1467 | 1466 |
|
|
0 commit comments