Universal Robots Forum

KeyboardInputFactory cannot be resolved to a type

I am using a JFileChooser to have the user select a file to be saved.
I am trying to add a keyboard so that the user can type in the file name.

static String SaveFileDialog(URCapAPI api)
{
	KeyboardInputFactory keyboardfactory = api.getInstallationAPIProvider().getUserInterfaceAPI().getUserInteraction()
		.getKeyboardInputFactory();
	final KeyboardTextInput keyboard = keyboardfactory.createStringKeyboardInput();

	JFileChooser fileChooser = new JFileChooser();
	fileChooser.setDialogTitle("Log File Output");                       
	fileChooser.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {

			final JFileChooser chooser = (JFileChooser) e.getSource();

			keyboard.show(chooser, new KeyboardInputCallback<String>() {
				@Override
				public void onOk(String value) {
					chooser.setSelectedFile(new File(String.valueOf(value)));
				}
			});
		}

	});
	int userSelection = fileChooser.showSaveDialog(null);
	
	if (userSelection == JFileChooser.APPROVE_OPTION) 
		return fileChooser.getSelectedFile().getAbsolutePath();
	else
		return "";
}

The code compiles fine but at runtime I get this error:

API 1.10.0
UR Software 5.4.2 Simulator on VM
Html UI for my installation node (if that’s relevant somehow)

The first argument of “keyboard.show” must be JTextField.
In your code, the argument is JFileChooser.

But I don’t know how to get JTextField Object of JFileChooser.

keyboard.show(chooser, new KeyboardInputCallback<String>() {
			@Override
			public void onOk(String value) {
				chooser.setSelectedFile(new File(String.valueOf(value)));
			}
		});