Skip to content

Instantly share code, notes, and snippets.

@zaenk
Last active May 1, 2019 06:59
Show Gist options
  • Save zaenk/e27eb76d9327e9d48bf32d123239cc7a to your computer and use it in GitHub Desktop.
Save zaenk/e27eb76d9327e9d48bf32d123239cc7a to your computer and use it in GitHub Desktop.
Mission Impossible: Java

Mission Impossible: Java

This gist is just a friendly reminder, mostly for me, about stuff that just don't work in Java. I've spent some (lots of) precious hours trying make it work,

AWT, Swing

  • java.awt.SystemTray with javax.swing.JPopupMenu
    • While not impossible, no matter how hard you try, it will never work on all platform properly. Just stick with the default, ugly one.
  • Changing the font of java.awt.MenuItem
    • No matter what is your workaround, it won't work, if the peer does not implement it (at least on Windows) - here's the source. Or, here's the snippet:
    package sun.awt.windows;
    /* ... */
    class WMenuItemPeer extends WObjectPeer implements MenuItemPeer { 
        /* ... */
        // Needed for MenuComponentPeer.
        public void setFont(Font f) {
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment