@@ -1337,17 +1337,19 @@ protected int findIndex(Object object) {
1337
1337
* @param target the target object that should receive the event
1338
1338
*/
1339
1339
public void registerMethod(String methodName, Object target) {
1340
- if (methodName.equals("mouseEvent")) {
1341
- registerWithArgs("mouseEvent", target, new Class[]{processing.event.MouseEvent.class});
1342
-
1343
- } else if (methodName.equals("keyEvent")) {
1344
- registerWithArgs("keyEvent", target, new Class[]{processing.event.KeyEvent.class});
1345
-
1346
- } else if (methodName.equals("touchEvent")) {
1347
- registerWithArgs("touchEvent", target, new Class[]{processing.event.TouchEvent.class});
1348
-
1349
- } else {
1350
- registerNoArgs(methodName, target);
1340
+ switch (methodName) {
1341
+ case "mouseEvent":
1342
+ registerWithArgs("mouseEvent", target, new Class[]{processing.event.MouseEvent.class});
1343
+ break;
1344
+ case "keyEvent":
1345
+ registerWithArgs("keyEvent", target, new Class[]{processing.event.KeyEvent.class});
1346
+ break;
1347
+ case "touchEvent":
1348
+ registerWithArgs("touchEvent", target, new Class[]{processing.event.TouchEvent.class});
1349
+ break;
1350
+ default:
1351
+ registerNoArgs(methodName, target);
1352
+ break;
1351
1353
}
1352
1354
}
1353
1355
@@ -2086,7 +2088,7 @@ protected PGraphics makeGraphics(int w, int h,
2086
2088
+ " renderer is not in the class path.");
2087
2089
}
2088
2090
2089
- } catch (Exception e) {
2091
+ } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException e) {
2090
2092
if ((e instanceof IllegalArgumentException)
2091
2093
|| (e instanceof NoSuchMethodException)
2092
2094
|| (e instanceof IllegalAccessException)) {
@@ -2116,6 +2118,7 @@ protected PGraphics makeGraphics(int w, int h,
2116
2118
/**
2117
2119
* Create default renderer, likely to be resized, but needed for surface
2118
2120
* init.
2121
+ * @return
2119
2122
*/
2120
2123
protected PGraphics createPrimaryGraphics() {
2121
2124
return makeGraphics(sketchWidth(), sketchHeight(),
@@ -2125,9 +2128,9 @@ protected PGraphics createPrimaryGraphics() {
2125
2128
/**
2126
2129
* ( begin auto-generated from createImage.xml )
2127
2130
*
2128
- * Creates a new PImage (the datatype for storing images). This provides a
2129
- * fresh buffer of pixels to play with. Set the size of the buffer with the
2130
- * <b>width</b> and <b>height</b> parameters. The <b>format</b> parameter
2131
+ * Creates a new PImage (the datatype for storing images).This provides a
2132
+ fresh buffer of pixels to play with. Set the size of the buffer with the
2133
+ <b>width</b> and <b>height</b> parameters. The <b>format</b> parameter
2131
2134
* defines how the pixels are stored. See the PImage reference for more
2132
2135
* information.
2133
2136
*
@@ -2143,6 +2146,7 @@ protected PGraphics createPrimaryGraphics() {
2143
2146
* to the parent PApplet is included, which makes save() work without
2144
2147
* needing an absolute path.
2145
2148
*
2149
+ * @return
2146
2150
* @webref image
2147
2151
* @param w width in pixels
2148
2152
* @param h height in pixels
@@ -2401,6 +2405,7 @@ public boolean isLooping() {
2401
2405
/**
2402
2406
* Add an event to the internal event queue, or process it immediately if
2403
2407
* the sketch is not currently looping.
2408
+ * @param pe
2404
2409
*/
2405
2410
public void postEvent(processing.event.Event pe) {
2406
2411
eventQueue.add(pe);
@@ -3187,14 +3192,14 @@ public void link(String url) {
3187
3192
/**
3188
3193
* ( begin auto-generated from launch.xml )
3189
3194
*
3190
- * Attempts to open an application or file using your platform's launcher.
3191
- * The <b>file</b> parameter is a String specifying the file name and
3192
- * location. The location parameter must be a full path name, or the name of
3193
- * an executable in the system's PATH. In most cases, using a full path is
3194
- * the best option, rather than relying on the system PATH. Be sure to make
3195
- * the file executable before attempting to open it (chmod +x).
3196
- *
3197
- * The <b>args</b> parameter is a String or String array which is passed to
3195
+ * Attempts to open an application or file using your platform's launcher.The <b>file</b> parameter is a String specifying the file name and
3196
+ location.
3197
+ * The location parameter must be a full path name, or the name of
3198
+ an executable in the system's PATH. In most cases, using a full path is
3199
+ the best option, rather than relying on the system PATH. Be sure to make
3200
+ the file executable before attempting to open it (chmod +x).
3201
+
3202
+ The <b>args</b> parameter is a String or String array which is passed to
3198
3203
* the command line. If you have multiple parameters, e.g. an application
3199
3204
* and a document, or a command with multiple switches, use the version that
3200
3205
* takes a String array, and place each individual item in a separate
@@ -3219,49 +3224,52 @@ public void link(String url) {
3219
3224
*
3220
3225
* ( end auto-generated )
3221
3226
*
3227
+ * @return
3222
3228
* @webref input:files
3223
3229
* @param args arguments to the launcher, eg. a filename.
3224
3230
* @usage Application
3225
3231
*/
3226
3232
static public Process launch(String... args) {
3227
3233
String[] params = null;
3228
3234
3229
- if (platform == WINDOWS) {
3230
- // just launching the .html file via the shell works
3231
- // but make sure to chmod +x the .html files first
3232
- // also place quotes around it in case there's a space
3233
- // in the user.dir part of the url
3234
- params = new String[]{"cmd", "/c"};
3235
-
3236
- } else if (platform == MACOS) {
3237
- params = new String[]{"open"};
3238
-
3239
- } else if (platform == LINUX) {
3240
- // xdg-open is in the Free Desktop Specification and really should just
3241
- // work on desktop Linux. Not risking it though.
3242
- final String[] launchers = {"xdg-open", "gnome-open", "kde-open"};
3243
- for (String launcher : launchers) {
3244
- if (openLauncher != null) {
3245
- break;
3246
- }
3247
- try {
3248
- Process p = Runtime.getRuntime().exec(new String[]{launcher});
3249
- /*int result =*/ p.waitFor();
3250
- // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04)
3251
- openLauncher = launcher;
3252
- } catch (Exception e) {
3235
+ switch (platform) {
3236
+ case WINDOWS:
3237
+ // just launching the .html file via the shell works
3238
+ // but make sure to chmod +x the .html files first
3239
+ // also place quotes around it in case there's a space
3240
+ // in the user.dir part of the url
3241
+ params = new String[]{"cmd", "/c"};
3242
+ break;
3243
+ case MACOS:
3244
+ params = new String[]{"open"};
3245
+ break;
3246
+ case LINUX:
3247
+ // xdg-open is in the Free Desktop Specification and really should just
3248
+ // work on desktop Linux. Not risking it though.
3249
+ final String[] launchers = {"xdg-open", "gnome-open", "kde-open"};
3250
+ for (String launcher : launchers) {
3251
+ if (openLauncher != null) {
3252
+ break;
3253
+ }
3254
+ try {
3255
+ Process p = Runtime.getRuntime().exec(new String[]{launcher});
3256
+ /*int result =*/ p.waitFor();
3257
+ // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04)
3258
+ openLauncher = launcher;
3259
+ } catch (Exception e) {
3260
+ }
3261
+ } if (openLauncher == null) {
3262
+ System.err.println("Could not find xdg-open, gnome-open, or kde-open: "
3263
+ + "the open() command may not work.");
3264
+ } if (openLauncher != null) {
3265
+ params = new String[]{openLauncher};
3253
3266
}
3254
- }
3255
- if (openLauncher == null) {
3256
- System.err.println("Could not find xdg-open, gnome-open, or kde-open: "
3257
- + "the open() command may not work.");
3258
- }
3259
- if (openLauncher != null) {
3260
- params = new String[]{openLauncher};
3261
- }
3262
- //} else { // give up and just pass it to Runtime.exec()
3263
- //open(new String[] { filename });
3264
- //params = new String[] { filename };
3267
+ //} else { // give up and just pass it to Runtime.exec()
3268
+ //open(new String[] { filename });
3269
+ //params = new String[] { filename };
3270
+ break;
3271
+ default:
3272
+ break;
3265
3273
}
3266
3274
if (params != null) {
3267
3275
// If the 'open', 'gnome-open' or 'cmd' are already included
@@ -7527,6 +7535,7 @@ static public String[] expand(String[] list, int newSize) {
7527
7535
}
7528
7536
7529
7537
/**
7538
+ * @param array
7530
7539
* @nowebref
7531
7540
*/
7532
7541
static public Object expand(Object array) {
@@ -9649,6 +9658,7 @@ public void frameResized(int w, int h) {
9649
9658
* All parameters *after* the sketch class name are passed to the sketch
9650
9659
* itself and available from its 'args' array while the sketch is running.
9651
9660
*
9661
+ * @param args
9652
9662
* @see PApplet#args
9653
9663
* </PRE>
9654
9664
*/
@@ -9659,6 +9669,8 @@ static public void main(final String[] args) {
9659
9669
/**
9660
9670
* Convenience method so that PApplet.main(YourSketch.class) launches a
9661
9671
* sketch, rather than having to call getName() on it.
9672
+ * @param mainClass
9673
+ * @param args
9662
9674
*/
9663
9675
static public void main(final Class<?> mainClass, String... args) {
9664
9676
main(mainClass.getName(), args);
0 commit comments