|
@@ -66,6 +66,27 @@ import net.miginfocom.layout.PlatformDefaults;
|
66
|
66
|
@SuppressWarnings("PMD.UnusedImports")
|
67
|
67
|
public final class UIUtilities {
|
68
|
68
|
|
|
69
|
+ /**
|
|
70
|
+ * GTK LAF class name.
|
|
71
|
+ */
|
|
72
|
+ private static final String GTKUI
|
|
73
|
+ = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
|
|
74
|
+ /**
|
|
75
|
+ * Nimbus LAF class name.
|
|
76
|
+ */
|
|
77
|
+ private static final String NIMBUSUI
|
|
78
|
+ = "sun.swing.plaf.nimbus.NimbusLookAndFeel";
|
|
79
|
+ /**
|
|
80
|
+ * Windows LAF class name.
|
|
81
|
+ */
|
|
82
|
+ private static final String WINDOWSUI
|
|
83
|
+ = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
|
|
84
|
+ /**
|
|
85
|
+ * Windows classic LAF class name.
|
|
86
|
+ */
|
|
87
|
+ private static final String WINDOWSCLASSICUI
|
|
88
|
+ = "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel";
|
|
89
|
+
|
69
|
90
|
/** Not intended to be instantiated. */
|
70
|
91
|
private UIUtilities() {
|
71
|
92
|
}
|
|
@@ -283,10 +304,36 @@ public final class UIUtilities {
|
283
|
304
|
* @return true iif the LAF is GTK
|
284
|
305
|
*/
|
285
|
306
|
public static boolean isGTKUI() {
|
286
|
|
- return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel".equals(UIManager
|
287
|
|
- .getLookAndFeel().getClass().getName());
|
|
307
|
+ return GTKUI.equals(UIManager.getLookAndFeel().getClass().getName());
|
288
|
308
|
}
|
289
|
309
|
|
|
310
|
+ /**
|
|
311
|
+ * Check if we are using the Nimbus look and feel.
|
|
312
|
+ *
|
|
313
|
+ * @return true iif the LAF is Nimbus
|
|
314
|
+ */
|
|
315
|
+ public static boolean isNimbusUI() {
|
|
316
|
+ return NIMBUSUI.equals(UIManager.getLookAndFeel().getClass().getName());
|
|
317
|
+ }
|
|
318
|
+
|
|
319
|
+ /**
|
|
320
|
+ * Check if we are using the new Windows Look and Feel.
|
|
321
|
+ *
|
|
322
|
+ * @return true iif the current LAF is Windows
|
|
323
|
+ */
|
|
324
|
+ public static boolean isWindowsNewUI() {
|
|
325
|
+ return WINDOWSUI.equals(
|
|
326
|
+ UIManager.getLookAndFeel().getClass().getName());
|
|
327
|
+ }
|
|
328
|
+
|
|
329
|
+ /**
|
|
330
|
+ * Check if we are using the new Windows Classic Look and Feel.
|
|
331
|
+ *
|
|
332
|
+ * @return true iif the current LAF is Windows Classic
|
|
333
|
+ */
|
|
334
|
+ public static boolean isWindowsClassicUI() {
|
|
335
|
+ return WINDOWSCLASSICUI.equals(UIManager.getLookAndFeel().getClass().getName());
|
|
336
|
+ }
|
290
|
337
|
|
291
|
338
|
/**
|
292
|
339
|
* Check if we are using one of the Windows Look and Feels.
|
|
@@ -294,29 +341,19 @@ public final class UIUtilities {
|
294
|
341
|
* @return True iff the current LAF is "Windows" or "Windows Classic"
|
295
|
342
|
*/
|
296
|
343
|
public static boolean isWindowsUI() {
|
297
|
|
- final String uiname = UIManager.getLookAndFeel().getClass().getName();
|
298
|
|
- final String windows =
|
299
|
|
- "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
|
300
|
|
- final String classic =
|
301
|
|
- "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel";
|
302
|
|
-
|
303
|
|
- return windows.equals(uiname) || classic.equals(uiname);
|
|
344
|
+ return isWindowsNewUI() || isWindowsClassicUI();
|
304
|
345
|
}
|
305
|
346
|
|
306
|
347
|
/**
|
307
|
|
- * Get the value to pass to set Opaque on items being added to a JTabbedPane.
|
|
348
|
+ * Get the value to pass to set Opaque on items being added to a
|
|
349
|
+ * JTabbedPane. Currently they need to be transparent on Windows
|
|
350
|
+ * (non classic), Apple, Nimbus and GTK.
|
308
|
351
|
*
|
309
|
|
- * @return True iff the current LAF is not Windows or OS X.
|
|
352
|
+ * @return True if tabbed panes should be opaque
|
310
|
353
|
* @since 0.6
|
311
|
354
|
*/
|
312
|
355
|
public static boolean getTabbedPaneOpaque() {
|
313
|
|
- final String uiname = UIManager.getLookAndFeel().getClass().getName();
|
314
|
|
- final String windows =
|
315
|
|
- "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
|
316
|
|
- final String nimbus = "sun.swing.plaf.nimbus.NimbusLookAndFeel";
|
317
|
|
-
|
318
|
|
- return !(windows.equals(uiname) || Apple.isAppleUI() || nimbus.equals(
|
319
|
|
- uiname));
|
|
356
|
+ return !(isWindowsNewUI() || Apple.isAppleUI() || isNimbusUI() || isGTKUI());
|
320
|
357
|
}
|
321
|
358
|
|
322
|
359
|
/**
|