I want to add objects to a JList which has already been instantiated by the Netbeans genrated code.
I can’t pass my own list model in the JList constructor as I can’t modify the Netbeans generated code.
How can I add object to that JList.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As per my comment to nfechner, it really depends on how you’ve constructed your JList. If you’ve used the
JList(ListModel)orJList(Vector)constructors you can potentially amend the consents of your model through a call togetModel(), or in the case ofVector, simply maintain a reference to theVectorand amend that (providing you fire an event aftewards to notify any model listeners).However, I’m fairly sure there are “hooks” in the Netbeans IDE to allow you to specify a specific model implementation, which will then cause the code to be auto-generated to include this.