com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked()方法的一些代码示例,展示了Button.setChecked()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setChecked()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Button
类名称:Button
方法名:setChecked

Button.setChecked介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

/** Toggles the checked state. This method changes the checked state, which fires a {@link ChangeEvent} (if programmatic change
 * events are enabled), so can be used to simulate a button click. */
public void toggle () {
  setChecked(!isChecked);
}

代码示例来源:origin: libgdx/libgdx

/** Toggles the checked state. This method changes the checked state, which fires a {@link ChangeEvent} (if programmatic change
 * events are enabled), so can be used to simulate a button click. */
public void toggle () {
  setChecked(!isChecked);
}

代码示例来源:origin: libgdx/libgdx

public void setChecked (boolean isChecked) {
  setChecked(isChecked, programmaticChangeEvents);
}

代码示例来源:origin: libgdx/libgdx

public void setChecked (boolean isChecked) {
  setChecked(isChecked, programmaticChangeEvents);
}

代码示例来源:origin: libgdx/libgdx

public void add (T button) {
  if (button == null) throw new IllegalArgumentException("button cannot be null.");
  button.buttonGroup = null;
  boolean shouldCheck = button.isChecked() || buttons.size < minCheckCount;
  button.setChecked(false);
  button.buttonGroup = this;
  buttons.add(button);
  button.setChecked(shouldCheck);
}

代码示例来源:origin: libgdx/libgdx

public void clicked (InputEvent event, float x, float y) {
    if (isDisabled()) return;
    setChecked(!isChecked, true);
  }
});

代码示例来源:origin: libgdx/libgdx

public void clicked (InputEvent event, float x, float y) {
    if (isDisabled()) return;
    setChecked(!isChecked, true);
  }
});

代码示例来源:origin: libgdx/libgdx

/** Sets all buttons' {@link Button#isChecked()} to false, regardless of {@link #setMinCheckCount(int)}. */
public void uncheckAll () {
  int old = minCheckCount;
  minCheckCount = 0;
  for (int i = 0, n = buttons.size; i < n; i++) {
    T button = buttons.get(i);
    button.setChecked(false);
  }
  minCheckCount = old;
}

代码示例来源:origin: libgdx/libgdx

/** Sets all buttons' {@link Button#isChecked()} to false, regardless of {@link #setMinCheckCount(int)}. */
public void uncheckAll () {
  int old = minCheckCount;
  minCheckCount = 0;
  for (int i = 0, n = buttons.size; i < n; i++) {
    T button = buttons.get(i);
    button.setChecked(false);
  }
  minCheckCount = old;
}

代码示例来源:origin: libgdx/libgdx

public void add (T button) {
  if (button == null) throw new IllegalArgumentException("button cannot be null.");
  button.buttonGroup = null;
  boolean shouldCheck = button.isChecked() || buttons.size < minCheckCount;
  button.setChecked(false);
  button.buttonGroup = this;
  buttons.add(button);
  button.setChecked(shouldCheck);
}

代码示例来源:origin: libgdx/libgdx

/** Sets the first {@link TextButton} with the specified text to checked. */
public void setChecked (String text) {
  if (text == null) throw new IllegalArgumentException("text cannot be null.");
  for (int i = 0, n = buttons.size; i < n; i++) {
    T button = buttons.get(i);
    if (button instanceof TextButton && text.contentEquals(((TextButton)button).getText())) {
      button.setChecked(true);
      return;
    }
  }
}

代码示例来源:origin: libgdx/libgdx

/** Sets the first {@link TextButton} with the specified text to checked. */
public void setChecked (String text) {
  if (text == null) throw new IllegalArgumentException("text cannot be null.");
  for (int i = 0, n = buttons.size; i < n; i++) {
    T button = buttons.get(i);
    if (button instanceof TextButton && text.contentEquals(((TextButton)button).getText())) {
      button.setChecked(true);
      return;
    }
  }
}

代码示例来源:origin: libgdx/libgdx

/** Called when a button is checked or unchecked. If overridden, generally changing button checked states should not be done
 * from within this method.
 * @return True if the new state should be allowed. */
protected boolean canCheck (T button, boolean newState) {
  if (button.isChecked == newState) return false;
  if (!newState) {
    // Keep button checked to enforce minCheckCount.
    if (checkedButtons.size <= minCheckCount) return false;
    checkedButtons.removeValue(button, true);
  } else {
    // Keep button unchecked to enforce maxCheckCount.
    if (maxCheckCount != -1 && checkedButtons.size >= maxCheckCount) {
      if (uncheckLast) {
        int old = minCheckCount;
        minCheckCount = 0;
        lastChecked.setChecked(false);
        minCheckCount = old;
      } else
        return false;
    }
    checkedButtons.add(button);
    lastChecked = button;
  }
  return true;
}

代码示例来源:origin: libgdx/libgdx

/** Called when a button is checked or unchecked. If overridden, generally changing button checked states should not be done
 * from within this method.
 * @return True if the new state should be allowed. */
protected boolean canCheck (T button, boolean newState) {
  if (button.isChecked == newState) return false;
  if (!newState) {
    // Keep button checked to enforce minCheckCount.
    if (checkedButtons.size <= minCheckCount) return false;
    checkedButtons.removeValue(button, true);
  } else {
    // Keep button unchecked to enforce maxCheckCount.
    if (maxCheckCount != -1 && checkedButtons.size >= maxCheckCount) {
      if (uncheckLast) {
        int old = minCheckCount;
        minCheckCount = 0;
        lastChecked.setChecked(false);
        minCheckCount = old;
      } else
        return false;
    }
    checkedButtons.add(button);
    lastChecked = button;
  }
  return true;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** Toggles the checked state. This method changes the checked state, which fires a {@link ChangeEvent} (if programmatic change
 * events are enabled), so can be used to simulate a button click. */
public void toggle () {
  setChecked(!isChecked);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** Sets all buttons' {@link Button#isChecked()} to false, regardless of {@link #setMinCheckCount(int)}. */
public void uncheckAll () {
  int old = minCheckCount;
  minCheckCount = 0;
  for (int i = 0, n = buttons.size; i < n; i++) {
    T button = buttons.get(i);
    button.setChecked(false);
  }
  minCheckCount = old;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public void add (T button) {
  if (button == null) throw new IllegalArgumentException("button cannot be null.");
  button.buttonGroup = null;
  boolean shouldCheck = button.isChecked() || buttons.size < minCheckCount;
  button.setChecked(false);
  button.buttonGroup = this;
  buttons.add(button);
  button.setChecked(shouldCheck);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public void clicked (InputEvent event, float x, float y) {
    if (isDisabled()) return;
    setChecked(!isChecked, true);
  }
});

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** Sets the first {@link TextButton} with the specified text to checked. */
public void setChecked (String text) {
  if (text == null) throw new IllegalArgumentException("text cannot be null.");
  for (int i = 0, n = buttons.size; i < n; i++) {
    T button = buttons.get(i);
    if (button instanceof TextButton && text.contentEquals(((TextButton)button).getText())) {
      button.setChecked(true);
      return;
    }
  }
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

public void setTab(int i) {		
  Actor panel = tabs.get(i).content;
  tabs.get(i).button.setChecked(true);
  body.setActor(null);
  body.clear();
  body.setActor(panel);
}

相关文章