java - Which thread runs all the AWT/swing event handling code? -
i new java , there interview question graduate role didn't understand, can tell me thread , purpose please.
swing ui toolkit single threaded (in sense unsafe call of swing libraries other thread). ui events, both rendering , dispatching them done edt thread
.
so on clicking @ button on desktop. os gives notification edt receives event , triggers callback function registered button click. code, when action (for ex: repaint screen or draw image). edt
delivers change os , rendered on screen. hence 2-way interaction.
because mentioned swing ui toolkit single-threaded. hence advisable call of swing libraries edt usign system.invokelater. more info here.
Comments
Post a Comment