# Add menu item to about menu

**URL:** <https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890>\
**Category:** Ignition\
**Created:** [September 28, 2018, 9:04pm UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890 "2018-09-28T21:04:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [September 28, 2018, 9:04pm UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/1 "2018-09-28T21:04:10Z")

</div>

Is there a way to add a menu item into the Help menu so I can add my own “about my app” menu item?

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/813cd091ee16bd05d7189f0ac3158444576b0424.gif)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 28, 2018, 9:20pm UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/2 "2018-09-28T21:20:56Z")

</div>

Create an empty window in your project, name it something like `Nav/Null`, then add this to your Client Startup Script:

```auto
window = system.nav.openWindow("Nav/Null")
from javax.swing import SwingUtilities, JMenuItem
root = SwingUtilities.getRoot(window)
root.setResizable(False)
system.nav.closeWindow(window)
menu = root.getJMenuBar()

```

From `menu` you can use any of the methods of `JMenuBar`, eg: [https://docs.oracle.com/javase/7/docs/api/javax/swing/JMenuBar.html#getMenu(int)](https://docs.oracle.com/javase/7/docs/api/javax/swing/JMenuBar.html#getMenu(int))

Once you have a reference to the ‘Help’ menu (probably, just use the overall child count) you can add a menu:

```auto
from functools import partial
def handleSelect(event, target):
	import system
	system.nav.swapTo(target)
menuItem = JMenuItem("About MyApplication", actionPerformed=partial(handleSelect, target="My Window Name"))
submenu.add(menuItem)

```

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [September 29, 2018, 1:25am UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/3 "2018-09-29T01:25:01Z")

</div>

Thank you very much, it works great. However, I am having a lot of trouble trying to add an icon to the new menu element. I have tried these and I just cant make it work:

```auto
menuItem = JMenuItem("About MyApplication", actionPerformed=partial(handleSelect, target="My Window Name"))
menuItem.setIcon(ImageIcon(URL("http://mygateway:8088/gateway/images/Builtin/icons/16/information.png")))
submenu.add(menuItem)
```

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [September 29, 2018, 6:30am UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/4 "2018-09-29T06:30:47Z")

</div>

Use PathIcon.

```auto
from functools import partial
from com.inductiveautomation.ignition.client.images import PathIcon
from javax.swing import JMenuItem

def handleSelect(event, target):
	import system
	w = system.nav.openWindow(target)
	system.nav.centerWindow(w)

submenu = project.util.getMenuBar()
helpMenu = submenu.getMenu(submenu.menuCount-1)

ico = PathIcon()
ico.path = "Builtin/icons/16/information.png"

menuItem = JMenuItem("About MyApplication", ico, actionPerformed=partial(handleSelect, target="My Window Name"))
menuItem.name = "custom"

if "custom" not in [menu.name for menu in helpMenu.menuComponents]:
	helpMenu.add(menuItem)

```

project.util

```auto
from javax.swing import SwingUtilities

_menu = None
_appContext = None

def getMenuBar():
	if project.util._menu is None:
		window = system.nav.openWindow("nav/null")
		root = SwingUtilities.getRoot(window)
		root.setResizable(False)
		system.nav.closeWindow(window)
		project.util._menu = root.getJMenuBar()
	return project.util._menu
	
def getAppContext():
	if project.util._appContext is None:
		window = system.nav.openWindow("nav/null")
		project.util._appContext = window.getAppContext()
		system.nav.closeWindow("nav/null")
	return project.util._appContext
	

```

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [October 1, 2018, 6:00pm UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/5 "2018-10-01T18:00:57Z")

</div>

Oh that’s perfect!.  
Thank you both very much!

---

<div class="post-metadata">

**Author:** ![Paullys50](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paullys50/32/3324_2.png) [@Paullys50](https://forum.inductiveautomation.com/u/Paullys50)\
**Post date:** [October 11, 2019, 2:22am UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/6 "2019-10-11T02:22:13Z")

</div>

I came across this thread, and thanks to the script examples I and was able to implement custom menu items. However, this is a windowed application and I have noticed that my maximize button becomes disabled when I call the scripts to add to my menu bar. Some googling seems like this could be a java bug so I’m curious if anyone has a suggestion on how to restore the maximize function? Or prevent the disable from happening in the first place?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8fa68ae7a5186f5f698b0c7c5f56a549af91323a.png)

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [October 13, 2019, 8:36pm UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/7 "2019-10-13T20:36:50Z")

</div>

Just comment out the line:

> [@Kyle\_Chase](#):
>
> root.setResizable(False)

and it will work well again.

---

<div class="post-metadata">

**Author:** ![Paullys50](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paullys50/32/3324_2.png) [@Paullys50](https://forum.inductiveautomation.com/u/Paullys50)\
**Post date:** [October 14, 2019, 12:00am UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/8 "2019-10-14T00:00:02Z")

</div>

> [@miketob](#):
>
> and it will work well again.

#facepalm, thanks!

---

<div class="post-metadata">

**Author:** ![abiesbiogas](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@abiesbiogas](https://forum.inductiveautomation.com/u/abiesbiogas)\
**Post date:** [October 31, 2021, 3:39pm UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/9 "2021-10-31T15:39:26Z")

</div>

This post is quite old but I have a similar need so I tried to implement the solution proposed by @paul-griffith and @Kyle_Chase and I found that it works great, unless you’re using a localized application, as I am: actually you can add the menu where you want but when you change language it disappears.  
From further investigation I discovered that it’s only hidden: if I log off and back in I have it available again. That makes me think of a problem updating the menu tree:  
is there a way to inform the JMenuBar about its new item(s) so it can update them when I change language.

---

<div class="post-metadata">

**Author:** ![abiesbiogas](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@abiesbiogas](https://forum.inductiveautomation.com/u/abiesbiogas)\
**Post date:** [October 31, 2021, 10:13pm UTC](https://forum.inductiveautomation.com/t/add-menu-item-to-about-menu/19890/10 "2021-10-31T22:13:44Z")

</div>

Finally I got it working, but I had to redefine the util module as follows:

```auto
from javax.swing import SwingUtilities

_appContext = None
def getMenuBar():
	return getAppContext().getRootPaneContainer().getJMenuBar()
	
def getAppContext():
	if shared.menu.util._appContext is None:
		window = system.nav.openWindow("nav/null")		
		shared.menu.util._appContext = window.getAppContext()
		system.nav.closeWindow(window)
	return shared.menu.util._appContext

```

Seems like the JMenuBar has different “handler” from call to call
