Do you want the GUI to remember the last ID number assigned between executions of the program? If so, then you are talking about "persistence". Databases have a way to remember and automatically increment an ID field in a table. If you don't need a database you could simply use a flat file that you constantly update and read.
Thanks for answering! I want to be able to write the name of the car in a field that I have created and then press a button with the text "get autogenerated carID" or something and the ID will pop up in another field. I want the computer to remember which Id that belongs to the car and be able to give a new ID to a new car etc.
No the program does not have to remember the cars between the runs.
Everything is done except the autogenerated ID. Right now you write it manually, but I want it to be generated when you write the name of the car.