Failed to store values in ArrayList of class object. (CODE EDITED)

后端 未结 2 609
夕颜
夕颜 2021-01-27 10:19

This is basically a Java code converter. It involves a GUI let user input class type, name and method. To store the values, I\'ve created a class VirtualClass with

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 10:43

    From information you posted, seems strange that you initiate VirtualClass stObject into actionPerformed method. Its mean that each time you recreate your object.

    Make your VirtualClass stObject to be global for example, like:

    private VirtualClass stObject;
    
    ...
    
    stObject = new VirtualClass();
    
    private class Handler implements ActionListener{
    
        public void actionPerformed(ActionEvent event){
    
        ...
    
       stObject.createClass(cName, mName, isP);
    

提交回复
热议问题