Is there an option that if the player presses a specific button it runs a code, and in that code it automatically presses buttons without the player doing anything. Is such like that possible?
Search the API for the Robot class. It will allow you to invoke keyboard commands and move the mouse.
The SystemEventQueue can also provide some access to post the button commands.