0

I have a page with constuctor.

So, I have a button, and when this button is clicked, then function handleLogin starts to work.

vlcod
  • 229
  • 2
  • 3
  • 13
  • Have you tried to call it? Just handleLogin(); after this.passwordField.setValue(pass); – aSoler Aug 24 '15 at 08:27
  • What line of handleLogin() throws NullPointerException? This should be because it tries to get something that's not loaded. – aSoler Aug 24 '15 at 08:35
  • debug it and see what is making it fail. Meaby with a Thread.sleep it will be fixed. Other way could be to call the function from the client when the page is loaded, before the user clicks the button. – aSoler Aug 24 '15 at 08:52

2 Answers2

0

You can't do what you want in the constructor. Your handleLogin() method calls this.getWindow(), but your the button doesn't have a window until after it (and its parents) have been added to some frame that has been made visible. You have to call handleLogin() after the GUI has been fully created and made visible.

FredK
  • 4,094
  • 1
  • 9
  • 11
-1

Try to create a new thread that waits and then call the function. I suppose it fails because of the element is not created, meaby with this it is... hope I help.

vlcod
  • 229
  • 2
  • 3
  • 13
aSoler
  • 145
  • 1
  • 9