if you use jframe button, be careful to exit the system, otherwise, if the system is not closed, the application will still running, this is not good for computer resources usage. There are a few ways to archive this, I can elaborate more for beginner programmers.