Make an minimized client come up with a script

This can be accomplished from by getting the window's jframe and setting its extended state. As a quick test, I threw the following script into the action performed event handler of a timer component in a windows environment, and it worked. The window went from minimized to maximized every time the if condition was met:

# Written for the action performed script event handler a timer component
# Maximize the window every 20 seconds
if event.source.value > 20: #[Adjust as needed]
	
	# Recursively find retrieve the jframe from the upper level heiarchy
	# ...This could also be accomplished with swing utilities get ancestor of class
	def getJFrame(parent):
		if 'JFrame' in parent.__class__.__name__:
			return parent
		elif getJFrame(parent.parent):
			return getJFrame(parent.parent)
			
	# Get the jframe of the timer component and set it to maximized every 20 seconds
	jframe = getJFrame(event.source.parent)
	jframe.extendedState = jframe.MAXIMIZED_BOTH
	event.source.value = 0 # Reset timer
3 Likes