Since you didn't mention exactly which Forms version you are using, I will guess and assume it is one of the many versions after 6.0.8. The Forms Builder 9.x+ supports ico, jpg, and gif files. It will not however read them from a jar. Therefore, you will need to extract them into a directory as defined by UI_ICON. Also, the files will need to be of the same type (gif, jpg, ico). Mixing formats is not recommended or supported. The format you choose can be defined in UI_ICON_EXTENSION
So for example in your Registry you might have something like this:
UI_ICON = C:\myImagesDirectory
UI_ICON_EXTENSION = gif
Since "gif" is the default, you do not need to set this if using "gif" files.
My forms builder version is 126.96.36.199.0
Your solution works, but it seems that, at least in my builder version, UI_ICON_EXTENSION is neccesary for gif icons, being .ico the default, as it says in the builder help:
UI_ICON_EXTENSION When this environment variable is not set, or is set incorrectly, .ico is the default extension.
Also, the icons don't look like the same in design time, as the color depth seems to be lower than in runtime, but it's good enough to know which icon is what.
Another good thing with the gif icons is that they adjust to your button size, as well as they do in runtime.