⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proguardgui.java

📁 j2me 混淆包,用于混淆j2me的原代码用的
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            // We're interested in the keep names options.            boilerplateKeepNames = new ClassSpecification[configuration.keepNames.size()];            configuration.keepNames.toArray(boilerplateKeepNames);            // We're interested in the side effects options.            boilerplateNoSideEffectMethods = new ClassSpecification[configuration.assumeNoSideEffects.size()];            configuration.assumeNoSideEffects.toArray(boilerplateNoSideEffectMethods);        }        catch (Exception ex)        {            ex.printStackTrace();        }    }    /**     * Creates a panel with the given boiler plate class specifications.     */    private void addClassSpecifications(ClassSpecification[] boilerplateClassSpecifications,                                        JPanel               classSpecificationsPanel,                                        JCheckBox[]          boilerplateCheckBoxes,                                        JTextField[]         boilerplateTextFields)    {        // Create some constraints that can be reused.        GridBagConstraints constraints = new GridBagConstraints();        constraints.anchor = GridBagConstraints.WEST;        constraints.insets = new Insets(0, 4, 0, 4);        GridBagConstraints constraintsLastStretch = new GridBagConstraints();        constraintsLastStretch.gridwidth = GridBagConstraints.REMAINDER;        constraintsLastStretch.fill      = GridBagConstraints.HORIZONTAL;        constraintsLastStretch.weightx   = 1.0;        constraintsLastStretch.anchor    = GridBagConstraints.WEST;        constraintsLastStretch.insets    = constraints.insets;        GridBagConstraints panelConstraints = new GridBagConstraints();        panelConstraints.gridwidth = GridBagConstraints.REMAINDER;        panelConstraints.fill      = GridBagConstraints.HORIZONTAL;        panelConstraints.weightx   = 1.0;        panelConstraints.anchor    = GridBagConstraints.NORTHWEST;        panelConstraints.insets    = constraints.insets;        GridBagLayout layout = new GridBagLayout();        String lastPanelName = null;        JPanel keepSubpanel  = null;        for (int index = 0; index < boilerplateClassSpecifications.length; index++)        {            ClassSpecification classSpecification =                boilerplateClassSpecifications[index];            // The panel structure is derived from the comments.            String comments = classSpecification.comments;            int dashIndex = comments.indexOf('-');            int periodIndex = comments.indexOf('.', dashIndex);            String panelName = comments.substring(0, dashIndex).trim();            String optionName = comments.substring(dashIndex + 1, periodIndex).trim();            if (!panelName.equals(lastPanelName))            {                // Create a new keep subpanel and add it.                keepSubpanel = new JPanel(layout);                String titleKey = "boilerplate_" + panelName.toLowerCase().replace(' ', '_');                addBorder(keepSubpanel, titleKey);                classSpecificationsPanel.add(keepSubpanel, panelConstraints);                lastPanelName = panelName;            }            // Add the check box to the subpanel.            String messageKey = "boilerplate_" + optionName.toLowerCase().replace(' ', '_');            boilerplateCheckBoxes[index] = new JCheckBox(msg(messageKey));            keepSubpanel.add(boilerplateCheckBoxes[index],                             boilerplateTextFields != null ?                                 constraints :                                 constraintsLastStretch);            if (boilerplateTextFields != null)            {                // Add the text field to the subpanel.                boilerplateTextFields[index] = new JTextField(40);                keepSubpanel.add(boilerplateTextFields[index], constraintsLastStretch);            }        }    }    /**     * Adds a standard border with the title that corresponds to the given key     * in the GUI resources.     */    private void addBorder(JComponent component, String titleKey)    {        Border oldBorder = component.getBorder();        Border newBorder = BorderFactory.createTitledBorder(BORDER, msg(titleKey));        component.setBorder(oldBorder == null ?            newBorder :            new CompoundBorder(newBorder, oldBorder));    }    /**     * Creates a Previous button for the given tabbed pane.     */    private JButton createPreviousButton(final TabbedPane tabbedPane)    {        JButton browseButton = new JButton(msg("previous"));        browseButton.addActionListener(new ActionListener()        {            public void actionPerformed(ActionEvent e)            {                tabbedPane.previous();            }        });        return browseButton;    }    /**     * Creates a Next button for the given tabbed pane.     */    private JButton createNextButton(final TabbedPane tabbedPane)    {        JButton browseButton = new JButton(msg("next"));        browseButton.addActionListener(new ActionListener()        {            public void actionPerformed(ActionEvent e)            {                tabbedPane.next();            }        });        return browseButton;    }    /**     * Creates a browse button that opens a file browser for the given text field.     */    private JButton createBrowseButton(final JTextField textField,                                       final String     title)    {        JButton browseButton = new JButton(msg("browse"));        browseButton.addActionListener(new ActionListener()        {            public void actionPerformed(ActionEvent e)            {                fileChooser.setDialogTitle(title);                fileChooser.setSelectedFile(new File(textField.getText()));                int returnVal = fileChooser.showDialog(ProGuardGUI.this, msg("ok"));                if (returnVal == JFileChooser.APPROVE_OPTION)                {                    textField.setText(fileChooser.getSelectedFile().getPath());                }            }        });        return browseButton;    }    /**     * Sets the preferred sizes of the given components to the maximum of their     * current preferred sizes.     */    private void setCommonPreferredSize(List components)    {        // Find the maximum preferred size.        Dimension maximumSize = null;        for (int index = 0; index < components.size(); index++)        {            JComponent component = (JComponent)components.get(index);            Dimension  size      = component.getPreferredSize();            if (maximumSize == null ||                size.getWidth() > maximumSize.getWidth())            {                maximumSize = size;            }        }        // Set the size that we found as the preferred size for all components.        for (int index = 0; index < components.size(); index++)        {            JComponent component = (JComponent)components.get(index);            component.setPreferredSize(maximumSize);        }    }    /**     * Updates to GUI settings to reflect the given ProGuard configuration.     */    private void setProGuardConfiguration(Configuration configuration)    {        // Set up the input and output jars and directories.        programPanel.setClassPath(configuration.programJars);        libraryPanel.setClassPath(configuration.libraryJars);        // Set up the boilerplate keep options.        for (int index = 0; index < boilerplateKeep.length; index++)        {            String classNames =                findMatchingClassSpecifications(boilerplateKeep[index],                                                configuration.keep);            boilerplateKeepCheckBoxes[index].setSelected(classNames != null);            boilerplateKeepTextFields[index].setText(classNames == null ? "*" : classNames);        }        // Set up the additional keep options. Note that the matched boilerplate        // options have been removed from the list.        additionalKeepPanel.setClassSpecifications(configuration.keep);        // Set up the boilerplate keep names options.        for (int index = 0; index < boilerplateKeepNames.length; index++)        {            String classNames =                findMatchingClassSpecifications(boilerplateKeepNames[index],                                                configuration.keepNames);            boilerplateKeepNamesCheckBoxes[index].setSelected(classNames != null);            boilerplateKeepNamesTextFields[index].setText(classNames == null ? "*" : classNames);        }        // Set up the additional keep options. Note that the matched boilerplate        // options have been removed from the list.        additionalKeepNamesPanel.setClassSpecifications(configuration.keepNames);        // Set up the boilerplate "no side effect methods" options.        for (int index = 0; index < boilerplateNoSideEffectMethods.length; index++)        {            boolean found =                findClassSpecification(boilerplateNoSideEffectMethods[index],                                       configuration.assumeNoSideEffects);            boilerplateNoSideEffectMethodCheckBoxes[index].setSelected(found);        }        // Set up the additional keep options. Note that the matched boilerplate        // options have been removed from the list.        additionalNoSideEffectsPanel.setClassSpecifications(configuration.assumeNoSideEffects);        // Set up the other options.        shrinkCheckBox                          .setSelected(configuration.shrink);        printUsageCheckBox                      .setSelected(configuration.printUsage != null);        optimizeCheckBox                        .setSelected(configuration.optimize);        allowAccessModificationCheckBox         .setSelected(configuration.allowAccessModification);        obfuscateCheckBox                       .setSelected(configuration.obfuscate);        printMappingCheckBox                    .setSelected(configuration.printMapping != null);        applyMappingCheckBox                    .setSelected(configuration.applyMapping != null);        obfuscationDictionaryCheckBox           .setSelected(configuration.defaultPackage != null);        overloadAggressivelyCheckBox            .setSelected(configuration.overloadAggressively);        defaultPackageCheckBox                  .setSelected(configuration.obfuscationDictionary != null);        useMixedCaseClassNamesCheckBox          .setSelected(configuration.useMixedCaseClassNames);        keepAttributesCheckBox                  .setSelected(configuration.keepAttributes != null);        newSourceFileAttributeCheckBox          .setSelected(configuration.newSourceFileAttribute != null);        printSeedsCheckBox                      .setSelected(configuration.printSeeds != null);        verboseCheckBox                         .setSelected(configuration.verbose);        noteCheckBox                            .setSelected(configuration.note);        warnCheckBox                            .setSelected(configuration.warn);        ignoreWarningsCheckBox                  .setSelected(configuration.ignoreWarnings);        skipNonPublicLibraryClassesCheckBox     .setSelected(configuration.skipNonPublicLibraryClasses);        skipNonPublicLibraryClassMembersCheckBox.setSelected(configuration.skipNonPublicLibraryClassMembers);        printUsageTextField                     .setText(configuration.printUsage);        printMappingTextField                   .setText(configuration.printMapping);        applyMappingTextField                   .setText(configuration.applyMapping);        obfuscationDictionaryTextField          .setText(configuration.obfuscationDictionary);        defaultPackageTextField                 .setText(configuration.defaultPackage);        keepAttributesTextField                 .setText(configuration.keepAttributes         == null ? KEEP_ATTRIBUTE_DEFAULT : ListUtil.commaSeparatedString(configuration.keepAttributes));        newSourceFileAttributeTextField         .setText(configuration.newSourceFileAttribute == null ? SOURCE_FILE_ATTRIBUTE_DEFAULT : configuration.newSourceFileAttribute);        printSeedsTextField                     .setText(configuration.printSeeds);        if (configuration.printMapping != null)        {            reTraceMappingTextField.setText(configuration.printMapping);        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -