Hello Guys.
I need a help here.
I am doing a system using Java with GUI.
SO im curious how to add a value that i have extracted from a JTextField and display it as a List in the Jlist.
Here is my coding
//function for collecting data from JTextField
private void GetBookDetails()
{
newBook.setTitle(txtBookName.getText());
newBook.setAuthor(txtAuthor.getText());
newBook.setISBN(Integer.parseInt(txtISBN.getText()));
newBook.setPublishr(txtPublisher.getText());
newBook.setIDNum(Integer.parseInt(txtBookIDShow.getText()));
newBook.setBookStat(Integer.parseInt(txtStatus.getText()));
newBook.setReturnDate(Integer.parseInt(txtReturnDate.getText()));
newBook.setCatNumPublicationYr(Integer.parseInt(txtPublicationYr.getText()));
}
//function to put the BookID in the JList
private void AddBookJButtonActionPerformed(ActionEvent event)
{
long IDNum = 0L;
String Title="",Author="",Publishr="";
int CatNumPublicationYr=0;
long returnDate=0L;
int BookStat=0;
long ISBN=0L;
GetBookDetails();
newBook = new Book (IDNum, Title,Author,Publishr,CatNumPublicationYr,returnDate,BookStat,ISBN);
newBookArrayList.add(newBook);
position = newBookArrayList.size() - 1;
BookList.setListData(newBookArrayList.toArray());
}
Hope to have an immediate response..thnk you