Handle barcode scan in Java

前端 未结 4 687
长情又很酷
长情又很酷 2021-01-16 06:57

I want to have my application react to barcodes being scanned to trigger button presses. For example the user could scan the ((PRINT)) barcode to activate the print button.<

4条回答
  •  孤独总比滥情好
    2021-01-16 07:37

    I do not completely understand the question, and this is a bit too long to put in a comment. As far as I understood it, you have a Swing application and a bar-code scanner which has 3 different ways to trigger the same operation

    • User enters some text ("print") in the UI and this triggers the print action
    • The UI has a print button which can be pressed by the user and this triggers the print action
    • User can scan a "print" bar code and this triggers the print action

    The part I do not understand is why the scanning of the bar code, which should trigger the print action, has anything to do with the UI-part where the user can input text.

    I assume the scanning of the barcodes happens on another thread then the Event Dispatch Thread. Once you scanned a barcode and parsed it, you need to trigger the "print" action. You can do this directly without bothering going through the UI.

提交回复
热议问题