Where/when you declare and initialise your variables probably means that they are given values before the frame is constructed. Try giving them values after everything has been set up.