# Keyboard for the text field in the Polyscope

**URL:** <https://forum.universal-robots.com/t/keyboard-for-the-text-field-in-the-polyscope/31322>\
**Category:** URCap Development\
**Created:** [November 9, 2023, 2:35pm UTC](https://forum.universal-robots.com/t/keyboard-for-the-text-field-in-the-polyscope/31322 "2023-11-09T14:35:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![suhyb\_rezeq](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@suhyb\_rezeq](https://forum.universal-robots.com/u/suhyb_rezeq)\
**Post date:** [November 9, 2023, 2:35pm UTC](https://forum.universal-robots.com/t/keyboard-for-the-text-field-in-the-polyscope/31322/1 "2023-11-09T14:35:39Z")

</div>

When I press on a text field in PolyScope, no keyboard is displayed. For example, I want to enter a title as shown in the image below. Does anyone know how this can be done?  
 ![Title](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/a/a1f0e1536689e1380de6dc42fe222f6cb392e556.jpeg)

---

<div class="post-metadata">

**Author:** ![jgreineder](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jgreineder](https://forum.universal-robots.com/u/jgreineder)\
**Post date:** [February 28, 2024, 5:42pm UTC](https://forum.universal-robots.com/t/keyboard-for-the-text-field-in-the-polyscope/31322/2 "2024-02-28T17:42:52Z")

</div>

If you are using the starter package, it contains some example URCaps that use keyboards. I would recommend reading through their implementation to get a better idea of how to make keyboard API calls.   
  
I hope this all helps!

**The following links could be of some benefit for reference in developing swing objects:**

- [Universal Robots - URCap - Choosing Swing or HTML (universal-robots.com)](https://www.universal-robots.com/articles/ur/urplus-resources/urcap-choosing-swing-or-html/)
- [KeyboardInputFactory (api 1.13.0 API) (universal-robots.com)](https://plus.universal-robots.com/apidoc/115998/com/ur/urcap/api/domain/userinteraction/keyboard/keyboardinputfactory.html)
- [Universal Robots - URCap - API Reference Docs (universal-robots.com)](https://www.universal-robots.com/articles/ur/urplus-resources/urcap-api-reference-docs/)

Here is an example from the first link I provided:

**VIEW CLASS**

```auto

	private Box createInputBox(final JTextField textField,
			final ContributionProvider<samplesProgramNodeContribution> provider) {
		Box box = Box.createHorizontalBox();
		box.setAlignmentX(Component.LEFT_ALIGNMENT);

		textField.setFocusable(false);
		textField.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				KeyboardTextInput keyboardInput = provider.get().getKeyboardForInput();
				keyboardInput.show(textField, provider.get().getKeyBoardCallBack());
			}
		});

		box.add(textField);

		return box;
	}

	public void setINPUTtextField(String text) {
		this.inputTextField.setText(text);
	}

```

**CONTRIBUTION CLASS**

```auto

	private static final String INPUT_KEY = "input_key";
	private static final String INPUT_DEFAULT_VALUE = "not set";

	public KeyboardTextInput getKeyboardForInput() {

		KeyboardTextInput keyboard = keyboardInputFactory.createStringKeyboardInput();

		return keyboard;

	}

	public KeyboardInputCallback<String> getKeyBoardCallBack() {
		return new KeyboardInputCallback<String>() {

			@Override
			public void onOk(String value) {

				final String inputText = value;

				undoRedoManager.recordChanges(new UndoableChanges() {

					@Override
					public void executeChanges() {

						model.set(INPUT_KEY, inputText);

					}
				});

				view.setINPUTtextField("Your input is: " + model.get(INPUT_KEY, INPUT_DEFAULT_VALUE));

			}

		};
	}

```
