I am developing an application in JAVA that takes input as speech and performs actions. What I want to achieve is button click without explicitly clicking on that button.
The idea is to take the speech input, use the result which is a String object, and invoke button click just by speech result.
I have been able to use that result to start notepad or browser.
For speech processing I am using Sphinx4 and eclipse IDE.
Example:
Result result = recognizer.recognize();
if (result != null)
{
String resultText = result.getBestFinalResultNoFiller();
if((resultText.equalsIgnoreCase("Notepad"))
{
try
{
pr[0] = new ProcessBuilder("notepad.exe").start();
}
Here resultText is the String object containing the user's input. Here I tried opening notepad if speaker says notepad.
But how to use this resultText to invoke actionPerformed of a button....?
Example: How to invoke this method of a JFrame without button click
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
NewJFrame1 frame = new NewJFrame1();
frame.setVisible(true);
this.dispose();
}