362 return getStandardViewButton(iconIndex);
363 } else if (key.startsWith("optionPaneIcon ")) {
364 Win32ShellFolder2.SystemIcon iconType;
365 if (key == "optionPaneIcon Error") {
366 iconType = Win32ShellFolder2.SystemIcon.IDI_ERROR;
367 } else if (key == "optionPaneIcon Information") {
368 iconType = Win32ShellFolder2.SystemIcon.IDI_INFORMATION;
369 } else if (key == "optionPaneIcon Question") {
370 iconType = Win32ShellFolder2.SystemIcon.IDI_QUESTION;
371 } else if (key == "optionPaneIcon Warning") {
372 iconType = Win32ShellFolder2.SystemIcon.IDI_EXCLAMATION;
373 } else {
374 return null;
375 }
376 return Win32ShellFolder2.getSystemIcon(iconType);
377 } else if (key.startsWith("shell32Icon ") || key.startsWith("shell32LargeIcon ")) {
378 String name = key.substring(key.indexOf(" ") + 1);
379 try {
380 int i = Integer.parseInt(name);
381 if (i >= 0) {
382 return Win32ShellFolder2.getShell32Icon(i, key.startsWith("shell32LargeIcon "));
383 }
384 } catch (NumberFormatException ex) {
385 }
386 }
387 return null;
388 }
389
390 private File checkFile(File file) {
391 SecurityManager sm = System.getSecurityManager();
392 return (sm == null || file == null) ? file : checkFile(file, sm);
393 }
394
395 private File checkFile(File file, SecurityManager sm) {
396 try {
397 sm.checkRead(file.getPath());
398 return file;
399 } catch (SecurityException se) {
400 return null;
401 }
402 }
|
362 return getStandardViewButton(iconIndex);
363 } else if (key.startsWith("optionPaneIcon ")) {
364 Win32ShellFolder2.SystemIcon iconType;
365 if (key == "optionPaneIcon Error") {
366 iconType = Win32ShellFolder2.SystemIcon.IDI_ERROR;
367 } else if (key == "optionPaneIcon Information") {
368 iconType = Win32ShellFolder2.SystemIcon.IDI_INFORMATION;
369 } else if (key == "optionPaneIcon Question") {
370 iconType = Win32ShellFolder2.SystemIcon.IDI_QUESTION;
371 } else if (key == "optionPaneIcon Warning") {
372 iconType = Win32ShellFolder2.SystemIcon.IDI_EXCLAMATION;
373 } else {
374 return null;
375 }
376 return Win32ShellFolder2.getSystemIcon(iconType);
377 } else if (key.startsWith("shell32Icon ") || key.startsWith("shell32LargeIcon ")) {
378 String name = key.substring(key.indexOf(" ") + 1);
379 try {
380 int i = Integer.parseInt(name);
381 if (i >= 0) {
382 return Win32ShellFolder2.getShell32Icon(i, key.startsWith("shell32LargeIcon ")?
383 32 : 16);
384 }
385 } catch (NumberFormatException ex) {
386 }
387 }
388 return null;
389 }
390
391 private File checkFile(File file) {
392 SecurityManager sm = System.getSecurityManager();
393 return (sm == null || file == null) ? file : checkFile(file, sm);
394 }
395
396 private File checkFile(File file, SecurityManager sm) {
397 try {
398 sm.checkRead(file.getPath());
399 return file;
400 } catch (SecurityException se) {
401 return null;
402 }
403 }
|