javax.swing.JCheckBox.getClientProperty()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(140)

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

JCheckBox.getClientProperty介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.mevenide/nb-project

public void actionPerformed(ActionEvent e) {
    if (cbDebug.isSelected()) {
      cbErrors.setEnabled(false);
      cbErrors.putClientProperty(CP_SELECTED, Boolean.valueOf(cbErrors.isSelected())); 
      cbErrors.setSelected(true);
    } else {
      cbErrors.setEnabled(true);
      cbErrors.setSelected(((Boolean)cbErrors.getClientProperty(CP_SELECTED)).booleanValue());
    }
  }
});

代码示例来源:origin: RPTools/maptool

public void stateChanged(ChangeEvent e) {
    JSlider js = (JSlider) ((JCheckBox) e.getSource()).getClientProperty("JSlider");
    js.setEnabled(!((JCheckBox) e.getSource()).isSelected());
  }
});

代码示例来源:origin: RPTools/maptool

public void stateChanged(ChangeEvent e) {
    JSlider js = (JSlider) ((JCheckBox) e.getSource()).getClientProperty("JSlider");
    js.setEnabled(!((JCheckBox) e.getSource()).isSelected());
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-inspect

/**
 * Updates the panel used to force pseudo-classes.
 * 
 * @param pageModel inspected page.
 * @param node inspected/selected node.
 */
private void updatePseudoClassPanel(WebKitPageModel pageModel,
    org.netbeans.modules.web.webkit.debugging.api.dom.Node node) {
  CSS.PseudoClass[] pseudoClasses = pageModel.getPseudoClasses(node);
  EnumSet<CSS.PseudoClass> set = EnumSet.noneOf(CSS.PseudoClass.class);
  set.addAll(Arrays.asList(pseudoClasses));
  for (JCheckBox checkbox : pseudoClassCheckBoxes) {
    CSS.PseudoClass pseudoClass = (CSS.PseudoClass)checkbox.getClientProperty(PSEUDO_CLASS);
    boolean selected = set.contains(pseudoClass);
    checkbox.setSelected(selected);
  }
}

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-base-swing

public void itemStateChanged(ItemEvent e)
  {
    boolean	active	= ((JRadioButton)e.getSource()).isSelected();
    for(int j=0; j<options.length; j++)
    {
      String    dependency    =(String)options[j].getClientProperty(PROPERTY_DEPENDENCY);
      options[j].setEnabled(active && (dependency==null || SReflect.classForName0(dependency, null)!=null));
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-editor-fold-nbui

private void fireChanged(String pk) {
  if (pk == null) {
    isChanged = false;
    return;
  }
  Preferences prefs = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
  boolean changed = preferences.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true) != prefs.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true)
      || preferences.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true) != prefs.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true)
      || preferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, true) != prefs.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_PREVIEW, true)
      || preferences.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, true) != prefs.getBoolean(FoldUtilitiesImpl.PREF_CONTENT_SUMMARY, true);
  for (JCheckBox cb : controls) {
    changed |= isFoldTypeChanged((FoldType) cb.getClientProperty("type"), prefs); // NOI18N
  }
  isChanged = changed;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-editor-fold-nbui

private void updateValueState() {
  ignoreStateChange = true;
  for (JCheckBox cb : controls) {
    FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N
    String k = COLLAPSE_PREFIX + ft.code();
    boolean val = isCollapseEnabled(ft);
    cb.setSelected(val);
  }
  ignoreStateChange = false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-editor-fold-nbui

private void updatePref(ItemEvent e) {
  JCheckBox cb = (JCheckBox)e.getSource();
  FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N
  
  String prefKey = COLLAPSE_PREFIX + ft.code();
  lastChangedCB = cb;
  LOG.log(Level.FINE, "Updating preference: " + prefKey + ", value = " + cb.isSelected()); // NOI18N
  preferences.putBoolean(prefKey, cb.isSelected());
  
  if (!"".equals(mimeType)) {
    return;
  }
  // legacy setting support in transient prefs:
  String propagate = FoldOptionsController.LEGACY_SETTINGS_MAP.get(ft.code());
  if (propagate != null) {
    prefKey = COLLAPSE_PREFIX + propagate;
    LOG.log(Level.FINE, "Updating LEGACY preference: " + prefKey + ", value = " + cb.isSelected()); // NOI18N
    preferences.putBoolean(prefKey, cb.isSelected());
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

public void update() {
  MakeOptions makeOptions = MakeOptions.getInstance();
  makeOptionsTextField.setText(makeOptions.getMakeOptions());
  filePathcomboBox.removeAllItems();
  for (MakeProjectOptions.PathMode pathMode : MakeProjectOptions.PathMode.values()) {
    filePathcomboBox.addItem(pathMode);
  }
  filePathcomboBox.setSelectedItem(makeOptions.getPathMode());
  for(JCheckBox cb : checkBoxes) {
    NamedOption entry = (NamedOption) cb.getClientProperty("MakeOptionNamedEntity"); //NOI18N
    cb.setSelected(NamedOption.getAccessor().getBoolean(entry.getName()));
  }
  changed = false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

/** Apply changes */
public void applyChanges() {
  MakeOptions makeOptions = MakeOptions.getInstance();
  makeOptions.setMakeOptions(makeOptionsTextField.getText());
  makeOptions.setPathMode((MakeProjectOptions.PathMode) filePathcomboBox.getSelectedItem());
  for(JCheckBox cb : checkBoxes) {
    NamedOption entry = (NamedOption) cb.getClientProperty("MakeOptionNamedEntity"); //NOI18N
    NamedOption.getAccessor().setBoolean(entry.getName(), cb.isSelected());
  }
  changed = false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private boolean areMakeOptionsChanged() {
  boolean isChanged = false;
  MakeOptions makeOptions = MakeOptions.getInstance();
  isChanged |= !makeOptions.getMakeOptions().equals(makeOptionsTextField.getText())
      || !makeOptions.getPathMode().equals((MakeProjectOptions.PathMode) filePathcomboBox.getSelectedItem());
  if (isChanged) { // no need to iterate further
    return true;
  }
  for (JCheckBox cb : checkBoxes) {
    NamedOption entry = (NamedOption) cb.getClientProperty("MakeOptionNamedEntity"); //NOI18N
    isChanged |= NamedOption.getAccessor().getBoolean(entry.getName()) != cb.isSelected();
    if (isChanged) { // no need to iterate further
      return true;
    }
  }
  return isChanged;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-editor-fold-nbui

private String updateCheckers(PreferenceChangeEvent evt) {
  String pk = evt.getKey();
  if (pk != null) {
    if (pk.equals(SimpleValueNames.CODE_FOLDING_ENABLE)) {
      updateEnabledState();
      return pk;
    }
    if (pk.equals(PREF_OVERRIDE_DEFAULTS)) {
      updateOverrideChanged();
    } else if (!pk.startsWith(COLLAPSE_PREFIX)) {
      return pk;
    }
  } else {
    updateEnabledState();
  }
  String c = pk == null ? null : pk.substring(COLLAPSE_PREFIX.length());
  for (JCheckBox cb : controls) {
    FoldType ft = (FoldType)cb.getClientProperty("type"); // NOI18N
    FoldType ftp = ft.parent();
    if (c == null || ft.code().equals(c) || (ftp != null && ftp.code().equals(c))) {
      updateChecker(pk, cb, ft);
      return pk;
    }
  }
  return pk;
}

代码示例来源:origin: google/sagetv

private boolean isEditableSolid(int i)
{
 switch (editables[i].type)
 {
  case EDIT_FILE:
  case EDIT_IMAGE_FILE:
  case EDIT_COLOR:
  case EDIT_FLOAT_RANGE:
  case EDIT_INT_RANGE:
   return ((EditableResult) editableComps[i]).isSolid();
  case EDIT_CHECK:
   return "true".equals(((javax.swing.JCheckBox) editableComps[i]).getClientProperty("solid"));
  case EDIT_CHOICE:
   return ((javax.swing.JComboBox) editableComps[i]).getBackground() == java.awt.Color.white;
  case EDIT_ENUM:
   return ((javax.swing.JComboBox) editableComps[i]).getBackground() == java.awt.Color.white;
  default:
   return ((javax.swing.JTextField) editableComps[i]).getBackground() == java.awt.Color.white;
 }
}
private String getEditableResult(int i)

代码示例来源:origin: google/sagetv

if (cb.getClientProperty("solid").equals("false"))
 g.setColor(java.awt.Color.lightGray);
else
if (cb.getClientProperty("solid").equals("false"))
 g.setColor(java.awt.Color.lightGray);
else

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

public void actionPerformed(ActionEvent e) {
    for (int i = 0; i < checkBoxPanel.getComponentCount(); i++) {
      JCheckBox cb = (JCheckBox) checkBoxPanel.getComponent(i);
      int index = (int) cb.getClientProperty("index");
      jobPanel.getJob().getBoardLocations().get(index).setEnabled(!cb.isSelected());
    }
    jobPanel.refresh();
    Helpers.selectFirstTableRow(jobPanel.getBoardLocationsTable());
    setVisible(false);
  }
}

相关文章

JCheckBox类方法