# Max Window size in different monitors

**URL:** <https://forum.inductiveautomation.com/t/max-window-size-in-different-monitors/32030>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [February 7, 2020, 4:59am UTC](https://forum.inductiveautomation.com/t/max-window-size-in-different-monitors/32030 "2020-02-07T04:59:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 7, 2020, 7:41am UTC](https://forum.inductiveautomation.com/t/max-window-size-in-different-monitors/32030/3 "2020-02-07T07:41:38Z")

</div>

> [@jespinmartin1](#):
>
> I want to use a button to change the window to full size.

Do you mean full screen mode where the window fills the whole screen with no title bar? If so, the code below on a button will swap the desktop the button is contained in between full screen and windowed modes.

```python
from javax.swing import JFrame

window = system.gui.getParentWindow(event)
while not isinstance(window, JFrame):
	window = window.getParent()
if window.isUndecorated():
	# Switch to windowed mode.
	window.dispose()
	window.setUndecorated(False)
	window.setExtendedState(JFrame.NORMAL)
	# Restore previous window size and location, if available.
	try:
		normalW = event.source.getClientProperty('normalW')
		normalH = event.source.getClientProperty('normalH')
		normalX = event.source.getClientProperty('normalX')
		normalY = event.source.getClientProperty('normalY')
		window.setSize(normalW, normalH)
		window.setLocation(normalX, normalY)
	except:
		pass
	window.setVisible(True)
else:
	# Store window size and location for restore.
	event.source.putClientProperty('normalW', window.size.width)
	event.source.putClientProperty('normalH', window.size.height)
	event.source.putClientProperty('normalX', window.x)
	event.source.putClientProperty('normalY', window.y)
	# Switch to full screen mode.
	window.dispose()
	window.setUndecorated(True)
	window.setExtendedState(JFrame.MAXIMIZED_BOTH)
	window.setVisible(True)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/max-window-size-in-different-monitors/32030)._
