Commit before trying to change JFrame to JPanel