?? readsortarray.java
字號:
package cwq4;
import javax.swing.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ReadSortArray extends Thread {
private ArraySynchronized sharedArray;
private int times;
private JTextArea textarea;
// initialize ReadSortArray thread object
public ReadSortArray(ArraySynchronized shared, int x, JTextArea output) {
super("Read and Sort Array Thread");
sharedArray = shared;
times = x;
textarea = output;
}
// ProduceInteger thread loops x times and calls
// sharedObject's setSharedArray method each time
public void run()
{
int t = 0;
do {
// sleep for a random interval
try {
Thread.sleep( (int) ( Math.random() * 1000 ) );
}
// process InterruptedException during sleep
catch( InterruptedException exception ) {
System.err.println( exception.toString() );
}
sharedArray.getAndsortSharedArray(textarea);
t++;
} while ( t != this.times );
}
}//end class ReadSortArray
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -