1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| public void mouseClicked(MouseEvent mouseEvent) {
switch(numBouton){
case 1:
exiting = false;
initScan();break;
case 2:
exiting=true;
exit(); break;
**************************************************************
public synchronized void initScan()
{
ScannerDevice[] devList = Symbol.getScannerDeviceList();
try
{
exiting = false;
scanner = new Scanner(devList[0]);
scanner.enable();
while (!exiting){
scanner.read(null, this);
wait();
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}}
public void exit(){
exiting = true;
try {
// if(scanEnabled == true){
scanner.cancelAll();
scanner.disable();
scanner.dispose();
// }
frame.dispose();
}
catch (Exception e){}
System.exit(0);
} |
Partager