JAVA代码中,获取斑马打印机的连接
ConnectionCardPanel connectionPanel = new ConnectionCardPanel();
Connection printerConnection = null;
//判断传入的端口,如果端口为 0 表示是USB连接,使用USB方式获取连接
if(port==0 || port.toString().equals("0")){
DiscoveredPrinterDriver[] printerConnections = UsbDiscoverer.getZebraDriverPrinters();
System.out.println("printerConnections 共有:" + printerConnections.length + "个打印机");
for (DiscoveredPrinterDriver driver : printerConnections){
System.out.println("设备有:"+driver.printerName)