Jython java swing and everything

I am looking for some help on how to use java swing in here.
I lots of ppl doing it on here and i wan to know where is the best place to start for learning this.
Maybe there i am missing smt but i dont see any help on this on ignition website or inductive university.
im curently listening a udemy cours on java swing so in the time ive learned it i wish ill have small help on here on how to mixup both !

thanks.

Ignition components are subclasses of Swing’s JComponent, so many operations that would be used in a Swing application can be used in Ignition as well. However, you can’t just subclass in jython from Swing willy-nilly, as anything you create in jython that could be embedded within your Ignition window design will cause Ignition to choke on that window later, since jython doesn’t serialize/deserialilze properly from one execution to the next. However, it does make it possible to use Swing Listeners in various places, and manipulate the GUI in otherwise unsupported ways.
Most importantly, understanding Swing makes it much easier to work with the module SDK to create new Ignition components in Java (installed as add-on modules).

3 Likes

What exactly do you need help with?

Maybe more context will help:

  • AWT was the original Java GUI toolkit, but had several limitations
  • Swing was eventually developed as the successor to AWT, and has more functionality
  • Even with swing classes, people often need more functionality for their specific use cases. So companies develop their own solutions, often extending off of swing components
  • JIDE Software is one company that offers these easier-to-use, more tailored Swing solutions
  • Inductive Automation uses many JIDE packages within Ignition: ranging from the designer itself to individual components like the Power Table. Under the hood it’s still mostly Swing
  • SCADA integrators using Ignition need simpler/faster ways to code small solution to things than compiling Java classes and libraries, or worse: learning some other domain-specific language. IE they need a scripting solution, not a full-blown programming one
  • Python is a popular and relatively simple language, and Jython is the Java implementation of it. You don’t need to know all the details to use Jython, just know that your python code in Ignition can interoperate with the Java components.

So what you need to know depends on what you’re trying to do. If you’re trying to write an Ignition module, you’ll need more Java/Swing (classes, interfaces, maven, etc…) knowledge. If you’re trying to script a solution within the Ignition Designer, you’ll benefit from more python knowledge (list comprehensions, lambda functions, standard libraries, etc…). Since you can instantiate and extend Java classes from Swing/JIDE/Ignition within your Jython scripts, it often helps to look at the Ignition API and to do some runtime investigation of your own to find out what exactly you’re dealing with. @pturmel authored a great tool for runtime introspection that I use frequently, you can find it here:

You might find that entire thread helpful.
I hope this was relevant to what you’re asking and I didn’t just muddy the waters!

5 Likes