you have this line:
if (button instanceof Button)
which will never evaluate to true as your 'OK' button is a JButton
and this is not descended from Button. You could change it to:
if (button instanceof JButton)
though this is not really necessary as the line you have later is
sufficient to check that the OK button has been pressed:
if(button == ok)
You will have more problems when you get that part working, like when
you call
PasswordBox.setVisible(false)
You have variables with the same name as the class, PasswordBox,
which is VERY confusing.