-2

我有两个类,每个类都有一个 JCheckBox 用于切换“创建”或“编辑”模式。我的代码在其中一个中工作,但在另一个类中我得到了 NullPointerException。据我所知,这两个类的代码几乎相同,所以我不知道为什么它在这个类中不起作用。异常发生在“jchkbxOptionToEditSection”的 LISTENER 标题中(第 311 行)。我将在此处发布整个文件,以便您查看上下文。这个类扩展了另一个类,所以我不确定它是否会为你编译。

import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.border.TitledBorder;
import javax.swing.text.BadLocationException;

/** Concrete class for creating or editing yoga sections */

public class YogaSectionDesigner extends YogaDesigner {

// Label and text field for editing section name
private JLabel jlblSectionName = new JLabel("Section name:");
protected JTextField jtfSectionName = new JTextField(15);

// Checkbox to toggle between creating new or editing
private JCheckBox jchkbxOptionToEditSection;

String selectedSectionType;
String selectedSectionName;

private String[] warmupList;
private String[] workList;
private String[] restoreList;

private JLabel jlblSelectWarmup = new JLabel("Warmup: ");
private JComboBox<String> jcbWarmup;

private JLabel jlblSelectWork = new JLabel("Work: ");
private JComboBox<String> jcbWork;

private JLabel jlblSelectRestore = new JLabel("Restore: ");
private JComboBox<String> jcbRestore;

// Arraylist to HOLD the list of poses the user is assembling for this section
private ArrayList<String> poseArrayList = new ArrayList<String>();

// Radio buttons to choose what kind of section this is
private JLabel jlblSectionType = new JLabel("What section of a class is this? ");
private JRadioButton jrbWarmup = new JRadioButton("Warmup");
private JRadioButton jrbWork = new JRadioButton("Work");
private JRadioButton jrbRestore = new JRadioButton("Restore");

// String to hold the value of which radio buttion is selected
// This value will be passed to the method that inserts new section into the database
String sectionSelected;

// Label and combo box for primary poses
private JLabel jlblSelectPose = new JLabel("Select a pose to add: ");
private String[] primaryPoseListWarmupArray;
private String[] primaryPoseListWorkArray;
private String[] primaryPoseListRestoreArray;
private JComboBox<String> jcbPoses;

// Label and combo box to hold list of secondary poses
private JLabel jlblSelectSecondaryPose = new JLabel("Choose from additional poses: ");
private String[] secondaryPoseListWarmupArray;
private String[] secondaryPoseListWorkArray;
private String[] secondaryPoseListRestoreArray;
private JComboBox<String> jcbSecondaryPoses;

// Arraylist to for poses that will actually be sent to database with the section when it's saved
private ArrayList<String> listToSave = new ArrayList<String>();

// Panel to contain the controls for creating and editing sections
private JPanel sectionPanel = new JPanel();

// Constructor
YogaSectionDesigner(UserInputWindow yoga, String poseList, String primaryPoseListWarmup, String primaryPoseListWork,
        String primaryPoseListRestore, String secondaryPoseListWarmup, String secondaryPoseListWork,
        String secondaryPoseListRestore) {
    super();
    makeSectionGUI(yoga, poseList, primaryPoseListWarmup, primaryPoseListWork,
            primaryPoseListRestore, secondaryPoseListWarmup, secondaryPoseListWork, secondaryPoseListRestore);
}

// Method that adds the features needed to suit the makeGUI method in the abstract class for working with sections
public void makeSectionGUI(final UserInputWindow yoga, final String poseList, final String primaryPoseListWarmup, final String primaryPoseListWork,
        final String primaryPoseListRestore, final String secondaryPoseListWarmup, final String secondaryPoseListWork,
        final String secondaryPoseListRestore) {        

    jlblDisplay.setText("Unsaved Section:");
    mainPanel = new JPanel(new BorderLayout());
    setUpSectionPanel(yoga, poseList, primaryPoseListWarmup, primaryPoseListWork,
            primaryPoseListRestore, secondaryPoseListWarmup, secondaryPoseListWork, secondaryPoseListRestore);

    jchkbxOptionToEditSection = new JCheckBox("Choose an existing section to edit (optional):", false);

    mainPanel.add(sectionPanel, BorderLayout.CENTER);
    add(mainPanel, BorderLayout.CENTER);

    // Listener for Save button
    jbtSave.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (jchkbxOptionToEditSection.isSelected()) {  // User is saving changes to an existing section
                System.out.println("Save Changes button was pressed in edit mode");
                String text = jtfDisplay.getText();
                //Verify with user that they wish to add this section to the database
                int confirmation = JOptionPane.showConfirmDialog(null, "Are you sure you want to overwrite this section?" + 
                    " This will erase the old version and replace it with the changes you've specified.", null, JOptionPane.YES_NO_OPTION);
                // If user confirms yes, then proceed
                if (confirmation == JOptionPane.YES_OPTION) {
                    JOptionPane.showMessageDialog(null, "Make sure you have only one pose per line in the display box and that " +
                            "the poses are spelled exactly the same as they are in the database.");
                    // Delete original version of the section
                    yoga.database.deleteRow(selectedSectionType, selectedSectionType + "_name", selectedSectionName);
                    int totalLines = jtfDisplay.getLineCount();
                    int linesAllowed = yoga.database.countColumnsInTable(sectionSelected);
                    // Check to see if user has entered too many items for this table
                    if (totalLines <= linesAllowed) {
                        for (int i=0; i < totalLines; i++) {
                            try {
                                int start = jtfDisplay.getLineStartOffset(i);
                                int end   = jtfDisplay.getLineEndOffset(i);
                                String line = text.substring(start, end);
                                line = line.replace("\n", "");
                                listToSave.add(line);
                            } catch (BadLocationException badLocationEx) {
                                System.err.println("There was an error reading poses from the text area");
                            }
                        }
                        yoga.database.insertNewSection(sectionSelected, jtfSectionName.getText().trim(), listToSave);
                        refresh(yoga);
                    } else 
                        JOptionPane.showMessageDialog(null, "The " + sectionSelected + " section only allows " + linesAllowed + 
                                " poses. You're trying to add too many.");
                }
            } else if (!jchkbxOptionToEditSection.isSelected()){  // User is saving a newly created section
                String text = jtfDisplay.getText();
                //Verify with user that they wish to add this section to the database
                int confirmation = JOptionPane.showConfirmDialog(null, "Are you sure you want to add the section " + jtfSectionName.getText() + 
                        " as a " + sectionSelected + " section?", null, JOptionPane.YES_NO_OPTION);
                // If user confirms yes, then proceed
                if (confirmation == JOptionPane.YES_OPTION) {
                    int totalLines = jtfDisplay.getLineCount();
                    int linesAllowed = yoga.database.countColumnsInTable(sectionSelected);
                    // Check to see if user has entered too many items for this table
                    if (totalLines <= linesAllowed) {
                        for (int i=0; i < totalLines; i++) {
                            try {
                                int start = jtfDisplay.getLineStartOffset(i);
                                int end   = jtfDisplay.getLineEndOffset(i);
                                String line = text.substring(start, end);
                                line = line.replace("\n", "");
                                listToSave.add(line);
                            } catch (BadLocationException badLocationEx) {
                                System.err.println("There was an error reading poses from the text area");
                            }
                        }
                        yoga.database.insertNewSection(sectionSelected, jtfSectionName.getText().trim(), listToSave);
                        refresh(yoga);
                    } else 
                        JOptionPane.showMessageDialog(null, "The " + sectionSelected + " section only allows " + linesAllowed + 
                                " poses. You're trying to add too many.");
                }
            } else {
                JOptionPane.showMessageDialog(null, "You've made no changes to be saved.");
            }
        }
    });

    // Listener for Delete Section button with confirmation dialog box
    jbtDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (jchkbxOptionToEditSection.isSelected()) {  // User has selected the edit checkbox
                // User must make a selection from combo box
                if (jcbWarmup.getSelectedItem() == null && jcbWork.getSelectedItem() == null && jcbRestore.getSelectedItem() == null) {  
                    JOptionPane.showMessageDialog(null, "You haven't selected a section to delete.");
                } else { // A section has been selected from one of the combo boxes
                    int confirmation = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this section?: " + 
                             selectedSectionName, null, JOptionPane.YES_NO_OPTION);

                    if (confirmation == JOptionPane.YES_OPTION) {
                        yoga.database.deleteRow(selectedSectionType, selectedSectionType + "_name", selectedSectionName);
                        refresh(yoga);
                    }
                }
            } else {  // User has not selected the edit checkbox and just wants to clear the text area
                refresh(yoga);
            }
        }
    });
}

// Method to refresh all lists and clear text fields
private void refresh (final UserInputWindow yoga) {
    warmupList = yoga.database.listForBoxes("warmup").split(", ");
    jcbWarmup.setModel(new DefaultComboBoxModel<String>(warmupList));
    workList = yoga.database.listForBoxes("work").split(", ");
    jcbWork.setModel(new DefaultComboBoxModel<String>(workList));
    restoreList = yoga.database.listForBoxes("restore").split(", ");
    jcbRestore.setModel(new DefaultComboBoxModel<String>(restoreList));
    selectedSectionType = "";
    jtfSectionName.setText(null);
    jlblDisplay.setText("Unsaved Section:");
    jtfDisplay.setText(null);
}

private void setUpSectionPanel(final UserInputWindow yoga, String poseList, String primaryPoseListWarmup, String primaryPoseListWork,
        String primaryPoseListRestore, String secondaryPoseListWarmup, String secondaryPoseListWork,
        String secondaryPoseListRestore) {

    // Set up combo boxes with lists of existing sections from database
    warmupList = yoga.database.listForBoxes("warmup").split(", ");
    workList = yoga.database.listForBoxes("work").split(", ");
    restoreList = yoga.database.listForBoxes("restore").split(", ");
    jcbWarmup = new JComboBox<String>(warmupList);
    jcbWork = new JComboBox<String>(workList);
    jcbRestore = new JComboBox<String>(restoreList);

    sectionPanel.setBorder(new TitledBorder("Sections"));

    // Default is Create mode, not Edit mode
    jcbWarmup.setEnabled(false);
    jcbWork.setEnabled(false);
    jcbRestore.setEnabled(false);


    // Put lists of primary poses into arrays
    primaryPoseListWarmupArray = primaryPoseListWarmup.split(", ");
    primaryPoseListWorkArray = primaryPoseListWork.split(", ");
    primaryPoseListRestoreArray = primaryPoseListRestore.split(", ");
    // Put lists of secondary poses into arrays
    secondaryPoseListWarmupArray = secondaryPoseListWarmup.split(", ");
    secondaryPoseListWorkArray = secondaryPoseListWork.split(", ");
    secondaryPoseListRestoreArray = secondaryPoseListRestore.split(", ");

    // Create a panel to hold radio buttons
    JPanel radioButtonPanel = new JPanel();
    radioButtonPanel.setLayout(new GridLayout(1,4));
    radioButtonPanel.add(jrbWarmup);
    radioButtonPanel.add(jrbWork);
    radioButtonPanel.add(jrbRestore);


    // Create listener for radio buttons
    RadioButtonListener rbListener = new RadioButtonListener();

    // Register listener with buttons
    jrbWarmup.addActionListener(rbListener);
    jrbWork.addActionListener(rbListener);
    jrbRestore.addActionListener(rbListener);

    // Create a radio button group and add to panel
    ButtonGroup group = new ButtonGroup();
    group.add(jrbWarmup);
    group.add(jrbWork);
    group.add(jrbRestore);
    // Default radio button is Warmup
    jrbWarmup.setSelected(true);
    sectionSelected = "warmup";

    // Initially populate combo boxes using the Warmup section
    jcbPoses = new JComboBox<String>(primaryPoseListWarmupArray);
    jcbPoses.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            poseArrayList.add((String) jcbPoses.getSelectedItem());
            updateTextArea(jtfDisplay, (String) jcbPoses.getSelectedItem());
        }
    });
    jcbSecondaryPoses = new JComboBox<String>(secondaryPoseListWarmupArray);
    jcbSecondaryPoses.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            poseArrayList.add((String) jcbSecondaryPoses.getSelectedItem());
            updateTextArea(jtfDisplay, (String) jcbSecondaryPoses.getSelectedItem());
        }
    });

    // Add listener for the Select Warmup combo box that gets the warmup name and puts it in the text field for editing
    jcbWarmup.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jtfSectionName.setText((String)jcbWarmup.getSelectedItem());
            selectedSectionType = "warmup";
            selectedSectionName = (String)jcbWarmup.getSelectedItem();
            jlblDisplay.setText(selectedSectionName + " (" + selectedSectionType + ")");
            // Clear the display and then re-populate it with a list of poses assigned to this specific section
            jtfDisplay.setText(null);
            jtfDisplay.setText(yoga.database.listPosesInSection("warmup", selectedSectionName));
        }
    });

    // Add listener for the Select Work combo box that gets the warmup name and puts it in the text field for editing
    jcbWork.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jtfSectionName.setText((String)jcbWork.getSelectedItem());
            selectedSectionType = "work";
            selectedSectionName = (String)jcbWork.getSelectedItem();
            jlblDisplay.setText(selectedSectionName + " (" + selectedSectionType + ")");
            // Clear the display and then re-populate it with a list of poses assigned to this specific section
            jtfDisplay.setText(null);
            jtfDisplay.setText(yoga.database.listPosesInSection("work", selectedSectionName));
        }
    });

    // Add listener for the Select Warmup combo box that gets the warmup name and puts it in the text field for editing
    jcbRestore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jtfSectionName.setText((String)jcbRestore.getSelectedItem());
            selectedSectionType = "restore";
            selectedSectionName = (String)jcbRestore.getSelectedItem();
            jlblDisplay.setText(selectedSectionName + " (" + selectedSectionType + ")");
            // Clear the display and then re-populate it with a list of poses assigned to this specific section
            jtfDisplay.setText(null);
            jtfDisplay.setText(yoga.database.listPosesInSection("restore", selectedSectionName));
        }
    });

    // Listener for the check box that determines Edit or Create mode
    jchkbxOptionToEditSection.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent arg0) {
            if (jchkbxOptionToEditSection.isSelected()) {
                jcbWarmup.setEnabled(true);
                jcbWork.setEnabled(true);
                jcbRestore.setEnabled(true);
            } else {
                jcbWarmup.setEnabled(false);
                jcbWork.setEnabled(false);
                jcbRestore.setEnabled(false);
            }
        }
    });

    // Use GroupLayout to place components
    GroupLayout groupLayout = new GroupLayout(sectionPanel);
    groupLayout.setHorizontalGroup(
        groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup()
                .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(groupLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                            .addGroup(groupLayout.createSequentialGroup()
                                .addGap(8)
                                .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                                    .addComponent(jlblSelectRestore)
                                    .addComponent(jlblSelectWork)
                                    .addComponent(jlblSelectWarmup))
                                .addGap(18)
                                .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                                    .addComponent(jcbWork, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jcbWarmup, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jcbRestore, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jlblSelectPose)
                            .addComponent(jlblSelectSecondaryPose))
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                            .addComponent(jcbPoses, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(jcbSecondaryPoses, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                    .addGroup(groupLayout.createSequentialGroup()
                        .addGap(10)
                        .addComponent(jlblSectionType))
                    .addGroup(groupLayout.createSequentialGroup()
                        .addGap(10)
                        .addComponent(jchkbxOptionToEditSection))
                    .addGroup(groupLayout.createSequentialGroup()
                        .addGap(10)
                        .addComponent(jlblSectionName)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(jtfSectionName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addGroup(groupLayout.createSequentialGroup()
                        .addGap(20)
                        .addComponent(jrbWarmup)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(jrbWork)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(jrbRestore)))
                .addContainerGap(225, Short.MAX_VALUE))
    );
    groupLayout.setVerticalGroup(
        groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jlblSectionName)
                    .addComponent(jtfSectionName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(jchkbxOptionToEditSection)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jlblSelectWarmup)
                    .addComponent(jcbWarmup, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jlblSelectWork)
                    .addComponent(jcbWork, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jlblSelectRestore)
                    .addComponent(jcbRestore, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(jlblSectionType)
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jrbWarmup)
                    .addComponent(jrbWork)
                    .addComponent(jrbRestore))
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jlblSelectPose)
                    .addComponent(jcbPoses, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jlblSelectSecondaryPose)
                    .addComponent(jcbSecondaryPoses, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addContainerGap(68, Short.MAX_VALUE))
    );
    sectionPanel.setLayout(groupLayout);
    sectionPanel.setPreferredSize(PANELSIZE);
}

// Listener for radio buttons
class RadioButtonListener implements ActionListener {
    @Override
    public void actionPerformed(ActionEvent e) {
        if (jrbWarmup.isSelected()) {
            jcbPoses.setModel(new DefaultComboBoxModel<String>(primaryPoseListWarmupArray));
            jcbSecondaryPoses.setModel(new DefaultComboBoxModel<String>(secondaryPoseListWarmupArray));
            sectionSelected = "warmup";
        } else if (jrbWork.isSelected()) {
            jcbPoses.setModel(new DefaultComboBoxModel<String>(primaryPoseListWorkArray));
            jcbSecondaryPoses.setModel(new DefaultComboBoxModel<String>(secondaryPoseListWorkArray));
            sectionSelected = "work";
        } else if (jrbRestore.isSelected()) {
            jcbPoses.setModel(new DefaultComboBoxModel<String>(primaryPoseListRestoreArray));
            jcbSecondaryPoses.setModel(new DefaultComboBoxModel<String>(secondaryPoseListRestoreArray));
            sectionSelected = "restore";
        }
    }
}

// Method that updates the text area with the arraylist of poses the user is assembling
private void updateTextArea(JTextArea jta, String pose) { 
    jta.append(pose + "\n");
}

}

这是错误显示:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at YogaSectionDesigner.setUpSectionPanel(YogaSectionDesigner.java:311)
at YogaSectionDesigner.makeSectionGUI(YogaSectionDesigner.java:86)
at YogaSectionDesigner.<init>(YogaSectionDesigner.java:75)
at UserInputWindow.openYogaSectionDesigner(UserInputWindow.java:118)
at UserInputWindow$1.actionPerformed(UserInputWindow.java:86)
at javax.swing.JComboBox.fireActionEvent(Unknown Source)
at javax.swing.JComboBox.setSelectedItem(Unknown Source)
at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
4

1 回答 1

1

jchkbxOptionToEditSection在第 86 行中仍未初始化setUpSectionPanel()(在第 89 行初始化)

//setUpSectionPanel uses jchkbxOptionToEditSection but it is null here!
setUpSectionPanel(yoga, poseList, primaryPoseListWarmup, primaryPoseListWork,
        primaryPoseListRestore, secondaryPoseListWarmup, secondaryPoseListWork, secondaryPoseListRestore);

jchkbxOptionToEditSection = new JCheckBox("Choose an existing section to edit (optional):", false);
于 2013-05-28T13:07:54.620 回答