Question: I am making a virtual keyboard in java eclipse / scene builder and am attempting to get letter and number keys to play audio of

I am making a virtual keyboard in java eclipse/scene builder and am attempting to get letter and number keys to play audio of what key is pressed. I.e. when you press A, it plays a sound file saying "A". Attached is a part of the code I have currently have, using the A button as an example. I already have and am planning on using wav audio files. Any help to get this working would be much appreciated.
import java.io.FileWriter;
import java.io.IOException;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.ToggleButton;
import javafx.scene.shape.Circle;
public class VirtualKeyboardController {
private boolean shiftPressedLeft = false;
private boolean shiftPressedRight = false;
private boolean capsLockOn = false;
@FXML
private TextArea textArea;
@FXML
private ToggleButton shiftLeft;
@FXML
private ToggleButton shiftRight;
@FXML
private Circle capslockLed;
@FXML
private Button buttonPressFunction2;
@FXML
private Button buttonPressFunction3;
@FXML
void buttonPressA(ActionEvent event){
placeText("a");
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!