混淆后,JT中的JTable绑定无法正常工作

时间:2015-08-18 09:43:16

标签: java binding jtable proguard

我有一个基于swing的GUI应用程序,我试图使用Proguard工具进行混淆,在混淆之后我的Jtable.binding无法正常工作

是否可以在proguard中单独取消混淆Jtable绑定?

我在混淆之前添加了一个示例代码。

private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        itemInventoryLookupModel1 = new com.retail.pos.model.ItemInventoryLookupModel();
        itemInventoryLookupModel2 = new com.retail.pos.model.ItemInventoryLookupModel();
        sessionEntity1 = new com.ex.framework.session.SessionEntity();
        categoryConverter1 = new com.tpos.view.binding.converters.CategoryConverter();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        close = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        lblRowCount = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        List<ItemMasterSearch> itemList = getItemList();
        itemTable = new javax.swing.JTable();
        jPanel8 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        tfSearchText2 = new javax.swing.JTextField();
        lblSearchText2 = new javax.swing.JLabel();
        tfSearchText = new javax.swing.JTextField();
        lblSearchText = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        bSearch = new javax.swing.JButton();
        bClear = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel47 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        pnlRadioButton = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        rbItemDescription = new javax.swing.JRadioButton();
        rbItemCode = new javax.swing.JRadioButton();
        rbItemEan = new javax.swing.JRadioButton();
        rbPriceRange = new javax.swing.JRadioButton();
        rbPrice = new javax.swing.JRadioButton();
        rbBrand = new javax.swing.JRadioButton();
        rbCategoryDesc = new javax.swing.JRadioButton();
        jPanel15 = new javax.swing.JPanel();
        rbStartsWith = new javax.swing.JRadioButton();
        rbAnywhereInText = new javax.swing.JRadioButton();
        cbSearchWithinResult = new javax.swing.JCheckBox();
        bFeatures = new javax.swing.JButton();
        pnlTextField = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        tfItemNumber = new javax.swing.JFormattedTextField();
        jLabel6 = new javax.swing.JLabel();
        tfBarCode = new javax.swing.JFormattedTextField();
        jLabel8 = new javax.swing.JLabel();
        tfSize = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        tfPriceFrom = new javax.swing.JFormattedTextField();
        jLabel15 = new javax.swing.JLabel();
        tfItemdescription = new javax.swing.JFormattedTextField();
        jLabel18 = new javax.swing.JLabel();
        combCategory = new javax.swing.JComboBox();
        jLabel19 = new javax.swing.JLabel();
        tfColor = new javax.swing.JFormattedTextField();
        jLabel20 = new javax.swing.JLabel();
        tfPriceTo = new javax.swing.JFormattedTextField();
        jLabel3 = new javax.swing.JLabel();
        tfALU = new javax.swing.JTextField();
        jPanel11 = new javax.swing.JPanel();
        cbSearchWithinResult1 = new javax.swing.JCheckBox();
        jPanel7 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);

        String RED = ViewProperty.getString("panel_R");
        String GREEN = ViewProperty.getString("panel_G");
        String BLUE = ViewProperty.getString("panel_B");
        jPanel1.setBackground(new Color(new Integer(RED), new Integer(GREEN), new Integer(BLUE)));
        jPanel1.setPreferredSize(new java.awt.Dimension(762, 543));

        jPanel2.setBackground(new Color(new Integer(RED), new Integer(GREEN), new Integer(BLUE)));
        jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        close.setFont(new java.awt.Font("Tahoma", 1, 11));
        close.setText("Close-F4");
        close.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeActionPerformed(evt);
            }
        });
        close.setVerifyInputWhenFocusTarget(false);
        close.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0), "Close_Action");
        close.getActionMap().put("Close_Action", new AbstractAction("Close_Action") {
            public void actionPerformed(ActionEvent evt) {
                closeActionPerformed(evt);
            }
        }
    );

    jLabel1.setText("No.Of Records: ");

    org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(jPanel2Layout.createSequentialGroup()
            .addContainerGap()
            .add(jLabel1)
            .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jPanel2Layout.createSequentialGroup()
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(lblRowCount)
                    .addContainerGap(664, Short.MAX_VALUE))
                .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(close, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(62, 62, 62))))
    );
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(jPanel2Layout.createSequentialGroup()
            .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                .add(jLabel1)
                .add(lblRowCount)
                .add(close))
            .addContainerGap())
    );

    jPanel3.setBackground(new Color(new Integer(RED), new Integer(GREEN), new Integer(BLUE)));
    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Search Results", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman 14 12 12", 1, 12))); // NOI18N
    jPanel3.setPreferredSize(new java.awt.Dimension(762, 140));

    jScrollPane1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

    itemTable.setEditingColumn(0);
    itemTable.setEditingRow(0);
    itemTable.setAutoCreateRowSorter(true);
    itemTable.setNextFocusableComponent(itemTable);
    itemTable.getTableHeader().setReorderingAllowed(false);

    org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${itemList}");
    org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, eLProperty, itemTable);
    org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${itemEAN}"));
    columnBinding.setColumnName("Item EAN");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${itemCode}"));
    columnBinding.setColumnName("Item Code");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${longDesc}"));
    columnBinding.setColumnName("Long Description");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${salePrice}"));
    columnBinding.setColumnName("Sale Price");
    columnBinding.setColumnClass(Double.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${maxRetailPrice}"));
    columnBinding.setColumnName("M.R.P");
    columnBinding.setColumnClass(Double.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${varcharColumn3}"));
    columnBinding.setColumnName("Product Life Status");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${varcharColumn1}"));
    columnBinding.setColumnName("Brand Description");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${codeDesc}"));
    columnBinding.setColumnName("Category Description");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${materialType}"));
    columnBinding.setColumnName("Material Type");
    columnBinding.setColumnClass(String.class);
    columnBinding.setEditable(false);
    bindingGroup.addBinding(jTableBinding);
    jTableBinding.bind();
 itemTable.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            itemTableMouseClicked(evt);
        }
    });
    itemTable.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            itemTableKeyPressed(evt);
        }
    });
    jScrollPane1.setViewportView(itemTable);
    itemTable.getColumnModel().getColumn(0).setResizable(false);
    itemTable.getColumnModel().getColumn(1).setResizable(false);
    itemTable.getColumnModel().getColumn(2).setResizable(false);
    itemTable.getColumnModel().getColumn(3).setResizable(false);
    itemTable.getColumnModel().getColumn(4).setResizable(false);
    itemTable.getColumnModel().getColumn(5).setResizable(false);
    itemTable.getColumnModel().getColumn(6).setResizable(false);
    itemTable.getColumnModel().getColumn(7).setResizable(false);
    itemTable.getColumnModel().getColumn(8).setResizable(false);
}

}
}

在此示例中,在混淆UI之前正在创建UI但在混淆之后,我的jTableBinding.bind()无效,因为这会导致异常

  

(itemTable.getColumnModel()中的数据索引超出界限.getColumn(0).setResizable(false))。

0 个答案:

没有答案