简体   繁体   中英

How to add Array in a class to JLIST JAVA?

I want to add the name of array in the class to jList as below.

How can it be?

this is the method in display class

    public void dataToLocal(List<XDataObject> data, XServiceType xst, XServiceOperation operation) {
            if(operation.getName().equals(SNOWTAMSubscriberServiceInterface.OP_PUBLISSNOWTAM)) {    
    SNOWTAMPublication snowtamPublication = 
    (SNOWTAMPublication)data.get(0).getValue(); //This read an array with 5 values.

        SNOWTAM snowtam = snowtamPublication.getSNOWTAM()[0]; //This read read the array and its contents.

        jList1.add((Component) Arrays.asList((snowtamPublication.getSNOWTAM()[0]).toString())); //Here I want to add the name of Array to be as below
    }
}

This is SNOWTAMPublication which is only get and set methods for array.

protected SNOWTAM[] snowtam;

public SNOWTAM[] getSNOWTAM() {
    if(snowtam == null)
    {
        snowtam = new SNOWTAM[0];
    }
    return snowtam;
}

public void setSNOWTAM(SNOWTAM[] _value) {
    this.snowtam = _value;
}

The picture

在此处输入图片说明

您可以尝试:

<instance>.getClass().getSimpleName()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM