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

📄 classspecificationdialog.java

📁 j2me 混淆包,用于混淆j2me的原代码用的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                returnValue = APPROVE_OPTION;                hide();            }        });        // Create the Cancel button.        JButton cancelButton = new JButton(GUIResources.getMessage("cancel"));        cancelButton.addActionListener(new ActionListener()        {            public void actionPerformed(ActionEvent e)            {                hide();            }        });        // Add all panels to the main panel.        JPanel mainPanel = new JPanel(layout);        mainPanel.add(commentsPanel,         panelConstraints);        if (fullKeepOptions)        {            mainPanel.add(keepOptionPanel,       panelConstraints);        }        mainPanel.add(accessPanel,           panelConstraints);        mainPanel.add(classNamePanel,        panelConstraints);        mainPanel.add(extendsClassNamePanel, panelConstraints);        mainPanel.add(classMembersPanel,     stretchPanelConstraints);        mainPanel.add(okButton,              okButtonConstraints);        mainPanel.add(cancelButton,          cancelButtonConstraints);        getContentPane().add(mainPanel);    }    /**     * Adds a JLabel and three JRadioButton instances in a ButtonGroup to the     * given panel with a GridBagLayout, and returns the buttons in an array.     */    private JRadioButton[] addRadioButtonTriplet(String labelText,                                                 JPanel panel)    {        GridBagConstraints labelConstraints = new GridBagConstraints();        labelConstraints.anchor = GridBagConstraints.WEST;        labelConstraints.insets = new Insets(2, 10, 2, 10);        GridBagConstraints buttonConstraints = new GridBagConstraints();        buttonConstraints.insets = labelConstraints.insets;        GridBagConstraints lastGlueConstraints = new GridBagConstraints();        lastGlueConstraints.gridwidth = GridBagConstraints.REMAINDER;        lastGlueConstraints.weightx   = 1.0;        // Create the radio buttons.        JRadioButton radioButton0 = new JRadioButton();        JRadioButton radioButton1 = new JRadioButton();        JRadioButton radioButton2 = new JRadioButton();        // Put them in a button group.        ButtonGroup buttonGroup = new ButtonGroup();        buttonGroup.add(radioButton0);        buttonGroup.add(radioButton1);        buttonGroup.add(radioButton2);        // Add the label and the buttons to the panel.        panel.add(new JLabel(labelText), labelConstraints);        panel.add(radioButton0,          buttonConstraints);        panel.add(radioButton1,          buttonConstraints);        panel.add(radioButton2,          buttonConstraints);        panel.add(Box.createGlue(),      lastGlueConstraints);        return new JRadioButton[]        {             radioButton0,             radioButton1,             radioButton2        };    }    /**     * Sets the ClassSpecification to be represented in this dialog.     */    public void setClassSpecification(ClassSpecification classSpecification)    {        String  className         = classSpecification.className;        String  extendsClassName  = classSpecification.extendsClassName;        boolean markClassFiles    = classSpecification.markClassFiles;        boolean markConditionally = classSpecification.markConditionally;        String  comments          = classSpecification.comments;        List    keepFieldOptions  = classSpecification.fieldSpecifications;        List    keepMethodOptions = classSpecification.methodSpecifications;        // Set the comments text area.        commentsTextArea.setText(comments == null ? "" : comments);        // Figure out the proper keep radio button and set it.        JRadioButton keepOptionRadioButton =            markConditionally ? keepClassesWithMembersRadioButton :            markClassFiles    ? keepClassesAndMembersRadioButton  :                                keepClassMembersRadioButton;        keepOptionRadioButton.setSelected(true);        // Set the access radio buttons.        setClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_PUBLIC,    publicRadioButtons);        setClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_FINAL,     finalRadioButtons);        setClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_INTERFACE, interfaceRadioButtons);        setClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_ABSTRACT,  abstractRadioButtons);        // Set the class name text fields.        classNameTextField       .setText(className        == null ? "*" : ClassUtil.externalClassName(className));        extendsClassNameTextField.setText(extendsClassName == null ? ""  : ClassUtil.externalClassName(extendsClassName));        // Set the keep class member option list.        classMembersPanel.setClassMemberSpecifications(keepFieldOptions, keepMethodOptions);    }    /**     * Returns the ClassSpecification currently represented in this dialog.     */    public ClassSpecification getClassSpecification()    {        String  comments          = commentsTextArea.getText();        String  className         = classNameTextField.getText();        String  extendsClassName  = extendsClassNameTextField.getText();        boolean markClassFiles    = !keepClassMembersRadioButton.isSelected();        boolean markConditionally = keepClassesWithMembersRadioButton.isSelected();        ClassSpecification classSpecification =            new ClassSpecification(0,                                    0,                                    className.equals("") ||                                    className.equals("*")       ? null : ClassUtil.internalClassName(className),                                    extendsClassName.equals("") ? null : ClassUtil.internalClassName(extendsClassName),                                    markClassFiles,                                    markConditionally,                                    comments.equals("")         ? null : comments);        // Also get the access radio button settings.        getClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_PUBLIC,    publicRadioButtons);        getClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_FINAL,     finalRadioButtons);        getClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_INTERFACE, interfaceRadioButtons);        getClassSpecificationRadioButtons(classSpecification, ClassConstants.INTERNAL_ACC_ABSTRACT,  abstractRadioButtons);        // Get the keep class member option lists.        classSpecification.fieldSpecifications  = classMembersPanel.getClassMemberSpecifications(true);        classSpecification.methodSpecifications = classMembersPanel.getClassMemberSpecifications(false);        return classSpecification;    }    /**     * Shows this dialog. This method only returns when the dialog is closed.     *     * @return <code>CANCEL_OPTION</code> or <code>APPROVE_OPTION</code>,     *         depending on the choice of the user.     */    public int showDialog()    {        returnValue = CANCEL_OPTION;        // Open the dialog in the right place, then wait for it to be closed,        // one way or another.        pack();        setLocationRelativeTo(getOwner());        show();        return returnValue;    }    /**     * Sets the appropriate radio button of a given triplet, based on the access     * flags of the given keep option.     */    private void setClassSpecificationRadioButtons(ClassSpecification classSpecification,                                                    int                 flag,                                                    JRadioButton[]      radioButtons)    {        int index = (classSpecification.requiredSetAccessFlags   & flag) != 0 ? 0 :                    (classSpecification.requiredUnsetAccessFlags & flag) != 0 ? 1 :                                                                                 2;        radioButtons[index].setSelected(true);    }    /**     * Updates the access flag of the given keep option, based on the given radio     * button triplet.     */    private void getClassSpecificationRadioButtons(ClassSpecification classSpecification,                                                    int                 flag,                                                    JRadioButton[]      radioButtons)    {        if      (radioButtons[0].isSelected())        {            classSpecification.requiredSetAccessFlags   |= flag;        }        else if (radioButtons[1].isSelected())        {            classSpecification.requiredUnsetAccessFlags |= flag;        }    }}

⌨️ 快捷键说明

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