Allowing the “Enter” key to press the submit button, as opposed to only using MouseClick

前端 未结 7 1130
清歌不尽
清歌不尽 2020-11-27 04:23

I\'m learning Swing class now and everything about it. I\'ve got this toy program I\'ve been putting together that prompts for a name and then presents a JOptionPane with th

7条回答
  •  有刺的猬
    2020-11-27 05:06

    I know this isn't the best way to do it, but right click the button in question, events, key, key typed. This is a simple way to do it, but reacts to any key

提交回复
热议问题