Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a button to perform add function into database. Please help with the code.

 
Yuta Lolap
Ranch Hand
Posts: 86
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a button on my Dashboard.java file as follows and i have a added a actionlistener to it and written the fuction in the a different class. What is want is when i click on the button add i want the items to be added in to the database.
Am i calling the add button e.getsource()the right way or is it wrong?
------------------------------------------------
Dashboard.java partial code

----------------------------------------------------

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags (<- click this link) the next time you want to post some code.
I have added them for you this time.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am i calling the add button e.getsource()the right way or is it wrong?

Yes, this is one way to do it.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don’t like any action listeners with getSource in. But you have bigger problems than that, if you are not adding in the database.
I think you are going about the whole exercise the wrong way. Start by working out what to do in the database. Then work out a query, and get it working from the command line with a Java application. Once you have got that working, you can put the GUI on top of that. I think you will find your application quicker and easier to build like that.
 
Yuta Lolap
Ranch Hand
Posts: 86
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks i got it solved!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic