# Custom Lock Screen

**URL:** <https://forum.inductiveautomation.com/t/custom-lock-screen/2594>\
**Category:** Ignition\
**Created:** [February 1, 2011, 3:15pm UTC](https://forum.inductiveautomation.com/t/custom-lock-screen/2594 "2011-02-01T15:15:33Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [February 1, 2011, 3:15pm UTC](https://forum.inductiveautomation.com/t/custom-lock-screen/2594/1 "2011-02-01T15:15:33Z")

</div>

Here is my implementation of my custom lock screen.

First, make a app script with the following code. I placed this in app.gui.

`def lockScreen():
	import system.nav
	if globals().has_key('lockScreen'):
		lockScreen.visible = 1
	else:
		global lockScreen
		lockScreen = system.nav.openWindow('Lock Screen')
		lockScreen.setDefaultCloseOperation(lockScreen.DISPOSE_ON_CLOSE)
		Application.getRootPane().getLayeredPane().add(lockScreen)`

Also, before calling this script, you need to run this script atleast once. I play this in my initial login script, just after opening my main menu bar. This sets a reference to the JFrame that the project is running inside of.

`from javax.swing import SwingUtilities,JFrame
	global Application
	Application = SwingUtilities.getAncestorOfClass(JFrame, menu)`

Finally, run this code to lock the screen. I have a menu option to lock the screen and also a Client Timer script that locks the screen after 15 minutes of inactivity

```auto
app.gui.lockScreen()
```

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/fb59e89fe2793bfd89743928118b786d7839cf1e.png)

---

<div class="post-metadata">

**Author:** ![DennisWomack](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@DennisWomack](https://forum.inductiveautomation.com/u/DennisWomack)\
**Post date:** [February 1, 2011, 9:59pm UTC](https://forum.inductiveautomation.com/t/custom-lock-screen/2594/2 "2011-02-01T21:59:58Z")

</div>

Thanks for all the sample code you post.

I like the Easy button on this screen!

See, I did look at it.

Dennis
