com.kotcrab.vis.ui.FocusManager Java Examples
The following examples show how to use
com.kotcrab.vis.ui.FocusManager.
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: VisWindow.java From vis-ui with Apache License 2.0 | 6 votes |
/** * Fade outs this window, when fade out animation is completed, window is removed from Stage. Calling this for the * second time won't have any effect if previous animation is still running. */ public void fadeOut (float time) { if (fadeOutActionRunning) return; fadeOutActionRunning = true; final Touchable previousTouchable = getTouchable(); setTouchable(Touchable.disabled); Stage stage = getStage(); if (stage != null && stage.getKeyboardFocus() != null && stage.getKeyboardFocus().isDescendantOf(this)) { FocusManager.resetFocus(stage); } addAction(Actions.sequence(Actions.fadeOut(time, Interpolation.fade), new Action() { @Override public boolean act (float delta) { setTouchable(previousTouchable); remove(); getColor().a = 1f; fadeOutActionRunning = false; return true; } })); }
Example #2
Source File: VisCheckBox.java From vis-ui with Apache License 2.0 | 6 votes |
public VisCheckBox (String text, VisCheckBoxStyle style) { super(text, style); clearChildren(); bgImage = new Image(style.checkBackground); tickImage = new Image(style.tick); imageStackCell = add(imageStack = new Stack(bgImage, tickImage)); Label label = getLabel(); add(label).padLeft(5); label.setAlignment(Align.left); setSize(getPrefWidth(), getPrefHeight()); addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisCheckBox.this); return false; } }); }
Example #3
Source File: VisImageTextButton.java From vis-ui with Apache License 2.0 | 6 votes |
private void init (String text) { defaults().space(3); image = new Image(); image.setScaling(Scaling.fit); add(image); label = new Label(text, new LabelStyle(style.font, style.fontColor)); label.setAlignment(Align.center); add(label); setStyle(style); setSize(getPrefWidth(), getPrefHeight()); addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisImageTextButton.this); return false; } }); }
Example #4
Source File: VisImageButton.java From vis-ui with Apache License 2.0 | 6 votes |
private void init () { image = new Image(); image.setScaling(Scaling.fit); add(image); setSize(getPrefWidth(), getPrefHeight()); addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisImageButton.this); return false; } }); updateImage(); }
Example #5
Source File: PackDialogController.java From gdx-texture-packer-gui with Apache License 2.0 | 5 votes |
@Override public void onProcessingFinished() { btnClose.setDisabled(false); btnClose.setColor(Color.WHITE); FocusManager.switchFocus(stage, btnClose); window.closeOnEscape(); if (!errors && cbAutoClose.isChecked()) { window.hide(); showReopenLastDialogNotification(); } // If there is only one pack, show log on error if (errors && adapter.size() == 1) { adapter.getView(adapter.get(0)).showLogWindow(); } // Indicate total result by changing progress bar color { ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(progressBar.getStyle()); Drawable fill = errors ? VisUI.getSkin().getDrawable("progressBarErr") : VisUI.getSkin().getDrawable("progressBarSucc"); style.knob = fill; style.knobBefore = fill; progressBar.setStyle(style); } }
Example #6
Source File: VisTree.java From vis-ui with Apache License 2.0 | 5 votes |
private void init () { addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { Focusable focusable = FocusManager.getFocusedWidget(); if (focusable instanceof Actor == false || isAscendantOf((Actor) focusable) == false) { FocusManager.resetFocus(getStage()); } return false; } }); }
Example #7
Source File: VisList.java From vis-ui with Apache License 2.0 | 5 votes |
private void init () { addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { FocusManager.resetFocus(getStage()); return false; } }); }
Example #8
Source File: VisTextField.java From vis-ui with Apache License 2.0 | 5 votes |
@Override public void setDisabled (boolean disabled) { this.disabled = disabled; if (disabled) { FocusManager.resetFocus(getStage(), this); keyRepeatTask.cancel(); } }
Example #9
Source File: VisTextField.java From vis-ui with Apache License 2.0 | 5 votes |
/** Focuses this field, field must be added to stage before this method can be called */ public void focusField () { if (disabled) return; Stage stage = getStage(); FocusManager.switchFocus(stage, VisTextField.this); setCursorPosition(0); selectionStart = 0; //make sure textOffset was updated, prevent issue when there was long text selected and it was changed to short text //and field was focused. Without it textOffset would stay at max value and only one last letter will be visible in field calculateOffsets(); if (stage != null) stage.setKeyboardFocus(VisTextField.this); keyboard.show(true); hasSelection = true; }
Example #10
Source File: VisTextField.java From vis-ui with Apache License 2.0 | 5 votes |
@Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (!super.touchDown(event, x, y, pointer, button)) return false; if (pointer == 0 && button != 0) return false; if (disabled) return true; Stage stage = getStage(); FocusManager.switchFocus(stage, VisTextField.this); setCursorPosition(x, y); selectionStart = cursor; if (stage != null) stage.setKeyboardFocus(VisTextField.this); if (readOnly == false) keyboard.show(true); hasSelection = true; return true; }
Example #11
Source File: VisSelectBox.java From vis-ui with Apache License 2.0 | 5 votes |
private void init () { addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { FocusManager.resetFocus(getStage()); return false; } }); }
Example #12
Source File: VisTextButton.java From vis-ui with Apache License 2.0 | 5 votes |
private void init () { style = (VisTextButtonStyle) getStyle(); addListener(new InputListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { if (isDisabled() == false) FocusManager.switchFocus(getStage(), VisTextButton.this); return false; } }); }
Example #13
Source File: GlobalActions.java From gdx-texture-packer-gui with Apache License 2.0 | 4 votes |
@LmlAction("resetViewFocus") public void resetViewFocus() { FocusManager.resetFocus(getStage()); }
Example #14
Source File: VersionCheckDialogController.java From gdx-texture-packer-gui with Apache License 2.0 | 4 votes |
private void fillUpdateDetailsGroup(VersionData versionData) { lblVersionNew.setText(versionData.getVersion().toString()); FocusManager.switchFocus(btnVisitUpdatePage.getStage(), btnVisitUpdatePage); }
Example #15
Source File: VisImageTextButton.java From vis-ui with Apache License 2.0 | 4 votes |
@Override public void setDisabled (boolean disabled) { super.setDisabled(disabled); if (disabled) FocusManager.resetFocus(getStage(), this); }
Example #16
Source File: VisImageButton.java From vis-ui with Apache License 2.0 | 4 votes |
@Override public void setDisabled (boolean disabled) { super.setDisabled(disabled); if (disabled) FocusManager.resetFocus(getStage(), this); }