← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #200666]: Error when trying to find image using eclipse Java

 

Question #200666 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/200666

    Status: Needs information => Open

Djg gave more information on the question:
Hi,

I was trying to play with sikuli and Java swings. Below is the code

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import org.sikuli.script.App;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Screen;

@SuppressWarnings("serial")
public class _JMenuBar extends JMenuBar implements ActionListener{
	JMenuItem iRun=null,iDebug=null,iStop =null;
	Controller controller=null;
	
	public _JMenuBar(Controller controller){
		this.controller=controller;
		this.createRun();
	}

	@Override
	public void actionPerformed(ActionEvent actionEvent) {
		if(actionEvent.getSource()==iRun){
			Screen s = new Screen();
			try {
				s.hover("./img/SignOn.png");
			} catch (FindFailed e) {
				e.printStackTrace();
			}
		}
	}	
	private void createRun(){
		JMenu mFile = new JMenu("Run");
		mFile.setMnemonic(KeyEvent.VK_R);
		add(mFile);
		iRun = new JMenuItem("Run");
		iRun.setMnemonic(KeyEvent.VK_R);
		iRun.addActionListener(this);
		mFile.add(iRun);
	}
}

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.