0

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answer, that is exactly what I was thinking of. That's going to be really helpful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.