# Swing Components in Default Processing Window\_py5

**URL:** <https://discourse.processing.org/t/swing-components-in-default-processing-window-py5/44482>\
**Category:** py5\
**Created:** [May 24, 2024, 11:20am UTC](https://discourse.processing.org/t/swing-components-in-default-processing-window-py5/44482 "2024-05-24T11:20:30Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [June 4, 2024, 2:01am UTC](https://discourse.processing.org/t/swing-components-in-default-processing-window-py5/44482/14 "2024-06-04T02:01:26Z")

</div>

Your second demo was a conversion of a py5 demo to a Processing app, and I use a separate EventDispatchThread in Processing apps at the recommendation of others in this forum:  
[https://discourse.processing.org/t/swing-components-in-default-processingwindow/35483](https://discourse.processing.org/t/swing-components-in-default-processingwindow/35483)  
However, I have not been using a separate thread for Swing components in py5 simply because it has never caused any problems as far as I’m aware and I am unable to find any good references on how to add it in Python. Py5 appears to have insulated us from this problem, but I am not aware of how this has been accomplished under the hood; I have not dissected the source code. The issue has recently come up in their forum with regard to using Swing components _without_ using py5 and here a separate thread seems to be necessary also. Furthermore, source code posted in JPype documentation which deals with Swing components and a separate EventDispatchThread won’t run on a Mac for some reason and as far I know there is no published fix for Macs: [https://jpype.readthedocs.io/en/latest/userguide.html#awt-swing](https://jpype.readthedocs.io/en/latest/userguide.html#awt-swing). It’s in the AWT/Swing section. I would love for somebody to show me how it’s done or find it published somewhere, but I can’t find it. The only reason I use it in Processing is because I was cautioned when I posted the first demo here some time back (referenced above), and it seems pretty well accepted that Swing is not ‘thread safe’, whatever that entails. I respect the experiences of others. When I use Swing components in Processing I frequently remove the canvas, so there is no draw() available to use. Perhaps it’s still being used by the runtime, I don’t know about that. DotView, recently published, preserves part of the canvas so draw() is functional in this instance.

---

_[View the full topic](https://discourse.processing.org/t/swing-components-in-default-processing-window-py5/44482)._
