|
@@ -0,0 +1,141 @@
|
|
|
+/*
|
|
|
+ * To change this license header, choose License Headers in Project Properties.
|
|
|
+ * To change this template file, choose Tools | Templates
|
|
|
+ * and open the template in the editor.
|
|
|
+ */
|
|
|
+package initDevices;
|
|
|
+import devTable.devMatrix;
|
|
|
+import static initDevices.initCalc.mix;
|
|
|
+import java.util.ArrayList;
|
|
|
+import project82usb.*;
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author User
|
|
|
+ */
|
|
|
+public class initFrame extends javax.swing.JFrame{
|
|
|
+ private boolean firstList = false;
|
|
|
+ private devList before;
|
|
|
+ private devList after;
|
|
|
+ private devList filterList;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates new form initFrame
|
|
|
+ */
|
|
|
+ public initFrame() {
|
|
|
+ this.before=null;
|
|
|
+ this.after=null;
|
|
|
+ this.filterList=null;
|
|
|
+ initComponents();
|
|
|
+ tvOut.setText("**Подключите устройства ко всем портам хаба**\n\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This method is called from within the constructor to initialize the form.
|
|
|
+ * WARNING: Do NOT modify this code. The content of this method is always
|
|
|
+ * regenerated by the Form Editor.
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
|
+ private void initComponents() {
|
|
|
+
|
|
|
+ btnStep1 = new javax.swing.JButton();
|
|
|
+ jScrollPane2 = new javax.swing.JScrollPane();
|
|
|
+ tvOut = new javax.swing.JTextArea();
|
|
|
+
|
|
|
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
|
+ setTitle("Инициализация");
|
|
|
+
|
|
|
+ btnStep1.setText("Далее");
|
|
|
+ btnStep1.addActionListener(new java.awt.event.ActionListener() {
|
|
|
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
+ btnStep1ActionPerformed(evt);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tvOut.setColumns(20);
|
|
|
+ tvOut.setRows(5);
|
|
|
+ jScrollPane2.setViewportView(tvOut);
|
|
|
+
|
|
|
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
|
+ getContentPane().setLayout(layout);
|
|
|
+ layout.setHorizontalGroup(
|
|
|
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
+ .addContainerGap(357, Short.MAX_VALUE)
|
|
|
+ .addComponent(btnStep1)
|
|
|
+ .addContainerGap())
|
|
|
+ .addComponent(jScrollPane2)
|
|
|
+ );
|
|
|
+ layout.setVerticalGroup(
|
|
|
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
|
|
|
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
|
+ .addComponent(btnStep1)
|
|
|
+ .addContainerGap())
|
|
|
+ );
|
|
|
+
|
|
|
+ pack();
|
|
|
+ }// </editor-fold>//GEN-END:initComponents
|
|
|
+
|
|
|
+ private void btnStep1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStep1ActionPerformed
|
|
|
+ if(!this.firstList){
|
|
|
+ this.before = new devList();
|
|
|
+ this.firstList=true;
|
|
|
+ tvOut.setText("**Отключите все устройства от хаба**\n\n"
|
|
|
+ + "Учтите, что список портов может быть некорректен.\n"+
|
|
|
+ "Если будут одинаковые порты, перезапустите программу.\nЭто некорректная работа либо моего хаба, либо API\n");
|
|
|
+ } else {
|
|
|
+ this.after = new devList();
|
|
|
+ System.out.println("AFTER LIST:::"+this.after.toString());
|
|
|
+ this.filterList = mix(before,after);
|
|
|
+ this.filterList.toNull();
|
|
|
+ System.out.println("FILTER LIST:::"+this.filterList.toString());
|
|
|
+ new devMatrix(this.filterList).setVisible(true);
|
|
|
+ this.setVisible(false);
|
|
|
+ }
|
|
|
+ }//GEN-LAST:event_btnStep1ActionPerformed
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param args the command line arguments
|
|
|
+ */
|
|
|
+ public static void main(String args[]) {
|
|
|
+ /* Set the Nimbus look and feel */
|
|
|
+ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
|
|
+ /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
|
|
+ * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
|
|
+ */
|
|
|
+ try {
|
|
|
+ for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
|
|
+ if ("Nimbus".equals(info.getName())) {
|
|
|
+ javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (ClassNotFoundException ex) {
|
|
|
+ java.util.logging.Logger.getLogger(initFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
+ } catch (InstantiationException ex) {
|
|
|
+ java.util.logging.Logger.getLogger(initFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
+ } catch (IllegalAccessException ex) {
|
|
|
+ java.util.logging.Logger.getLogger(initFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
|
|
+ java.util.logging.Logger.getLogger(initFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
+ }
|
|
|
+ //</editor-fold>
|
|
|
+
|
|
|
+ /* Create and display the form */
|
|
|
+ java.awt.EventQueue.invokeLater(new Runnable() {
|
|
|
+ public void run() {
|
|
|
+ new initFrame().setVisible(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // Variables declaration - do not modify//GEN-BEGIN:variables
|
|
|
+ private javax.swing.JButton btnStep1;
|
|
|
+ private javax.swing.JScrollPane jScrollPane2;
|
|
|
+ private javax.swing.JTextArea tvOut;
|
|
|
+ // End of variables declaration//GEN-END:variables
|
|
|
+}
|