I have a user interface in the Java system tray that requires polling the schedule database. What is the best method for spawning a new thread and notifying the user interface?
I am new to Swing and it is a streaming model.
SwingWorker - this is what is intended for this.
SwingWorker
It allows you to run a task that will not block the GUI, and then return the value and update the GUI when it is done.
Java has a great tutorial on how to use SwingWorker.
, doInBackground(). done() .
doInBackground()
done()
jinguy, SwingWorker , . Wikipedia, , , , JavaDocs.
jjnguy, SwingWorker , , , . SwingWorker, SwingUtilities ( EventQueue).invokeLater(Runnable).
-. Swing ( ) , . , (, , ).
Source: https://habr.com/ru/post/1713786/More articles:Python definition issue - pythonSubsonic 3 - how do you execute a stored procedure that returns a value? - subsonicWhy does datetimeoffset have 28 timezone hours? - sql-serverHow can I "style" an html div element? - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1713785/c-produce-a-continuous-tone-until-interrupted&usg=ALkJrhhEgZhFLux0PbAvQywZYXjbNbhR2gIs there a way in the console application to determine when StandardInput is available? - .netCheck if the current user can write to the registry (C, windows) - cВ php, как я могу убедиться, что статические переменные, объявленные в функции, не будут повторно инициироваться всякий раз, когда вызывается функция? - phpЭкспорт данных в файл excel из классического ASP-сбоя - excelMySQL INSERT / UPDATE without DUPLICATE key - mysqlAll Articles