I’m trying to figure out a potential solution to a future problem
In my database, I have Subjects, Pupils, Subject_has_Pupils.
Subject
French
English
Maths
Pupils
John
Mary
Peter
Subject_has_pupils
John – French
Mary – Maths
As I KNOW what the correct data to enter is I can run my own inserts fine. If I was to try Insert Peter & Spanish into into Subject_has_Pupils, the insert obviously wouldn’t work.
But how is the user to know what value to put in for the Subject? Is it Possible to have a JList that displays the possible options to the user, and can then be inserted into the database.
I suggest using a JComboBox to let the user pick only what you want him to pick.
The JComboBox should be filled with data you retrieve from your database.
I suggest taking a look at the following link if you have never worked with JComboBoxes before:
http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html