{"id":3547,"date":"2015-11-01T14:49:33","date_gmt":"2015-11-01T13:49:33","guid":{"rendered":"https:\/\/blog.hani-ibrahim.de\/?p=3547"},"modified":"2020-10-10T21:00:23","modified_gmt":"2020-10-10T20:00:23","slug":"swing-menus-gtk-laf","status":"publish","type":"post","link":"https:\/\/blog.hani-ibrahim.de\/en\/swing-menus-gtk-laf.html","title":{"rendered":"Display Java&#8217;s Swing menus correctly in Linux Mint&#8217;s GTK LaF"},"content":{"rendered":"<nav class=\"tinytoc tiny_toc\">\n<ul>\n<li><a href=\"#h0\">Manuel Fix<\/a><\/li>\n<li><a href=\"#h1\">Automatic Fix<\/a><\/li>\n<li><a href=\"#h2\">Download<\/a><\/li>\n<li><a href=\"#h3\">Interesting Links<\/a><\/li>\n<\/ul>\n<\/nav>\n\n\r\n<body><p>Since GTK 3 has been introduced Java Swing applications have a bug in displaying their menus when using the GTK Look and Feel (LaF).<\/p>\n<p>At Linux Mint Cinnamon:<\/p>\n<ul>\n<li>No border around dropdown and context menus<\/li>\n<li>Wrong font color of <em>activated<\/em> checkbox and radiobutton menu items (the font has the same color as the background and appears invisible)<\/li>\n<li>No menu separators<\/li>\n<\/ul>\n<p>In the web there are some fixes and workarounds but just one solves the problem on Linux Mint 17 and later completely (see section \u201cInteresting Links\u201d below).<\/p>\n<p>This How-To shows how to fix the problem and offers a bash script to get rid of this problem on Mint 17 and later automatically.<\/p>\n<p>For Ubuntu find a small hint below.<\/p>\n<p><!--more--><\/p>\n<p>The animated screenshot below shows the problem befor and after the fix.<\/p>\n<div id=\"attachment_3551\" style=\"width: 412px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/blog.hani-ibrahim.de\/wp-content\/uploads\/menutest_ani.gif\" data-rel=\"lightbox-gallery-z8fvFjOo\" data-rl_title=\"Men\u00fcbug in Swings GTK LaF vor und nach der Fehlerbeseitigung\" data-rl_caption=\"\" title=\"Men\u00fcbug in Swings GTK LaF vor und nach der Fehlerbeseitigung\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3551\" class=\"size-full wp-image-3551\" src=\"https:\/\/blog.hani-ibrahim.de\/wp-content\/uploads\/menutest_ani.gif\" alt=\"Men\u00fcbug in Swings GTK LaF vor und nach der Fehlerbeseitigung\" width=\"402\" height=\"330\"><\/a><p id=\"caption-attachment-3551\" class=\"wp-caption-text\">Menu bug in Swing\u2019s GTK LaF befor and after the fix<\/p><\/div>\n<p>The problem are entries in the \u201cmenus.rc\u201d files of the Mint-themes at <span class=\"codestyle\">\/usr\/share\/themes\/<code>[mint-theme]\/gtk-2.0\/style<\/code><\/span>.<\/p>\n<p class=\"hinweis\">In <strong>Ubuntu <\/strong>the configuration is stored in different files (gtkrc), e.g. <code>\/usr\/share\/themes\/Adwaita\/gtk-2.0\/gtkrc<\/code>. But the entries are pretty similar. Search for the section <span class=\"codestyle\">styles \u201cmenu\u201d<\/span> and look for the entries <span class=\"codestyle\">xthickness<\/span> und <span class=\"codestyle\">ythickness<\/span>. Set them to \u201c<span class=\"codestyle\">1<\/span>\u201c. As an alternative install the\u00a0 Global Menu\/HUD-Support for Java Swing Apps when you use the Unity desktop. See my posting <a href=\"https:\/\/blog.hani-ibrahim.de\/ubuntus-swing-gtk-laf.html\">Java\u2019s Swing GTK LaF nice and pretty on Ubuntu<\/a> for details.<\/p>\n<h3 id=\"h0\">Manuel Fix<\/h3>\n<p>Open the path <span class=\"codestyle\">\/usr\/share\/themes\/<code>[mint-theme]\/gtk-2.0\/style<\/code><\/span> your used Mint-theme (e.g. \u201cMint-X\u201d) as root und edit the file <span class=\"codestyle\">menus.rc<\/span>.<\/p>\n<p>In section<strong> style \u201cmenu\u201d<\/strong> change:<\/p>\n<pre>xthickness = 0\r\nythickness = 0\r\ntext[ACTIVE] = @base_color<\/pre>\n<p>to:<\/p>\n<pre>xthickness = 1\r\nythickness = 1\r\ntext[ACTIVE] = @fg_color<\/pre>\n<p>In section<strong> style \u201cmenu-item-separator\u201d<\/strong> change the entry:<\/p>\n<pre>ythickness = 0<\/pre>\n<p>to:<\/p>\n<pre>ythickness = 1<\/pre>\n<p>You are done for this theme.<\/p>\n<p>To fix all Mint themes I recommend to use my bash script \u201cswing-menu-corr.sh\u201d below.<\/p>\n<p class=\"hinweis\">The changes have not effected general GTK applications at all!<\/p>\n<h3 id=\"h1\">Automatic Fix<\/h3>\n<p>Manually changing all\u00a0<span class=\"codestyle\">menus.rc<\/span> to fix the problem is time consuming.\u00a0 The bash script \u201cswing-menu-corr.sh\u201d does the changes in all files automatically.<\/p>\n<div id=\"attachment_3559\" style=\"width: 668px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/blog.hani-ibrahim.de\/wp-content\/uploads\/terminal_swing-menu-corr.png\" data-rel=\"lightbox-gallery-z8fvFjOo\" data-rl_title=\"Swing-menu-corr.sh-Skript\" data-rl_caption=\"\" title=\"Swing-menu-corr.sh-Skript\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3559\" class=\"size-full wp-image-3559\" src=\"https:\/\/blog.hani-ibrahim.de\/wp-content\/uploads\/terminal_swing-menu-corr.png\" alt=\"Swing-menu-corr.sh-Skript \" width=\"658\" height=\"420\" srcset=\"https:\/\/blog.hani-ibrahim.de\/wp-content\/uploads\/terminal_swing-menu-corr.png 658w, https:\/\/blog.hani-ibrahim.de\/wp-content\/uploads\/terminal_swing-menu-corr-300x191.png 300w\" sizes=\"auto, (max-width: 658px) 100vw, 658px\"><\/a><p id=\"caption-attachment-3559\" class=\"wp-caption-text\">Swing-menu-corr.sh-script<\/p><\/div>\n<p><del>The script changes only Mint Themes of Linux Mint 17.x! It works well with the Cinnamon and Xfce versions.<\/del><\/p>\n<p><em>Update 2017-01-29:<\/em> The script corrects Mint-X and Adwaita themes on Mint 17 or later only.\u00a0 Linux Mint 18\u2019s Mint-Y themes are not supported (now). Refer workaround in my <a href=\"#comment-66615\">comment<\/a>. This script works well with Mint\u2019s Cinnamon and Xfce versions.<\/p>\n<p>The script creates backup files of all changed files. You can undo the changes of \u201cswing-menu-corr.sh\u201d with the script \u201cswing-menu-undo.sh\u201d automatically.<\/p>\n<p>Furthermore the script checks if it runs under Linux Mint 17.x. If not, it displays a warning. But do not worry. \u201cSwing-menu-corr.sh\u201d cannot damage your system seriously. The \u201cundo\u201d script can bring back the original files anyway.<\/p>\n<p><strong>The script will be adjusted for future Mint versions. Go to the download page for the current version.<\/strong><\/p>\n<h3 id=\"h2\">Download<\/h3>\n<p>The script can be downloaded at the <a href=\"https:\/\/blog.hani-ibrahim.de\/swing-menu-corr.html\">Download page<\/a>.<\/p>\n<h3 id=\"h3\">Interesting Links<\/h3>\n<ul>\n<li><a href=\"http:\/\/www.ailis.de\/~k\/archives\/67-Workaround-for-borderless-Java-Swing-menus-on-Linux.html\" target=\"_blank\" rel=\"noopener noreferrer\">K\u2019s cluttered loft<\/a> (Blog closed unfortunately) \u2013 Ubuntu-Fix<\/li>\n<li><a href=\"http:\/\/bugs.java.com\/bugdatabase\/view_bug.do?bug_id=6925412\" target=\"_blank\" rel=\"noopener noreferrer\">Bug report @Java.com <\/a>\u2013 Ubuntu<\/li>\n<li><a href=\"https:\/\/github.com\/arduino\/Arduino\/blob\/master\/arduino-core\/src\/processing\/app\/linux\/GTKLookAndFeelFixer.java\" target=\"_blank\" rel=\"noopener noreferrer\">GTKLookAndFeelFixer<\/a> for Arduino<\/li>\n<li><a href=\"https:\/\/bugs.launchpad.net\/linuxmint\/+bug\/1163030\/comments\/4\" target=\"_blank\" rel=\"noopener noreferrer\">bugs.launchpad.net\/linuxmint<\/a> \u2013 Comment of Peter Seng \u2013 fix for Mint<\/li>\n<\/ul>\n<p><\/p><\/body>","protected":false},"excerpt":{"rendered":"<div class=\"shariff shariff-align-flex-start shariff-widget-align-flex-start\" data-services=\"facebook\" data-url=\"https%3A%2F%2Fblog.hani-ibrahim.de%2Fen%2Fswing-menus-gtk-laf.html\" data-timestamp=\"1602363623\" data-backendurl=\"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/shariff\/v1\/share_counts?\"><ul class=\"shariff-buttons theme-round orientation-horizontal buttonsize-small\"><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8;border-radius:50%\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fblog.hani-ibrahim.de%2Fen%2Fswing-menus-gtk-laf.html\" title=\"Share on Facebook\" aria-label=\"Share on Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\";border-radius:50%; background-color:#3b5998; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><span data-service=\"facebook\" style=\"color:#3b5998\" class=\"shariff-count shariff-hidezero\"><\/span>&nbsp;<\/a><\/li><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#595959;border-radius:50%\"><a href=\"https:\/\/twitter.com\/share?url=https%3A%2F%2Fblog.hani-ibrahim.de%2Fen%2Fswing-menus-gtk-laf.html&text=Display%20Java%E2%80%99s%20Swing%20menus%20correctly%20in%20Linux%20Mint%E2%80%99s%20GTK%20LaF\" title=\"Share on X\" aria-label=\"Share on X\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\";border-radius:50%; background-color:#000; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\"><path fill=\"#000\" d=\"M14.258 10.152L23.176 0h-2.113l-7.747 8.813L7.133 0H0l9.352 13.328L0 23.973h2.113l8.176-9.309 6.531 9.309h7.133zm-2.895 3.293l-.949-1.328L2.875 1.56h3.246l6.086 8.523.945 1.328 7.91 11.078h-3.246zm0 0\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button pocket shariff-nocustomcolor\" style=\"background-color:#444;border-radius:50%\"><a href=\"https:\/\/getpocket.com\/save?url=https%3A%2F%2Fblog.hani-ibrahim.de%2Fen%2Fswing-menus-gtk-laf.html&title=Display%20Java%E2%80%99s%20Swing%20menus%20correctly%20in%20Linux%20Mint%E2%80%99s%20GTK%20LaF\" title=\"Save to Pocket\" aria-label=\"Save to Pocket\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\";border-radius:50%; background-color:#ff0000; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 27 28\"><path fill=\"#ff0000\" d=\"M24.5 2q1 0 1.7 0.7t0.7 1.7v8.1q0 2.8-1.1 5.3t-2.9 4.3-4.3 2.9-5.2 1.1q-2.7 0-5.2-1.1t-4.3-2.9-2.9-4.3-1.1-5.2v-8.1q0-1 0.7-1.7t1.7-0.7h22zM13.5 18.6q0.7 0 1.3-0.5l6.3-6.1q0.6-0.5 0.6-1.3 0-0.8-0.5-1.3t-1.3-0.5q-0.7 0-1.3 0.5l-5 4.8-5-4.8q-0.5-0.5-1.3-0.5-0.8 0-1.3 0.5t-0.5 1.3q0 0.8 0.6 1.3l6.3 6.1q0.5 0.5 1.3 0.5z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button rss shariff-nocustomcolor\" style=\"background-color:#ff8c00;border-radius:50%\"><a href=\"https:\/\/blog.hani-ibrahim.de\/en\/feed\/rss\" title=\"RSS feed\" aria-label=\"RSS feed\" role=\"button\" class=\"shariff-link\" style=\";border-radius:50%; background-color:#fe9312; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#fe9312\" d=\"M4.3 23.5c-2.3 0-4.3 1.9-4.3 4.3 0 2.3 1.9 4.2 4.3 4.2 2.4 0 4.3-1.9 4.3-4.2 0-2.3-1.9-4.3-4.3-4.3zM0 10.9v6.1c4 0 7.7 1.6 10.6 4.4 2.8 2.8 4.4 6.6 4.4 10.6h6.2c0-11.7-9.5-21.1-21.1-21.1zM0 0v6.1c14.2 0 25.8 11.6 25.8 25.9h6.2c0-17.6-14.4-32-32-32z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button mailto shariff-nocustomcolor\" style=\"background-color:#a8a8a8;border-radius:50%\"><a href=\"mailto:?body=https%3A%2F%2Fblog.hani-ibrahim.de%2Fen%2Fswing-menus-gtk-laf.html&subject=Display%20Java%E2%80%99s%20Swing%20menus%20correctly%20in%20Linux%20Mint%E2%80%99s%20GTK%20LaF\" title=\"Send by email\" aria-label=\"Send by email\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\";border-radius:50%; background-color:#999; color:#fff\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#999\" d=\"M32 12.7v14.2q0 1.2-0.8 2t-2 0.9h-26.3q-1.2 0-2-0.9t-0.8-2v-14.2q0.8 0.9 1.8 1.6 6.5 4.4 8.9 6.1 1 0.8 1.6 1.2t1.7 0.9 2 0.4h0.1q0.9 0 2-0.4t1.7-0.9 1.6-1.2q3-2.2 8.9-6.1 1-0.7 1.8-1.6zM32 7.4q0 1.4-0.9 2.7t-2.2 2.2q-6.7 4.7-8.4 5.8-0.2 0.1-0.7 0.5t-1 0.7-0.9 0.6-1.1 0.5-0.9 0.2h-0.1q-0.4 0-0.9-0.2t-1.1-0.5-0.9-0.6-1-0.7-0.7-0.5q-1.6-1.1-4.7-3.2t-3.6-2.6q-1.1-0.7-2.1-2t-1-2.5q0-1.4 0.7-2.3t2.1-0.9h26.3q1.2 0 2 0.8t0.9 2z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button whatsapp shariff-nocustomcolor\" style=\"background-color:#5cbe4a;border-radius:50%\"><a href=\"https:\/\/api.whatsapp.com\/send?text=https%3A%2F%2Fblog.hani-ibrahim.de%2Fen%2Fswing-menus-gtk-laf.html%20Display%20Java%E2%80%99s%20Swing%20menus%20correctly%20in%20Linux%20Mint%E2%80%99s%20GTK%20LaF\" title=\"Share on Whatsapp\" aria-label=\"Share on Whatsapp\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\";border-radius:50%; background-color:#34af23; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#34af23\" d=\"M17.6 17.4q0.2 0 1.7 0.8t1.6 0.9q0 0.1 0 0.3 0 0.6-0.3 1.4-0.3 0.7-1.3 1.2t-1.8 0.5q-1 0-3.4-1.1-1.7-0.8-3-2.1t-2.6-3.3q-1.3-1.9-1.3-3.5v-0.1q0.1-1.6 1.3-2.8 0.4-0.4 0.9-0.4 0.1 0 0.3 0t0.3 0q0.3 0 0.5 0.1t0.3 0.5q0.1 0.4 0.6 1.6t0.4 1.3q0 0.4-0.6 1t-0.6 0.8q0 0.1 0.1 0.3 0.6 1.3 1.8 2.4 1 0.9 2.7 1.8 0.2 0.1 0.4 0.1 0.3 0 1-0.9t0.9-0.9zM14 26.9q2.3 0 4.3-0.9t3.6-2.4 2.4-3.6 0.9-4.3-0.9-4.3-2.4-3.6-3.6-2.4-4.3-0.9-4.3 0.9-3.6 2.4-2.4 3.6-0.9 4.3q0 3.6 2.1 6.6l-1.4 4.2 4.3-1.4q2.8 1.9 6.2 1.9zM14 2.2q2.7 0 5.2 1.1t4.3 2.9 2.9 4.3 1.1 5.2-1.1 5.2-2.9 4.3-4.3 2.9-5.2 1.1q-3.5 0-6.5-1.7l-7.4 2.4 2.4-7.2q-1.9-3.2-1.9-6.9 0-2.7 1.1-5.2t2.9-4.3 4.3-2.9 5.2-1.1z\"\/><\/svg><\/span><\/a><\/li><li class=\"shariff-button info shariff-nocustomcolor\" style=\"background-color:#eee;border-radius:50%\"><a href=\"http:\/\/ct.de\/-2467514\" title=\"More information\" aria-label=\"More information\" role=\"button\" rel=\"noopener \" class=\"shariff-link\" style=\";border-radius:50%; background-color:#fff; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 11 32\"><path fill=\"#999\" d=\"M11.4 24v2.3q0 0.5-0.3 0.8t-0.8 0.4h-9.1q-0.5 0-0.8-0.4t-0.4-0.8v-2.3q0-0.5 0.4-0.8t0.8-0.4h1.1v-6.8h-1.1q-0.5 0-0.8-0.4t-0.4-0.8v-2.3q0-0.5 0.4-0.8t0.8-0.4h6.8q0.5 0 0.8 0.4t0.4 0.8v10.3h1.1q0.5 0 0.8 0.4t0.3 0.8zM9.2 3.4v3.4q0 0.5-0.4 0.8t-0.8 0.4h-4.6q-0.4 0-0.8-0.4t-0.4-0.8v-3.4q0-0.4 0.4-0.8t0.8-0.4h4.6q0.5 0 0.8 0.4t0.4 0.8z\"\/><\/svg><\/span><\/a><\/li><\/ul><\/div><p>Sorry, this entry is only available in Deutsch.<\/p>\n","protected":false},"author":2,"featured_media":3549,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[24,25,6,45,127,41],"tags":[103,121,128,69],"class_list":["post-3547","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-german","category-english","category-gnu-linux","category-how-tos","category-linux-mint","category-software","tag-gnu-linux","tag-java","tag-linux-mint","tag-swing"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/posts\/3547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/comments?post=3547"}],"version-history":[{"count":34,"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/posts\/3547\/revisions"}],"predecessor-version":[{"id":4595,"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/posts\/3547\/revisions\/4595"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/media\/3549"}],"wp:attachment":[{"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/media?parent=3547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/categories?post=3547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hani-ibrahim.de\/en\/wp-json\/wp\/v2\/tags?post=3547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}