Hi, here is some of my code
public class ControlIL extends JFrame implements ActionListener, ListSelectionLi stener {
private JList Items;
//builds the UI
public ControlIL(){
DefaultListMode l model = new DefaultListMode l();
JList Items = new JList(model);
}
I want to be able to add to the List when a certain button I have is pressed, Im not new to Java, i know how to add to the List using a vector but it only works when I add to the List within the ControlIL function, however, outside of the ControlIL function(where I have all my actionPerformed code and other logic and functions, anytime I try to add to the list using Items.setListDa ta(vector), that does not work, I get null pointer excep.; and when I try model._____ nothing even pops up as a possibility for the use of model, the variable cannot be found.
Any help would be greatly appreciated!
Thank You!
public class ControlIL extends JFrame implements ActionListener, ListSelectionLi stener {
private JList Items;
//builds the UI
public ControlIL(){
DefaultListMode l model = new DefaultListMode l();
JList Items = new JList(model);
}
I want to be able to add to the List when a certain button I have is pressed, Im not new to Java, i know how to add to the List using a vector but it only works when I add to the List within the ControlIL function, however, outside of the ControlIL function(where I have all my actionPerformed code and other logic and functions, anytime I try to add to the list using Items.setListDa ta(vector), that does not work, I get null pointer excep.; and when I try model._____ nothing even pops up as a possibility for the use of model, the variable cannot be found.
Any help would be greatly appreciated!
Thank You!
Comment