sclass dm_ReloadButton extends JLabel { O moduleID; *(fO *moduleID) { initImageLabel(this, #1101440); setToolTip(this, "Module can be reloaded"); onClick(this, r { removeFromParent(dm_ReloadButton.this); thread { dm_reloadModule(moduleID); } }); } } // tested with JTattoo and Windows L&F svoid dm_addReloadButtonToModuleTitlePane(fO moduleID) { swing { final JComponent c = internalFrameTitleComponent((JInternalFrame) dm_frame(moduleID)); if (c == null) ret; if (containsChildWithShortName(c, 'dm_ReloadButton)) ret; final dm_ReloadButton btn = swingNu(dm_ReloadButton, moduleID); addBottomMargin(btn, 1); final int nChildren = countChildren(c); final int w = preferredWidth(btn), h = preferredHeight(btn), gap = 5; addComponent(c, btn); final Runnable relayout = r { setBounds(btn, max(30, minXOfFirstNChildren_rightOf(c, nChildren, 20)-w-gap), (c.getHeight()-h)/2, w, h) }; final ComponentListener resizeListener = resizeListener(relayout); bindToComponent(btn, r { c.addComponentListener(resizeListener); callF(relayout) }, r { c.removeComponentListener(resizeListener) }); } }