(PropertyChangeEvent event)
| 38 | public static Color c = new Color(1, 2, 3); |
| 39 | |
| 40 | @SuppressWarnings("null") |
| 41 | @Override |
| 42 | public void propertyChange(PropertyChangeEvent event) { |
| 43 | Object val = event.getNewValue(); |
| 44 | String name = event.getPropertyName(); |
| 45 | System.out.println(name); |
| 46 | switch (event.getSource().getClass().getName()) { |
| 47 | case "javax.swing.JOptionPane": |
| 48 | switch (name) { |
| 49 | case "inputValue": |
| 50 | onDialogReturn(val); |
| 51 | return; |
| 52 | case "value": |
| 53 | if (val instanceof Integer) |
| 54 | onDialogReturn(((Integer) val).intValue()); |
| 55 | else |
| 56 | onDialogReturn(val); |
| 57 | return; |
| 58 | } |
| 59 | break; |
| 60 | case "javax.swing.ColorChooserDialog": |
| 61 | switch (name) { |
| 62 | case "SelectedColor": |
| 63 | onDialogReturn(val); |
| 64 | return; |
| 65 | } |
| 66 | break; |
| 67 | case "javax.swing.JFileChooser": |
| 68 | switch (name) { |
| 69 | case "SelectedFiles": |
| 70 | File[] files = (File[]) val; |
| 71 | long[] len = new long[files.length]; |
| 72 | for (int i = 0; i < files.length; i++) { |
| 73 | len[i] = files[i].length(); |
| 74 | } |
| 75 | onDialogReturn(files.length + " files read sizes=" + len); |
| 76 | return; |
| 77 | case "SelectedFile": |
| 78 | File file = (File) val; |
| 79 | byte[] array = (val == null ? null : /** @j2sNative file.秘bytes || */ |
| 80 | null); |
| 81 | onDialogReturn("fileName is '" + file.getName() + " size=" + (array == null ? null : array.length)); |
| 82 | return; |
| 83 | } |
| 84 | break; |
| 85 | } |
| 86 | System.out.println( |
| 87 | event.getSource().getClass().getName() + " " + event.getPropertyName() + ": " + event.getNewValue()); |
| 88 | } |
| 89 | |
| 90 | // JSComponent.DialogCaller interface |
| 91 | public void onDialogReturn(int value) { |
nothing calls this directly
no test coverage detected