Java swing and NetBeans
843805Nov 23 2006 — edited Aug 13 2007Hello everyone,
I'm new to java, and have got stuck on doing something rather simple.
I have created a jFrame using netbeans.
At the moment its a simple windows, with just a jList inside a jScrollPane.
Now, how in the world do I add or delete items from the List.
I have found countless examples of how to do this, but NONE of them take into count that "you didnt create the gui", (ie, they create/init the swing components manually). In my case Netbeans wrote the gui code and also a private void initComponents() ; Which I dont wish to touch.
All I've done is created a jFrame, and added a jList into jScrollPane.
Thats it, nothing else.
How do I write the...
public void addElememt(String element){}
and
public void delLastElememt(String element){}
Netbeans create my variables at the bottom of the screen...
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JList jList1;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration
Thank you.