• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database Changes not Showing

 
Ranch Hand
Posts: 250
1
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic