java grids

I know how to write the code for a grid chart in java but im not sure on how to have the "user" input the size and width of the grid if they want different than the default size. Could any one assist me with this? thanks.