As I’ve mentioned before as well, the safest way to deal w/ Swing components is by delegating such code to its EDT thread.
However, for simple GUI building, Processing has a long history of being able to do that under its Animation thread in setup() w/o any issues.
We can also increase the odds even more by moving all the add() method calls to the very end of the GUI building process:
frame.add(slider); frame.add(label); frame.add(btn)
slider.repaint(); label.repaint(); btn.repaint()
This way, the chances of a user starting using those components too early before everything is fully in place is very slim.
Whether going safer w/ invokeLater() or taking the risk of keeping everything under the Animation thread in setup() is a personal decision.
But whatever path we take, apply it equally both on Processing’s Java Mode & py5/JPype versions.