com.badlogic.gdx.scenes.scene2d.utils.FocusListener Java Examples
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.utils.FocusListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeyboardFocusChangedLmlAttribute.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@Override public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) { final ActorConsumer<?, Params> action = parser.parseAction(rawAttributeData, tmpParams); if (action == null) { parser.throwError("Could not find action for: " + rawAttributeData + " with actor: " + actor); } actor.addListener(new FocusListener() { @Override public void keyboardFocusChanged(FocusEvent event, Actor target, boolean focused) { if (target == actor) { tmpParams.actor = actor; tmpParams.focused = focused; action.consume(tmpParams); tmpParams.reset(); } } }); }
Example #2
Source File: SpinnerSelectAllOnFocusLmlAttribute.java From gdx-texture-packer-gui with Apache License 2.0 | 6 votes |
@Override public void process(final LmlParser parser, final LmlTag tag, final Spinner spinner, final String rawAttributeData) { boolean value = parser.parseBoolean(rawAttributeData, spinner); if (value == false) return; spinner.addListener(new FocusListener() { @Override public void keyboardFocusChanged(FocusEvent event, Actor actor, boolean focused) { if (focused) { Gdx.app.postRunnable(new Runnable() { @Override public void run() { spinner.getTextField().selectAll(); } }); } } }); }