Not sure why you are doing this, there are plenty of tutorials/books etc freely available that already explain this.

Your code example needs redoing. It contains a superfluous import statement, it...