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

📄 proguardgui.java

📁 ProGuard 是一个免费的 Java类文件的压缩
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        // Create the load button.        JButton loadStackTraceButton = new JButton(msg("loadStackTrace"));        loadStackTraceButton.addActionListener(new MyLoadStackTraceActionListener());        JButton reTraceButton = new JButton(msg("reTrace"));        reTraceButton.addActionListener(new MyReTraceActionListener());        // Create the main tabbed pane.        TabbedPane tabs = new TabbedPane();        tabs.add(msg("proGuardTab"),     proGuardPanel);        tabs.add(msg("inputOutputTab"),  inputOutputPanel);        tabs.add(msg("shrinkingTab"),    shrinkingPanel);        tabs.add(msg("obfuscationTab"),  obfuscationPanel);        tabs.add(msg("optimizationTab"), optimizationPanel);        tabs.add(msg("informationTab"),  optionsPanel);        tabs.add(msg("processTab"),      processPanel);        tabs.add(msg("reTraceTab"),      reTracePanel);        tabs.addImage(Toolkit.getDefaultToolkit().getImage(            this.getClass().getResource(TITLE_IMAGE_FILE)));        // Add the bottom buttons to each panel.        proGuardPanel     .add(Box.createGlue(),       glueConstraints);        proGuardPanel     .add(loadButton,             bottomButtonConstraints);        proGuardPanel     .add(createNextButton(tabs), lastBottomButtonConstraints);        inputOutputPanel  .add(Box.createGlue(),           glueConstraints);        inputOutputPanel  .add(createPreviousButton(tabs), bottomButtonConstraints);        inputOutputPanel  .add(createNextButton(tabs),     lastBottomButtonConstraints);        shrinkingPanel    .add(Box.createGlue(),           glueConstraints);        shrinkingPanel    .add(createPreviousButton(tabs), bottomButtonConstraints);        shrinkingPanel    .add(createNextButton(tabs),     lastBottomButtonConstraints);        obfuscationPanel  .add(Box.createGlue(),           glueConstraints);        obfuscationPanel  .add(createPreviousButton(tabs), bottomButtonConstraints);        obfuscationPanel  .add(createNextButton(tabs),     lastBottomButtonConstraints);        optimizationPanel .add(Box.createGlue(),           glueConstraints);        optimizationPanel .add(createPreviousButton(tabs), bottomButtonConstraints);        optimizationPanel .add(createNextButton(tabs),     lastBottomButtonConstraints);        optionsPanel      .add(Box.createGlue(),           glueConstraints);        optionsPanel      .add(createPreviousButton(tabs), bottomButtonConstraints);        optionsPanel      .add(createNextButton(tabs),     lastBottomButtonConstraints);        processPanel      .add(Box.createGlue(),           glueConstraints);        processPanel      .add(createPreviousButton(tabs), bottomButtonConstraints);        processPanel      .add(viewButton,                 bottomButtonConstraints);        processPanel      .add(saveButton,                 bottomButtonConstraints);        processPanel      .add(processButton,              lastBottomButtonConstraints);        reTracePanel      .add(Box.createGlue(),     glueConstraints);        reTracePanel      .add(loadStackTraceButton, bottomButtonConstraints);        reTracePanel      .add(reTraceButton,        lastBottomButtonConstraints);        // Initialize the GUI settings to reasonable defaults.        loadConfiguration(this.getClass().getResource(DEFAULT_CONFIGURATION));        // Add the main tabs to the frame and pack it.        getContentPane().add(tabs);    }    public void startSplash()    {        splashPanel.start();    }    public void skipSplash()    {        splashPanel.stop();    }    /**     * Loads the boilerplate keep class options from the boilerplate file     * into the boilerplate array.     */    private void loadBoilerplateConfiguration()    {        try        {            // Parse the boilerplate configuration file.            ConfigurationParser parser = new ConfigurationParser(                this.getClass().getResource(BOILERPLATE_CONFIGURATION));            Configuration configuration = new Configuration();            try            {                parser.parse(configuration);                // We're interested in the keep options.                boilerplateKeep =                    extractKeepSpecifications(configuration.keep, false, false);                // We're interested in the keep options.                boilerplateKeepNames =                    extractKeepSpecifications(configuration.keep, true, false);                // We're interested in the side effects options.                boilerplateNoSideEffectMethods = new ClassSpecification[configuration.assumeNoSideEffects.size()];                configuration.assumeNoSideEffects.toArray(boilerplateNoSideEffectMethods);            }            finally            {                parser.close();            }        }        catch (Exception ex)        {            ex.printStackTrace();        }    }    /**     * Returns an array containing the ClassSpecifications instances with     * matching flags.     */    private KeepSpecification[] extractKeepSpecifications(List    keepSpecifications,                                                          boolean allowShrinking,                                                          boolean allowObfuscation)    {        List matches = new ArrayList();        for (int index = 0; index < keepSpecifications.size(); index++)        {            KeepSpecification keepSpecification = (KeepSpecification)keepSpecifications.get(index);            if (keepSpecification.allowShrinking   == allowShrinking &&                keepSpecification.allowObfuscation == allowObfuscation)            {                 matches.add(keepSpecification);            }        }        KeepSpecification[] matchingKeepSpecifications = new KeepSpecification[matches.size()];        matches.toArray(matchingKeepSpecifications);        return matchingKeepSpecifications;    }    /**     * Returns an array containing the ClassSpecification instances of the     * given array of KeepSpecification instances.     */    private ClassSpecification[] extractClassSpecifications(KeepSpecification[] keepSpecifications)    {        ClassSpecification[] classSpecifications = new ClassSpecification[keepSpecifications.length];        for (int index = 0; index < classSpecifications.length; index++)        {            classSpecifications[index] = keepSpecifications[index];        }        return classSpecifications;    }    /**     * 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++)        {            // The panel structure is derived from the comments.            String comments = boilerplateClassSpecifications[index].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"));

⌨️ 快捷键说明

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