Pros & Cons (GUI Builder): Java Swing vs ControlP5

I am new to Java and Processing.
I want ot build GUI using processing.

I found that there are two ways to build GUI, using Java Swing & ControlP5 library.
Can someone experienced explain me the pros and cons of using these.

Please Help.

Actually there are at least 3 options

  1. Java Swing
  2. ControlP5 library
  3. G4P library (+ GUI Builder tool)

Personally I would not mix Java Swing and Processing to create sketches because it complicates event handling.

Both ControlP5 and G4P are well established libraries providing a wide range of components so the choice is down to personal preferences.

One advantage of G4P is the associated GUI Builder tool which provides a visual environment to design G4P GUIs. Both G4P and GUI Builder can be installed from the Contributions Manage. More information about G4P and GUI Builder can be found on this website. I should warn you that I am biased towards G4P and GUI Builder because I created them. In all honesty ControlP5 is also an excellent GUI library so the choice is down to the user.

It’s not really that difficult to use Swing controls in Processing in my opinion, but will agree that it’s not for everyone. It’s true that you have to do your own event handling and draw() no longer works as expected. Other than that with Swing you can get a wide range of high quality controls designed and maintained by a large number of coders. With libraries you are usually at the mercy of a single author and whatever that individual wants you to have. Furthermore library writers sometimes grow weary of dedicating their life to maintaining their work over time. Nonetheless Processing users are currently lucky to have a couple of good options which are fairly easy to use and less work for the average user. You can see a few Swing components in this old thread: