KeyPressed event in java
Depending on where you want to trap the “enter” key, you could use an ActionListener (on such components such as text components or buttons) or attach a key binding to you component This will rely on the component being focused.