How to set the ListModel of a JList in Netbeans?

I usually do this way in Netbeans 1. Select the JList 2. In model property, select Custom code and insert the listModel name (declared in 3rd step) 3. Declare DefaultListModel listModel = new DefaultListModel; in code view 4. Make changes to listModel.

Up vote 2 down vote favorite share g+ share fb share tw.

I have designed a Swing GUI with the help of Netbeans IDE and this GUI contains a JList. Bydefault, it uses AbstractListModel to pass it as an argument in the JList contructor to create that JList. I want to specify somewhere in the Netbeans to pass DefaultListModel as the model to be passed in that JList so that later I can retrieve it to make changes in the listModel.

How can I do that. Java gui swing netbeans jlist link|improve this question asked Jan 22 '10 at 14:27Yatendra Goel2,9591253116 69% accept rate.

You have two ways of doing this: 1) In your code manually call list.setModel() anywhere after initComponents() is called. 2) Do it through NetBeans - Right click the list, go to "Customize Code". The first code section is the list's constructor call.

Change the dropdown from "Default Code" to "Custom Creation" and simply insert your ListModel in the constructor call. You can do this by setting it to new javax.swing. JList(new DefaultListModel()) or by instantiating your listmodel before the call to initComponents() in the code and then doing javax.swing.

JList(defaultModel).

The listmodel of a jlist in netbeans is set (without quotes):. Set the ListModel of a JList in Netbeans.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions