# Button to minimize Client in V7.7

**URL:** <https://forum.inductiveautomation.com/t/button-to-minimize-client-in-v7-7/8926>\
**Category:** Ignition\
**Created:** [August 20, 2014, 1:27am UTC](https://forum.inductiveautomation.com/t/button-to-minimize-client-in-v7-7/8926 "2014-08-20T01:27:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0sm0](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/0sm0/32/15228_2.png) [@0sm0](https://forum.inductiveautomation.com/u/0sm0)\
**Post date:** [August 20, 2014, 1:27am UTC](https://forum.inductiveautomation.com/t/button-to-minimize-client-in-v7-7/8926/1 "2014-08-20T01:27:58Z")

</div>

Hi guys,

The button script (thanks to adamaustin ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:") ) that worked perfectly in V7.6 now fails to work in V7.7

```auto
from java.awt import Frame

win = system.gui.getParentWindow(event)
print "got it"
parent = win
while parent is not None:
   win = parent
   parent = win.getParent()
   print ("got another" if parent is not None else "TOP")
win.setState(Frame.ICONIFIED)
```

The Error that comes up

[quote]Traceback (most recent call last):  
File “event:mousePressed”, line 7, in   
java.lang.ClassCastException: com.inductiveautomation.ignition.client.launch.BootstrapSwingFS cannot be cast to javax.swing.JComponent

```
at com.inductiveautomation.factorypmi.application.script.PyComponentWrapper.hasCustomFunction(PyComponentWrapper.java:186)

at com.inductiveautomation.factorypmi.application.script.PyComponentWrapper. __findattr_ex__ (PyComponentWrapper.java:113)

at org.python.core.PyObject. __getattr__ (PyObject.java:923)

at org.python.pycode._pyx9.f$0(<event:mousePressed>:9)

at org.python.pycode._pyx9.call_function(<event:mousePressed>)

at org.python.core.PyTableCode.call(PyTableCode.java:165)

at org.python.core.PyCode.call(PyCode.java:18)

at org.python.core.Py.runCode(Py.java:1275)

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:568)

at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:168)

at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:265)

at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)

at com.sun.proxy.$Proxy21.mousePressed(Unknown Source)

at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.awt.EventQueue.access$200(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

```

java.lang.ClassCastException: java.lang.ClassCastException: com.inductiveautomation.ignition.client.launch.BootstrapSwingFS cannot be cast to javax.swing.JComponent

```
at org.python.core.Py.JavaError(Py.java:495)
at org.python.core.PyTableCode.call(PyTableCode.java:168)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:568)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:168)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:265)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at com.sun.proxy.$Proxy21.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

```

Caused by: java.lang.ClassCastException: com.inductiveautomation.ignition.client.launch.BootstrapSwingFS cannot be cast to javax.swing.JComponent  
at com.inductiveautomation.factorypmi.application.script.PyComponentWrapper.hasCustomFunction(PyComponentWrapper.java:186)  
at com.inductiveautomation.factorypmi.application.script.PyComponentWrapper. **findattr\_ex** (PyComponentWrapper.java:113)  
at org.python.core.PyObject. **getattr** (PyObject.java:923)  
at org.python.pycode.\_pyx9.f$0(event:mousePressed:9)  
at org.python.pycode.\_pyx9.call\_function(event:mousePressed)  
at org.python.core.PyTableCode.call(PyTableCode.java:165)  
… 39 more

Ignition v7.7.0 (b2014071516)  
Java: Oracle Corporation 1.7.0\_67  
[/quote]

Not sure if its a Java 8 issue?? ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")

Any guidance is appreciated.

Cheers

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [August 20, 2014, 2:48pm UTC](https://forum.inductiveautomation.com/t/button-to-minimize-client-in-v7-7/8926/2 "2014-08-20T14:48:19Z")

</div>

This looks like a bug in Ignition 7.7. You can get around this by using this code:

```auto
from javax.swing import JFrame
from org.python.core import Py
win = system.gui.getParentWindow(event)
while not isinstance(win,JFrame):   
   win = win.getParent()
javaWin = Py.tojava(win,JFrame)
javaWin.setState(JFrame.ICONIFIED)
```

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [August 20, 2014, 9:46pm UTC](https://forum.inductiveautomation.com/t/button-to-minimize-client-in-v7-7/8926/3 "2014-08-20T21:46:27Z")

</div>

This is fixed in 7.7.1-rc2

---

<div class="post-metadata">

**Author:** ![0sm0](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/0sm0/32/15228_2.png) [@0sm0](https://forum.inductiveautomation.com/u/0sm0)\
**Post date:** [August 20, 2014, 11:31pm UTC](https://forum.inductiveautomation.com/t/button-to-minimize-client-in-v7-7/8926/4 "2014-08-20T23:31:36Z")

</div>

Cool, Thanks guys.
