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

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

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

Button.isPressed介绍

暂无

代码示例

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

public void setStyle (ButtonStyle style) {
  if (style == null) throw new IllegalArgumentException("style cannot be null.");
  this.style = style;
  Drawable background = null;
  if (isPressed() && !isDisabled())
    background = style.down == null ? style.up : style.down;
  else {
    if (isDisabled() && style.disabled != null)
      background = style.disabled;
    else if (isChecked && style.checked != null) {
      if (isOver() && style.checkedOver != null)
        background = style.checkedOver;
      else if (focused && style.checkedFocused != null)
        background = style.checkedFocused;
      else
        background = style.checked;
    } else if (isOver() && style.over != null)
      background = style.over;
    else if (focused && style.focused != null)
      background = style.focused;
    else
      background = style.up;
  }
  setBackground(background);
}

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

public void setStyle (ButtonStyle style) {
  if (style == null) throw new IllegalArgumentException("style cannot be null.");
  this.style = style;
  Drawable background = null;
  if (isPressed() && !isDisabled())
    background = style.down == null ? style.up : style.down;
  else {
    if (isDisabled() && style.disabled != null)
      background = style.disabled;
    else if (isChecked && style.checked != null) {
      if (isOver() && style.checkedOver != null)
        background = style.checkedOver;
      else if (focused && style.checkedFocused != null)
        background = style.checkedFocused;
      else
        background = style.checked;
    } else if (isOver() && style.over != null)
      background = style.over;
    else if (focused && style.focused != null)
      background = style.focused;
    else
      background = style.up;
  }
  setBackground(background);
}

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

boolean isPressed = isPressed();
boolean isChecked = isChecked();
boolean isOver = isOver();

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

boolean isPressed = isPressed();
boolean isChecked = isChecked();
boolean isOver = isOver();

代码示例来源:origin: stackoverflow.com

//your array
String[n] array;

//your button
Button b;

///your edittext
EditText e;

if(b.isPressed())
array[x]=edit.getText().toString();

代码示例来源:origin: stackoverflow.com

private static final String SEARCH_URL = "http://interneturl.de/search?page=search&page_action=query&desc=on&sdesc=on&keywords=";

public void performSearch(View view) {
  EditText editText = (EditText)findViewById(R.id.searchEditText);
  Button button = (Button)findViewById(R.id.ButtonSearch);
  String search = editText.getText().toString();
  if(button.isPressed()) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(SEARCH_URL + search), this, MainActivity.class));
  }
}

代码示例来源:origin: stackoverflow.com

ArrayList<String> n= new ArrayList<String>();

//your button
Button b;

///your edittext
EditText e;

if(b.isPressed())
n.add(edit.getText().toString());

代码示例来源:origin: stackoverflow.com

void pressButton(Button btn, boolean pressed) {
  if (pressed != btn.isPressed()) {
    btn.performClick();
  }
}

代码示例来源:origin: stackoverflow.com

final Button yourButton = (Button) view.findViewById(R.id.your_button);
long timerInterval = 1000; //one second
yourButton.setOnClickListener(new OnClickListener() {
  @Override
  public void onClick(View v) {
    final Timer t = new Timer();
    t.scheduleAtFixedRate(new TimerTask() {
      public void run() {
        if (yourButton.isPressed()) {
          // do something (executing your code on button being pressed)
        } else {
          t.cancel();
        }
      }
    }, 0, timerInterval);
  }
});

代码示例来源:origin: stackoverflow.com

private Button rightButton; // You will assign this in onCreate() method
private Handler mHandler = new Handler();
private Runnable mRunnable = new Runnable() {
  @Override
  public void run() {
    if(rightButton.isPressed())
    {
      // If press state is pressed, move your item and recall the runnable in 100 milliseconds.
      mover.updateCoordinates(1,  0);
      mHandler.postDelayed(mRunnable, 100);
    }
  }
};

代码示例来源:origin: stackoverflow.com

public void update(GameContainer container, StateBasedGame game, int delta) {
button.update(container);
if (button.isPressed()) {
  System.out.println("Works");

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

public void setStyle (ButtonStyle style) {
  if (style == null) throw new IllegalArgumentException("style cannot be null.");
  this.style = style;
  Drawable background = null;
  if (isPressed() && !isDisabled())
    background = style.down == null ? style.up : style.down;
  else {
    if (isDisabled() && style.disabled != null)
      background = style.disabled;
    else if (isChecked && style.checked != null) {
      if (isOver() && style.checkedOver != null)
        background = style.checkedOver;
      else if (focused && style.checkedFocused != null)
        background = style.checkedFocused;
      else
        background = style.checked;
    } else if (isOver() && style.over != null)
      background = style.over;
    else if (focused && style.focused != null)
      background = style.focused;
    else
      background = style.up;
  }
  setBackground(background);
}

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

boolean isPressed = isPressed();
boolean isChecked = isChecked();
boolean isOver = isOver();

相关文章