witman
March 12, 2021, 7:20pm
4
This code should give you a start:
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.
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)
#…
You'll need to figure out how to capture your triggers for maximizing, get the parent JFrame of the window, and then just use this part, where window
is the parent JFrame you want to maximize:
window.setExtendedState(JFrame.NORMAL)