Some practical practices about swing JtextField

Some time ago, when I was working on the company's client software, I had a requirement. I needed to connect a card reader, plug in the usb directly, and then simulate the keyboard to input the card number and press Enter after swiping the card . , the requirement is to enter the card number in the program interface, and then perform the subsequent process operations, but do not display the JtextField . At first, I was confused . Later, I changed the length and width of the JtextField to 0 , which can perfectly solve this problem. An ecstasy, and then followed by a pain in the heart, because the size is 0, you can't see it, and if you move the mouse and lose the focus, you can't manually click back. Later, the lock focus was added to solve this problem.

{{o.name}}
{{m.name}}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324033800&siteId=291194637