how to use a button to use selectRegion in java

Asked by wu

 i want to use sikuli with java

now i want create a button and the button can use the sikulix the region selectRegion fuction. but i add the method to the button

it not work and when my program done the selectRegion will done

this is my code
     button.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
      System.out.println("Select");
      Region ac = s.selectRegion();
  System.out.println(ac);
      }
});
then wait (5~10s) will appear the selectRegino but is wait to long

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
wu
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

try to run the action code from the event dispatch queue or from a separate asynch thread.

Revision history for this message
wu (chouhua) said :
#2

thx RaiMan i am a new hand use java thanks the Suggest