28
28
import java .io .IOException ;
29
29
import java .net .URI ;
30
30
31
- import javax .swing .Icon ;
32
31
import javax .swing .JMenu ;
33
32
import javax .swing .JMenuBar ;
34
- import javax .swing .UIManager ;
35
- import javax .swing .plaf .FontUIResource ;
36
33
37
34
import processing .app .Base ;
38
35
import processing .app .Messages ;
@@ -95,6 +92,7 @@ public void initBase(Base base) {
95
92
}
96
93
97
94
95
+ /*
98
96
@Override
99
97
public void setLookAndFeel() throws Exception {
100
98
super.setLookAndFeel();
@@ -118,6 +116,7 @@ public void setLookAndFeel() throws Exception {
118
116
UIManager.put("Tree.leafIcon", leaf);
119
117
}
120
118
}
119
+ */
121
120
122
121
123
122
public File getSettingsFolder () throws Exception {
@@ -151,13 +150,21 @@ public void openURL(String url) throws Exception {
151
150
// TODO I suspect this won't work much longer, since access to the user's
152
151
// home directory seems verboten on more recent macOS versions [fry 191008]
153
152
protected String getLibraryFolder () throws FileNotFoundException {
154
- return System .getProperty ("user.home" ) + "/Library" ;
153
+ File folder = new File (System .getProperty ("user.home" ), "Library" );
154
+ if (!folder .exists ()) {
155
+ throw new FileNotFoundException ("Folder missing: " + folder );
156
+ }
157
+ return folder .getAbsolutePath ();
155
158
}
156
159
157
160
158
161
// TODO see note on getLibraryFolder()
159
162
protected String getDocumentsFolder () throws FileNotFoundException {
160
- return System .getProperty ("user.home" ) + "/Documents" ;
163
+ File folder = new File (System .getProperty ("user.home" ), "Documents" );
164
+ if (!folder .exists ()) {
165
+ throw new FileNotFoundException ("Folder missing: " + folder );
166
+ }
167
+ return folder .getAbsolutePath ();
161
168
}
162
169
163
170
@@ -204,73 +211,73 @@ protected String getDocumentsFolder() throws FileNotFoundException {
204
211
// VAQUA WORKAROUNDS FROM SAM
205
212
206
213
207
- /**
208
- * Spacer icon for macOS when using Vaqua.
209
-
210
- * Due to potential rendering issues, this small spacer is used
211
- * to ensure that rendering is stable while using Vaqua with non-standard
212
- * Swing components. Without this, some sizing calculations non-standard
213
- * components may fail or become unreliable.
214
- */
215
- static class VAquaEmptyIcon implements Icon {
216
- private final int SIZE = 1 ;
217
-
218
- @ Override
219
- public int getIconWidth () {
220
- return SIZE ;
221
- }
222
-
223
- @ Override
224
- public int getIconHeight () {
225
- return SIZE ;
226
- }
227
-
228
- @ Override
229
- public void paintIcon (Component c , Graphics g , int x , int y ) { }
230
- }
231
-
232
-
233
- /**
234
- * Replacement tree icon for macOS when using Vaqua.
235
- *
236
- * Due to potential rendering issues with the regular tree icon set,
237
- * this replacement tree icon for macOS ensures stable rendering when using
238
- * Vaqua with non-standard swing components. Without this, some sizing
239
- * calculations within non-standard components may fail or become unreliable.
240
- */
241
- static private class VAquaTreeIcon implements Icon {
242
- private final int SIZE = 12 ;
243
- private final boolean isOpen ;
244
-
245
- /**
246
- * Create a new tree icon.
247
- *
248
- * @param newIsOpen Flag indicating if the icon should be in the open or closed state at
249
- * construction. True if open false otherwise.
250
- */
251
- public VAquaTreeIcon (boolean newIsOpen ) {
252
- isOpen = newIsOpen ;
253
- }
254
-
255
- @ Override
256
- public int getIconWidth () {
257
- return SIZE ;
258
- }
259
-
260
- @ Override
261
- public int getIconHeight () {
262
- return SIZE ;
263
- }
264
-
265
- @ Override
266
- public void paintIcon (Component c , Graphics g , int x , int y ) {
267
- g .setColor (Color .GRAY );
268
-
269
- g .drawLine (x + SIZE / 2 - 3 , y + SIZE / 2 , x + SIZE / 2 + 3 , y + SIZE / 2 );
270
-
271
- if (!isOpen ) {
272
- g .drawLine (x + SIZE / 2 , y + SIZE / 2 - 3 , x + SIZE / 2 , y + SIZE / 2 + 3 );
273
- }
274
- }
275
- }
214
+ // /**
215
+ // * Spacer icon for macOS when using Vaqua.
216
+ //
217
+ // * Due to potential rendering issues, this small spacer is used
218
+ // * to ensure that rendering is stable while using Vaqua with non-standard
219
+ // * Swing components. Without this, some sizing calculations non-standard
220
+ // * components may fail or become unreliable.
221
+ // */
222
+ // static class VAquaEmptyIcon implements Icon {
223
+ // private final int SIZE = 1;
224
+ //
225
+ // @Override
226
+ // public int getIconWidth() {
227
+ // return SIZE;
228
+ // }
229
+ //
230
+ // @Override
231
+ // public int getIconHeight() {
232
+ // return SIZE;
233
+ // }
234
+ //
235
+ // @Override
236
+ // public void paintIcon(Component c, Graphics g, int x, int y) { }
237
+ // }
238
+ //
239
+ //
240
+ // /**
241
+ // * Replacement tree icon for macOS when using Vaqua.
242
+ // *
243
+ // * Due to potential rendering issues with the regular tree icon set,
244
+ // * this replacement tree icon for macOS ensures stable rendering when using
245
+ // * Vaqua with non-standard swing components. Without this, some sizing
246
+ // * calculations within non-standard components may fail or become unreliable.
247
+ // */
248
+ // static private class VAquaTreeIcon implements Icon {
249
+ // private final int SIZE = 12;
250
+ // private final boolean isOpen;
251
+ //
252
+ // /**
253
+ // * Create a new tree icon.
254
+ // *
255
+ // * @param newIsOpen Flag indicating if the icon should be in the open or closed state at
256
+ // * construction. True if open false otherwise.
257
+ // */
258
+ // public VAquaTreeIcon(boolean newIsOpen) {
259
+ // isOpen = newIsOpen;
260
+ // }
261
+ //
262
+ // @Override
263
+ // public int getIconWidth() {
264
+ // return SIZE;
265
+ // }
266
+ //
267
+ // @Override
268
+ // public int getIconHeight() {
269
+ // return SIZE;
270
+ // }
271
+ //
272
+ // @Override
273
+ // public void paintIcon(Component c, Graphics g, int x, int y) {
274
+ // g.setColor(Color.GRAY);
275
+ //
276
+ // g.drawLine(x + SIZE / 2 - 3, y + SIZE / 2, x + SIZE / 2 + 3, y + SIZE / 2);
277
+ //
278
+ // if (!isOpen) {
279
+ // g.drawLine(x + SIZE / 2, y + SIZE / 2 - 3, x + SIZE / 2, y + SIZE / 2 + 3);
280
+ // }
281
+ // }
282
+ // }
276
283
}
0 commit comments