This *can* be done in Java - but it has nothing to do with Swing directly.
You're going to have to read from the bar-code scanner somehow -
Serial Port, USB, Parallel Port - whatever. The link gives some libraries that you will need to interface with however your specific device connects. Once you figure out how to connect to your device, you're going to need to figure out how your device communicates barcodes - again specific to the device.
Once you have a way to talk to the device connection, and a way to figure out how the device is sending you barcode information - *THEN* you're going to use Swing to write the GUI.