changeset 13498:94230f2a671e

8214111: There is no icon in all JOptionPane target image Reviewed-by: serb, psadhukhan
author pbansal
date Fri, 18 Jan 2019 13:36:16 +0530
parents fbed78affeea
children 8c0ae4357017
files src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Tue Feb 26 18:12:06 2019 +0000
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Fri Jan 18 13:36:16 2019 +0530
@@ -1166,13 +1166,24 @@
         ICONS_MAP = new HashMap<String, GTKStockIcon>();
         ICONS_MAP.put("FileChooser.cancelIcon", new GTKStockIcon("gtk-cancel", 4));
         ICONS_MAP.put("FileChooser.okIcon",     new GTKStockIcon("gtk-ok",     4));
-        ICONS_MAP.put("OptionPane.errorIcon", new GTKStockIcon("gtk-dialog-error", 6));
-        ICONS_MAP.put("OptionPane.informationIcon", new GTKStockIcon("gtk-dialog-info", 6));
-        ICONS_MAP.put("OptionPane.warningIcon", new GTKStockIcon("gtk-dialog-warning", 6));
-        ICONS_MAP.put("OptionPane.questionIcon", new GTKStockIcon("gtk-dialog-question", 6));
         ICONS_MAP.put("OptionPane.yesIcon", new GTKStockIcon("gtk-yes", 4));
         ICONS_MAP.put("OptionPane.noIcon", new GTKStockIcon("gtk-no", 4));
         ICONS_MAP.put("OptionPane.cancelIcon", new GTKStockIcon("gtk-cancel", 4));
         ICONS_MAP.put("OptionPane.okIcon", new GTKStockIcon("gtk-ok", 4));
+
+        //check whether the gtk version is >= 3.10 as the Icon names were
+        //changed from this version
+        UNIXToolkit tk = (UNIXToolkit)Toolkit.getDefaultToolkit();
+        if (tk.checkGtkVersion(3, 10, 0)) {
+            ICONS_MAP.put("OptionPane.errorIcon", new GTKStockIcon("dialog-error", 6));
+            ICONS_MAP.put("OptionPane.informationIcon", new GTKStockIcon("dialog-information", 6));
+            ICONS_MAP.put("OptionPane.warningIcon", new GTKStockIcon("dialog-warning", 6));
+            ICONS_MAP.put("OptionPane.questionIcon", new GTKStockIcon("dialog-question", 6));
+        } else {
+            ICONS_MAP.put("OptionPane.errorIcon", new GTKStockIcon("gtk-dialog-error", 6));
+            ICONS_MAP.put("OptionPane.informationIcon", new GTKStockIcon("gtk-dialog-info", 6));
+            ICONS_MAP.put("OptionPane.warningIcon", new GTKStockIcon("gtk-dialog-warning", 6));
+            ICONS_MAP.put("OptionPane.questionIcon", new GTKStockIcon("gtk-dialog-question", 6));
+        }
     }
 }