• Post Reply Bookmark Topic Watch Topic
  • New Topic

Database Changes not Showing  RSS feed

Joel Christophel
Ranch Hand
Posts: 250
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, I'm making an attendance program that involves SQL databases. I'm writing it via JDBC. Right now, when the program is started, a frame opens with two buttons: 'Add students' and 'Configure classes'. 'Add students' opens a JDialog that prompts for name and ID number and then stores student in the database. 'Configure classes' displays a JDialog containing a JList with all of the students in the 'students' table. This JDialog also has a JComboBox with which the user specifies which class selected JList student is added to.

The problem: When I run the program, if I first add a student to 'students' and then click 'Configure classes', the added student appears in the JList. However, if I run the program and first click 'Configure classes' and then add a student, the next time I click 'Configure classes', the newly added student doesn't appear. I'm not sure why this is happening because each time 'Configure classes' is clicked, a new JList object is created.

Here's what happens every time 'Configure classes' is clicked:

SearchPanel contains the JList, and a new JList object is made in the SearchPanel constructor.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!