sclass BetterLabel extends JLabel { bool autoToolTip = true; *() { // Listeners given out to componentPopupMenu must not directly // reference the outer object (-> weak map problem). final WeakReference<BetterLabel> me = new(this); componentPopupMenu(this, BetterLabel_menuItems(me)); } *(S text) { this(); this.setText(text); } public void setText(S text) { super.setText(text); if (autoToolTip) if (!swic(text, "<html>")) // HTML labels make super-huge, confusing tool tips setToolTipText(nullIfEmpty(text)); } } // moved outside of class for GC reasons (see above) static VF1<JPopupMenu> BetterLabel_menuItems(final WeakReference<BetterLabel> me) { ret voidfunc(JPopupMenu menu) { addMenuItem(menu, "Copy text to clipboard", r { copyTextToClipboard(me->getText()); }); }; }
download show line numbers debug dex old transpilations
Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment