Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Activating a button when pressing enter

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
This is my question...
I am writting a stock controlling system.
I have a JTextField to enter the "Item Code". There is a JButton which is called "ppu" to get the price per unit from a access database. Like that in the same form i have another button to calculate the sub total... to print the bill...etc. So what i want to know is how can I activate each and every button when pressed "enter" in different times. it is like when i have entered the itemcode and if i press the enter it should activate the ppu button and when i have entered the quantity and then if i press enter it should activate the subtotal button,
hope it is clear
thanks
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TextFields can have ActionListeners, too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!