Parcourir la source

Добавлен вывод "true" устройст в JFrame

Илья il y a 8 ans
Parent
commit
662ec74299

+ 9 - 1
nbproject/project.properties

@@ -29,11 +29,15 @@ dist.javadoc.dir=${dist.dir}/javadoc
 excludes=
 file.reference.commons-lang3-3.2.1.jar=C:\\Users\\ilysk\\Desktop\\Work&Learn\\Coding\\Java\\Libraries\\usb4java-1.2.0\\lib\\commons-lang3-3.2.1.jar
 file.reference.commons-lang3-3.2.1.jar-1=C:\\Users\\User\\Desktop\\libusb\\commons-lang3-3.2.1.jar
+file.reference.commons-lang3-3.2.1.jar-2=C:\\Users\\\u0418\u043b\u044c\u044f\\Documents\\NetBeansProjects\\usb4java-1.2.0\\lib\\commons-lang3-3.2.1.jar
 file.reference.libusb4java-1.2.0-windows-x86.jar=C:\\Users\\ilysk\\Desktop\\Work&Learn\\Coding\\Java\\Libraries\\usb4java-1.2.0\\lib\\libusb4java-1.2.0-windows-x86.jar
 file.reference.libusb4java-1.2.0-windows-x86.jar-1=C:\\Users\\User\\Desktop\\libusb\\libusb4java-1.2.0-windows-x86.jar
+file.reference.libusb4java-1.2.0-windows-x86.jar-2=C:\\Users\\\u0418\u043b\u044c\u044f\\Documents\\NetBeansProjects\\usb4java-1.2.0\\lib\\libusb4java-1.2.0-windows-x86.jar
+file.reference.libusb4java-1.2.0-windows-x86_64.jar=C:\\Users\\\u0418\u043b\u044c\u044f\\Documents\\NetBeansProjects\\usb4java-1.2.0\\lib\\libusb4java-1.2.0-windows-x86_64.jar
 file.reference.libusb4java-1.2.0-windows-x86_64.jar-1=C:\\Users\\User\\Desktop\\libusb\\libusb4java-1.2.0-windows-x86_64.jar
 file.reference.usb4java-1.2.0.jar=C:\\Users\\ilysk\\Desktop\\Work&Learn\\Coding\\Java\\Libraries\\usb4java-1.2.0\\lib\\usb4java-1.2.0.jar
 file.reference.usb4java-1.2.0.jar-1=C:\\Users\\User\\Desktop\\libusb\\usb4java-1.2.0.jar
+file.reference.usb4java-1.2.0.jar-2=C:\\Users\\\u0418\u043b\u044c\u044f\\Documents\\NetBeansProjects\\usb4java-1.2.0\\lib\\usb4java-1.2.0.jar
 includes=**
 jar.compress=false
 javac.classpath=\
@@ -43,7 +47,11 @@ javac.classpath=\
     ${file.reference.commons-lang3-3.2.1.jar-1}:\
     ${file.reference.libusb4java-1.2.0-windows-x86.jar-1}:\
     ${file.reference.libusb4java-1.2.0-windows-x86_64.jar-1}:\
-    ${file.reference.usb4java-1.2.0.jar-1}
+    ${file.reference.usb4java-1.2.0.jar-1}:\
+    ${file.reference.commons-lang3-3.2.1.jar-2}:\
+    ${file.reference.libusb4java-1.2.0-windows-x86.jar-2}:\
+    ${file.reference.libusb4java-1.2.0-windows-x86_64.jar}:\
+    ${file.reference.usb4java-1.2.0.jar-2}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.deprecation=false

+ 8 - 2
src/project82usb/devicesmatrix.java

@@ -4,6 +4,8 @@
  * and open the template in the editor.
  */
 package project82usb;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import project82usb.usbDeviceList.*;
 
 /**
@@ -11,7 +13,7 @@ import project82usb.usbDeviceList.*;
  * @author ilysk
  */
 public class devicesmatrix extends javax.swing.JFrame {
-    private final usbDeviceList list = new usbDeviceList();
+    private final neededUsbDeviceList list = new neededUsbDeviceList();
     /**
      * Creates new form devicesmatrix
      */
@@ -106,7 +108,11 @@ public class devicesmatrix extends javax.swing.JFrame {
     }//GEN-LAST:event_btnClearActionPerformed
 
     private void btnRefreshActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRefreshActionPerformed
-        //list.getUsbDeviceList(); исправить!
+        try {
+            list.getTrueDeviceList();
+        } catch (InterruptedException ex) {
+            Logger.getLogger(devicesmatrix.class.getName()).log(Level.SEVERE, null, ex);
+        }
         list.printDeviceList(this);
     }//GEN-LAST:event_btnRefreshActionPerformed
 

+ 0 - 2
src/project82usb/main.java

@@ -4,8 +4,6 @@
  */
 package project82usb;
 
-import javax.usb.*;
-
 /**
  *
  * @author Илья

+ 8 - 0
src/project82usb/neededUsbDeviceList.java

@@ -53,4 +53,12 @@ public class neededUsbDeviceList {
         }
         System.out.println("Кол-во устройств: " + this.trueList.size());
     }
+    
+    public void printDeviceList(devicesmatrix out){
+        out.addTextTvOut("Printing device list:");
+        for(usbDevice device:this.trueList){
+            out.addTextTvOut("Device "+device.getStringIdVendor()+":"+device.getStringIdProduct()+" on port  #"+device.getPort());
+        }
+        out.addTextTvOut("");
+    }
 }