Java Code Examples for javax.swing.SwingWorker#get()

The following examples show how to use javax.swing.SwingWorker#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResendController.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
/**
 * レスポンスを受け取って処理する必要がないとき用
 */
public void resend(OneShotPacket oneshot, int count, boolean wait) throws Exception {
	SwingWorker<Object, OneShotPacket> worker;
	worker = new ResendWorker(oneshot, count);
	worker.execute();
	if (wait && count != 1) {
		try {
			// InterceptでForward x 20した時に先に本体が処理されると困るので待つ
			worker.get(20000, TimeUnit.MILLISECONDS);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
Example 2
Source File: BridgeScreen.java    From open-ig with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Start playing the video.
 * @param sw the worker that will return the first frame.
 */
void playVideoAppear(final SwingWorker<BufferedImage, Void> sw) {
	videoAppearPercent = 0;
	try {
		videoAppear = sw.get();
	} catch (InterruptedException | ExecutionException ex) {
		Exceptions.add(ex);
	}
	buttonSound(SoundType.ACKNOWLEDGE_2);
	videoAppearAnim.start();
}