• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Editing the jtable after item change using Jcombobox is not working  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm making a project about school management system , i have a jframe to set marks and inside the jframe i have a jtable which is connected to sql database , in the jframe I have a JCombobox with 6 different subjects and in my database i have created 6 tables for the subjects and if any of the subjects are clicked then the jTable will connect to database and change the table to that subject , after it is changed if you double click on any row and insert a value then it will automatically update the table in the database , but my problem is that if I select the first option from the jcombox which is English and edit the values then it works fine , but if I select any other option e.g Math or Science , then I try to edit the table then it edits the English table , I commented the English option in the code to see what happens and I saw that it edits only the first option and if you try to change the subjects and edit than it edits the first subject in the combobox , so how can I solve this ? please help

Posts: 64494
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Why have you only got one top‑level class? That is called the God class anti‑pattern (it has several other names) and is regarded as really poor design. You want different classes which do different things. You also want the application working at the command line before you even think of putting a GUI atop it.
There is something wrong with your having a combobox and using the equals method. That would make it impossible to introduce a new subject e.g. Religious Studies, PE. If you have a list of subject, either you do the same thing for each, i.e. record marks, in which case you need one Listener class, which uses the name of the subject, OR you are going to do different things with each in which case you want different listener classes.
Bras cause cancer. And tiny ads:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!