java - JTextPane keypress emulation -


I have a JTextPane integration that should be done with the predefined steps on the keypress events. If I type manually then it works fine. But I have to emulate the incidents of keyperses on this integration for test purposes. The test environment is such that the given JTextPane has not been added to any other control. I tried to use Robot Class to correct JTextPane's visibility and editing capability and requested focus. The problem is that I do not have any major press event, and JTextPane's content is still empty Please give me some advice. Thanks,

Peter

The test environment is such that the given JTextPane Has not been added to any other control

Then the component is not visible on the screen and can not accept the focus, so the robot will not work.

I 'I'm not sure but you may be able to use it

  textPane.dispatchEvent (....)  

Or if that does not work, you can use it:

  textPane.getDocument (). InsertString (...);  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -