How to resolve the algorithm Window management step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Window management step by step in the PicoLisp programming language

Table of Contents

Problem Statement

Treat windows or at least window identities as first class objects.

The window of interest may or may not have been created by your program.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Window management step by step in the PicoLisp programming language

Source code in the picolisp programming language

$ ersatz/pil +
: (setq
   JFrame         "javax.swing.JFrame"
   MAXIMIZED_BOTH (java (public JFrame 'MAXIMIZED_BOTH))
   ICONIFIED      (java (public JFrame 'ICONIFIED))
   Win            (java JFrame T "Window") )
-> $JFrame

# Compare for equality
: (== Win Win)
-> T

# Set window visible
(java Win 'setLocation 100 100)
(java Win 'setSize 400 300)
(java Win 'setVisible T)

# Hide window
(java Win 'hide)

# Show again
(java Win 'setVisible T)

# Move window
(java Win 'setLocation 200 200)

# Iconify window
(java Win 'setExtendedState
   (| (java (java Win 'getExtendedState)) ICONIFIED) )

# De-conify window
(java Win 'setExtendedState
   (& (java (java Win 'getExtendedState)) (x| (hex "FFFFFFFF") ICONIFIED)) )

# Maximize window
(java Win 'setExtendedState
   (| (java (java Win 'getExtendedState)) MAXIMIZED_BOTH) )

# Close window
(java Win 'dispose)

  

You may also check:How to resolve the algorithm Abundant odd numbers step by step in the Arturo programming language
You may also check:How to resolve the algorithm Kolakoski sequence step by step in the C programming language
You may also check:How to resolve the algorithm Count in factors step by step in the EchoLisp programming language
You may also check:How to resolve the algorithm Non-decimal radices/Convert step by step in the Aime programming language
You may also check:How to resolve the algorithm Associative array/Creation step by step in the Elixir programming language