updated panelswitchingpanel. better thread safety and (hopefully)
correct usage of validate/repaint