• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help! How to create create a button from an event?  RSS feed

 
Brendon Randall
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, im not too sure how to go about this, hopefully someone can help me.

What i need to do is create a button from an event with code behind it. I have a JFrame with carious text fields for a user to enter product information and save it to a database. What i would like to be able to do now is when the user saves this information to the databse a button will be created on a different Jframe with the name of the product and some some more handling behind that button when that is pressed. The reason i want to do this is that i am trying to make a TouchScreen point of sales application

Thanks very much
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
run this, type something into the textfield, press enter, click the added button to trigger its actionListener

 
Brendon Randall
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot Michael that is very helpful, but i am now thinking that i may design a new JFrame and set its layout to a flow design, then when the frame loads it just queries the DB for all products that are stored and creates buttons for all of them.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!