# Script to show or hide Client Menubar?

**URL:** <https://forum.inductiveautomation.com/t/script-to-show-or-hide-client-menubar/30852>\
**Category:** Ignition\
**Created:** [December 20, 2019, 8:44am UTC](https://forum.inductiveautomation.com/t/script-to-show-or-hide-client-menubar/30852 "2019-12-20T08:44:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdenchev](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jdenchev](https://forum.inductiveautomation.com/u/jdenchev)\
**Post date:** [December 20, 2019, 8:44am UTC](https://forum.inductiveautomation.com/t/script-to-show-or-hide-client-menubar/30852/1 "2019-12-20T08:44:23Z")

</div>

I set up a menu bar in Client event scripting.

 ![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/32c67c6c5eca64ffb0a59a60c12f6c4bd360900a.png)  
However, after a user log in, I need the user to select a Business unit first, then the menu bar will be visible to the user. can I write script to show or hide menu bar based on user roles?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![boyergary](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/boyergary/32/10316_2.png) [@boyergary](https://forum.inductiveautomation.com/u/boyergary)\
**Post date:** [December 20, 2019, 1:46pm UTC](https://forum.inductiveautomation.com/t/script-to-show-or-hide-client-menubar/30852/2 "2019-12-20T13:46:21Z")

</div>

Instead of using the Client Event Script Menubar, you can easily build your own menu using the Java classes and can set menu items based on whatever you want. Here’s a small example of adding your own menu to an ignition window:

```auto
from javax.swing import JMenuBar
from javax.swing import JMenu

menubar = JMenuBar()
menu = JMenu('File')
menubar.add(menu)
window = system.gui.getWindow('TestWindow')
window.setJMenuBar(menubar)

```

Regards,  
Gary

---

<div class="post-metadata">

**Author:** ![jdenchev](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jdenchev](https://forum.inductiveautomation.com/u/jdenchev)\
**Post date:** [December 25, 2019, 11:25am UTC](https://forum.inductiveautomation.com/t/script-to-show-or-hide-client-menubar/30852/3 "2019-12-25T11:25:41Z")

</div>

Thanks!
