コード例 #1
0
  /** {@inheritDoc} */
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    if (value instanceof IBooleanPM == false) {
      return null;
    }
    model = (IBooleanPM) value;
    Boolean bvalue = false;
    if (model.getBoolean() != null) {
      bvalue = model.getBoolean();
    }
    cb.setSelected(bvalue);

    if (isNimbus()) { // one more work around
      if (rendererComponent != null) {
        rendererComponent.setBackground(null);
      }
      rendererComponent =
          (JComponent)
              defaultRenderer.getListCellRendererComponent(
                  list, "", index, isSelected, cellHasFocus);
      if (isSelected == false && index % 2 != 0) {
        rendererComponent.setBackground(Color.white);
      }
    } else {
      rendererComponent =
          (JComponent)
              defaultRenderer.getListCellRendererComponent(
                  list, "", index, isSelected, cellHasFocus);
    }

    return this;
  }
コード例 #2
0
 private boolean shouldPaintErrorIcon() {
   if (model == null) {
     return false;
   }
   return (model.isValid() == false);
 }