merge jframe and main  & fix some bugs