com.google.gwt.user.client.ui.CheckBox.setChecked()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(134)

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

CheckBox.setChecked介绍

[英]Checks or unchecks this check box. Does not fire ValueChangeEvent. (If you want the event to fire, use #setValue(Boolean,boolean))
[中]选中或取消选中此复选框。不触发ValueChangeEvent。(如果希望触发事件,请使用#setValue(布尔值,布尔值))

代码示例

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

  1. @Override
  2. public View getView(int position, View convertView, ViewGroup parent){
  3. CheckBox favoriteBox =(CheckBox)result.findViewById(R.id.favorite_checkbox);
  4. favoriteBox.setChecked(true);
  5. favoriteBox.setEnabled(false);

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

  1. CheckBox cbx = (CheckBox)findViewById(R.id.cbx_china);
  2. cbx.setChecked(textToSearch == cbx.getText());
  3. cbx = (CheckBox)findViewById(R.id.cbx_canada);
  4. cbx.setChecked(textToSearch == cbx.getText());

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

  1. CheckBox checkBox = (CheckBox)getActivity().findViewById(R.id.my_checkbox);
  2. checkBox.setChecked(true); //Check the check box
  3. checkBox.setEnabled(false); //Disable the check box

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

  1. <CheckBox
  2. android:id="@+id/checkbox"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:text="Sample text"/>
  6. @Override
  7. public View getView(int position, View convertView, ViewGroup parent) {
  8. LayoutInflater inflater = (LayoutInflater) context
  9. .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  10. View rowView = inflater.inflate(R.layout.cell_view, parent, false);
  11. CheckBox checkBox = (CheckBox) rowView.findViewById(R.id.checkbox);
  12. checkBox.setText("MY TEXT GOES HERE");// Update Your text
  13. checkBox.setChecked(true);// Set checked/unchecked based on your functionality.
  14. return rowView;
  15. }

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

  1. public void bindView(View view, Context context, Cursor cursor) {
  2. CheckBox checkbox = (CheckBox)view.findViewById(R.id.completed);
  3. TextView due_date = (TextView)view.findViewById(R.id.due_date);
  4. String title = cursor.getString(cursor.getColumnIndex(Tasks.TITLE));
  5. boolean completed = Util.intToBool(cursor.getInt(cursor.getColumnIndex(Tasks.COMPLETED)));
  6. SimpleDateFormat format = new SimpleDateFormat("EEEEEE, MMM dd yyyy hh:mm aa");
  7. long unixTime = cursor.getLong(cursor.getColumnIndex(Tasks.DUE_DATE));
  8. Calendar due = Util.timestampToDate(unixTime);
  9. due_date.setText(format.format(due.getTime()));
  10. checkbox.setText(title);
  11. checkbox.setChecked(completed);
  12. // edit here ..
  13. checkbox.setOnCheckedChangeListener(
  14. new CompoundButton.OnCheckedChangeListener() {
  15. public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
  16. // update your value in the db
  17. });

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

  1. @Override
  2. public boolean setViewValue(View view, Object arg1, String arg2) {
  3. if (view.getId() == R.id.isDelete) {
  4. CheckBox cb = (CheckBox) view;
  5. cb.setText(arg2);
  6. String data = (String) arg1;
  7. if (toBlacklistNumbers.contains(data)) {
  8. cb.setChecked(true);
  9. } else {
  10. cb.setChecked(false);
  11. }
  12. cb.setOnCheckedChangeListener(mListener);
  13. return true;
  14. } else {
  15. return false;
  16. }
  17. }

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

  1. private void markAllTags()//this will put a check mark on the ones that are already a tag of that question
  2. {
  3. String tags[] = mUserDb.fetchTagById(mQid);//These are the tags that are already associated with this question
  4. for(int i = 0; i < this.getListAdapter().getCount(); i++)
  5. {
  6. View v = mListView.getChildAt(i);
  7. //View v = this.getListAdapter().getView(i, null, null);
  8. //Log.w("NME", "I = " + this.getListAdapter().getView(i, null, null).findViewById(R.id.checkBox1));
  9. Log.w("NME", "checking to see if V != null");
  10. if(v != null)
  11. {
  12. Log.w("NME", "V != null");
  13. CheckBox cb = (CheckBox)v.findViewById(R.id.checkBox1);
  14. String cbTags = "" + cb.getText();
  15. for(int j = 0; j < tags.length; j++)
  16. {
  17. //Log.w("NME", "cbTag = " + cbTags + " tags[j] = " + tags[j]);
  18. if(cbTags.equals(tags[j]))
  19. {
  20. cb.setChecked(true);
  21. }
  22. }//end for
  23. }//end if null
  24. }//end for
  25. }//end

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

  1. CheckBox cb=(CheckBox)findViewById(R.id.checkbox1);
  2. TextView tv=(TextView)findViewById(R.id.textview1);
  3. cb.setOnClickListener(new OnClickListener() {
  4. @Override
  5. public void onClick(View v) {
  6. // TODO Auto-generated method stub
  7. if(cb.isChecked()){
  8. cb.setChecked(true);
  9. tv.setText(cb.getText().toString());
  10. }
  11. }
  12. });

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

  1. cbFocusArea.setText(focusArea.getFocusAreaCodeDescription());
  2. if(focusArea.isFocusAreaCodeChecked() == 1) {
  3. cbFocusArea.setChecked(true);
  4. } else {
  5. cbFocusArea.setChecked(false);

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

  1. CheckBox cbx = (CheckBox)findViewById(R.id.cbx_china);
  2. if (textToSearch == cbx.getText())
  3. cbx.setChecked(!cbx.isChecked());

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

  1. .show();
  2. male.setEnabled(false); // disable checkbox
  3. male.setChecked(true);

代码示例来源:origin: com.blackducksoftware.tools/common-framework

  1. /**
  2. * Builds the remember me check box.
  3. *
  4. * @return the check box
  5. */
  6. @SuppressWarnings("deprecation")
  7. private CheckBox buildRememberMeCheckBox() {
  8. CheckBox rememberMeCheckBox = new CheckBox("Remember me please!");
  9. rememberMeCheckBox.setStyleName("gwt-Login-RememberMe");
  10. rememberMeCheckBox.setChecked(true);
  11. rememberMeCheckBox.setSize("157px", "20px");
  12. return rememberMeCheckBox;
  13. }

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

  1. TableLayout l = (TableLayout) findViewById(ID_OF_YOUR_LAYOUT);
  2. CheckBox box = new CheckBox(this);
  3. box.setChecked(true);
  4. box.setOnCheckedChangeListener(new OnCheckedChangeListener(){
  5. public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
  6. //what happens when the it's unchecked or checked
  7. }
  8. });
  9. l.addView(box);

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

  1. CheckBox cb = new CheckBox(mActivity);
  2. cb.setText("Hi");
  3. cb.setButtonDrawable(R.drawable.check_box_selector);
  4. cb.setChecked(true);
  5. cb.setPadding(cb.getPaddingLeft(), padding, padding, padding);

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

  1. box.setChecked(false);

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

  1. chkPresencia.setChecked(ValorChk==-1);
  2. chkPresencia.setWidth(50);
  3. row.addView(chkPresencia, new TableRow.LayoutParams(4));
  4. chkPrecioPromo.setChecked(ValorChk==-1);
  5. chkPrecioPromo.setWidth(50);
  6. row.addView(chkPrecioPromo, new TableRow.LayoutParams(4));
  7. chkAlerta.setChecked(ValorChk==-1);
  8. chkAlerta.setWidth(50);
  9. row.addView(chkAlerta, new TableRow.LayoutParams(4));

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

  1. int i;
  2. for (i = 0; i < 20; i++) {
  3. CheckBox ch = new CheckBox(this);
  4. ch.setTag(Integer.valueOf(i));
  5. ch.setText("CheckBox " + i);
  6. ch.setChecked(false);
  7. ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
  8. @Override
  9. public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  10. if (isChecked) {
  11. numChecked++;
  12. } else {
  13. numChecked--;
  14. }
  15. if (numChecked == 4) {
  16. buttonView.setChecked(false);
  17. numChecked--;
  18. // fourth one selected, show your dialog
  19. }
  20. }
  21. });
  22. }

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

  1. int i;
  2. int count = 0;
  3. for (i = 0; i < 10; i++) {
  4. CheckBox cb = new CheckBox(this);
  5. cb.setTag(Integer.valueOf(i));
  6. cb.setText("CheckBox " + i);
  7. cb.setChecked(false);
  8. cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
  9. @Override
  10. public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  11. Log.e("isChecked",""+isChecked);
  12. if (isChecked) {
  13. count++;
  14. } else {
  15. count--;
  16. }
  17. if (count > 1) {
  18. buttonView.setChecked(false);
  19. count--;
  20. }
  21. }
  22. });
  23. }

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

  1. cb.setTextColor(Color.BLACK);
  2. if (listitems.get(n).get("state").toString().equals("true")) {
  3. cb.setChecked(true);
  4. my_checked_layout.addView(cb);
  5. cb.setBackgroundColor(Color.argb(200, 8, 242, 2));
  6. checkstate = true;
  7. } else {
  8. cb.setChecked(false);
  9. cb.setBackgroundColor(Color.argb(100, 5, 214, 0));
  10. cb.setTextColor(Color.parseColor("#F7F7F7"));

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

  1. final CheckBox other=holder.inversion;
  2. convertView.setTag(holder);
  3. holder.inversion.setEnabled(false);
  4. // set checkchanged listener to your first checkbox
  5. holder.key.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  6. @Override
  7. public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  8. if(isChecked){
  9. //enable if the first checkbox is checked/ticked
  10. other.setEnabled(true);
  11. }
  12. }
  13. });
  14. holder.key.setOnClickListener(new View.OnClickListener() {
  15. public void onClick(View v) {
  16. CheckBox cb = (CheckBox) v;
  17. DiatonicMajorKey _key = (DiatonicMajorKey) cb.getTag();
  18. _key.setKeySelected(cb.isChecked());
  19. // handle of inversion checkbox to enable/disable it
  20. other.setEnabled(cb.isChecked());
  21. other.setChecked(false);
  22. }
  23. });

相关文章