From beee59acb36ef1dd9d80a2bf9bcd85e698888614 Mon Sep 17 00:00:00 2001 From: Pankaj Bansal Date: Fri, 18 Jan 2019 13:36:16 +0530 Subject: [PATCH] 8214111: There is no icon in all JOptionPane target image Reviewed-by: serb, psadhukhan --- .../com/sun/java/swing/plaf/gtk/GTKStyle.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java index 2c45d6f1e3e..03c4558565c 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java @@ -1167,13 +1167,24 @@ class GTKStyle extends SynthStyle implements GTKConstants { ICONS_MAP = new HashMap(); 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)); + } } }