Add a Menu Tool icon via a jar file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Add a Menu Tool icon via a jar file

CARL Philippe (LBP)
Dear all,
I figured out how to create a Menu Tool with an icon to launch a couple plugins by adding the needed code within the Macros/StartupMacros.ijm file.
But I would rather like to encapsulate this icon addition within a jar file.
Can this be done and how ?
Thanks a lot in advance for your lighting on this.
My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 42 89

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Add a Menu Tool icon via a jar file

Alan Brooks
This post was updated on .
Philippe,

In case you want to do this with Java, here is an example Java helper method that uses MacroInstaller to install a tool with an icon from within a plugin:

    public static void addToolbarActionTool(String name, String icon) {
        // Puts this function on the ImageJ toolbar if it isn't already
        if (Toolbar.getInstance().getToolId(name)!=-1) return; // already on toolbar
        MacroInstaller mi = new MacroInstaller();
        mi.installSingleTool(
            "macro \"" + name + " Action Tool - " + icon + "\" { run(\"" + name + "\"); }"
            );
    }

Alan

> On Jun 8, 2021, at 8:56 AM, CARL Philippe (LBP) <philippe.carl@UNISTRA.FR> wrote:
>
> Dear all,
> I figured out how to create a Menu Tool with an icon to launch a couple plugins by adding the needed code within the Macros/StartupMacros.ijm file.
> But I would rather like to encapsulate this icon addition within a jar file.
> Can this be done and how ?
> Thanks a lot in advance for your lighting on this.
> My best regards,
> Philippe
>
> Philippe CARL
> Laboratoire de Bioimagerie et Pathologies
> UMR 7021 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> 67401 ILLKIRCH
> Tel : +33(0)3 68 85 42 89
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html