Search code examples
javaswingobservers

Java - Data Subject to be Observered by Swing UI


I have made a jPanel for use as a data plotting viewer. There may be multiple windows with these panels looking onto the same source of data, however the data may need processing before hitting the particular jPanel.

To solve the issue of extra processing I am thinking of using a swing worker for each jPanel, and using that thread to observe a data subject thread.

Is my proposed method the proper way of proceeding?


Solution

  • as long as you execute long-running tasks in a background thread and modify Swing components in the Event Dispatch Thread, you're golden.