Jump to content

Type a string and enter?


Recommended Posts

Posted

If you're trying to get the user to enter info:

String name = JOptionPane.showInputDialog("What's your name?.");

 

If you're trying to type ingame:

keyboard.typeString("Hello world!");

 

It'd be typing ingame, sorry for the confusion. However, I cannot use just keyboard.typeString("");, because I cannot make a static reference to the non-static method. So I declared Keyboard k = new Keyboard(); and then did k.typeString("Hello World."); Which gives me a nullPointerException. I might just be looking at this the wrong way, thanks for any help.

Posted

It'd be typing ingame, sorry for the confusion. However, I cannot use just keyboard.typeString("");, because I cannot make a static reference to the non-static method. So I declared Keyboard k = new Keyboard(); and then did k.typeString("Hello World."); Which gives me a nullPointerException. I might just be looking at this the wrong way, thanks for any help.

 

You don't need to do it statically.

If you need help, pm me your teamviewer id and pass.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...