java.awt.Button.requestFocus()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(151)

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

Button.requestFocus介绍

暂无

代码示例

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

Button myBtn = (Button)findViewById(R.id.myButtonId);
myBtn.requestFocus();

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

Button mybtn2 = (Button) focusSearch(View.FOCUS_DOWN);
if (mybtn2 != null)
 mybtn2.requestFocus();

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

Button quick_start = (Button) findViewById(R.id.start);
 quick_start.setSelected(true);
 quick_start.requestFocus();

代码示例来源:origin: net.imagej/ij

public void paint(Graphics g) {
  super.paint(g);
   if (firstPaint) {
    yesB.requestFocus();
    firstPaint = false;
  }
}

代码示例来源:origin: sc.fiji/TrakEM2_

public void paint(Graphics g) {
    super.paint(g);
    if (firstPaint) {
      yesB.requestFocus();
      firstPaint = false;
    }
  }
}

代码示例来源:origin: imagej/ImageJA

public void paint(Graphics g) {
  super.paint(g);
   if (firstPaint) {
    yesB.requestFocus();
    firstPaint = false;
  }
}

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

final ScrollView s = (ScrollView)findViewById(R.id.ScrollView01);
s.post(new Runnable() {
    public void run() {
       EditText editText =(EditText) findViewById(R.id.yourEditText);
       (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
          .hideSoftInputFromWindow(editText.getWindowToken(), 0);

       Button button =(Button) findViewById(R.id.SaveProfileEditingButton);
       button.setFocusable(true);
       button.requestFocus();
   }
});

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

alertDialog.setOnShowListener(new DialogInterface.OnShowListener(){
   @Override
   public void onShow(DialogInterface dialog) {
     Button negative = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
     negative.setFocusable(true);
     negative.setFocusableInTouchMode(true);
     negative.requestFocus();
   }
 });
 alertDialog.show();

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

// Set the focus to the calculate button so the keyboard won't show up automatically 
Button calcButton = (Button)findViewById( R.id.ac_button_calculate );
calcButton.setFocusable( true );
calcButton.setFocusableInTouchMode( true ); 
calcButton.requestFocus();

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

alertDialog.setOnShowListener(new DialogInterface.OnShowListener(){
   @Override
   public void onShow(DialogInterface dialog) {
     Button positive= alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
     positive.setFocusable(true);
     positive.setFocusableInTouchMode(true);
     positive.requestFocus();
   }
 });

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

TextView v = ...;
final Button b = ...;
v.setOnClickListener(new OnClickListener() {
  @Override
  public void onClick(View v) {
    b.setFocusableInTouchMode(true);
    b.requestFocus();
    b.performClick();
  }
});

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

btn_map.setOnClickListener(new OnClickListener() {  
  public void onClick(View v) {
    btn_map.requestFocus();
    btn_map.setFocusable(true);
    SharedPreferences.Editor prefsEditor = prefs.edit();
btn_name.setOnClickListener(new OnClickListener() {  
  public void onClick(View v) {
    btn_name.requestFocus();
    btn_name.setFocusable(true);
    SharedPreferences.Editor prefsEditor = prefs.edit();

代码示例来源:origin: IanDarwin/javasrc

public void actionPerformed(ActionEvent e) {
    logout();
    loginButton.setEnabled(true);
    logoutButton.setEnabled(false);
    loginButton.requestFocus();
  }
});

代码示例来源:origin: IanDarwin/javasrc

loginButton.requestFocus();
loginButton.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {

代码示例来源:origin: org.nakedobjects/nos-viewer-dnd

public ShutdownDialog(final ViewerFrame owner) {
  super(owner, "Naked Objects", true);
  //AWTUtilities.addWindowIcon(this, "shutdown-logo.gif");
  setLayout(new GridLayout(2, 3, 10, 10));
  add(new Label("Exit Naked Objects?", Label.LEFT));
  add(new Panel());
  add(new Panel());
  add(new Panel());
  add(quit = new Button(QUIT_LABEL));
  quit.addActionListener(this);
  quit.addKeyListener(this);
  add(cancel = new Button(CANCEL_LABEL));
  cancel.addActionListener(this);
  cancel.addKeyListener(this);
  pack();
  int width = getSize().width; // getWidth();
  int height = getSize().height; // getHeight();
  Dimension screen = owner.getSize();
  Point point = owner.getLocation();
  int x = point.x + (screen.width / 2) - (width / 2);
  int y = point.y + (screen.height / 2) - (height / 2);
  setLocation(x, y);
  show();
  quit.requestFocus();
  addWindowListener(new WindowAdapter() {
    public void windowClosing(final WindowEvent e) {
      dispose();
    }
  });
}

代码示例来源:origin: org.nakedobjects.plugins/dndviewer

quit.requestFocus();

相关文章