floater
Java Jedi
总版主
发贴: 3233
积分: 421
|
于 2002-12-08 14:20
The reason is that you are using the same thread for swing event dispatching *and* ftp. So you have to fire off ftp from a different thread. There are several ways: 1. SwingUtilities in swing 2. Sun also has a Thread worker class(do a search at sun.com) 3. A simple embedded as follows(My own woking code, but use it freely)
if ((e.getClickCount() == 2) && SwingUtilities.isLeftMouseButton) { debugLine("Left mouse double selected. Go get data!"); ////////////////////////////////////////////////// //This will start a new thread so it won't block the //Event Dispatch Thread.
Thread worker = new Thread() { public void run() { //This sets the progress bar StockChart.getFrame().setProgressBar(true); //do whatever you want
//This reset the progress bar StockChart.getFrame().setProgressBar(false); } }; worker.start(); }
|