Exemple #1
0
 /**
  * Set Background based on editable / mandatory / error
  *
  * @param error if true, set background to error color, otherwise mandatory/editable
  */
 @Override
 public void setBackground(boolean error) {
   if (error) setBackground(AdempierePLAF.getFieldBackground_Error());
   else if (!isReadWrite()) setBackground(AdempierePLAF.getFieldBackground_Inactive());
   else if (isMandatory()) setBackground(AdempierePLAF.getFieldBackground_Mandatory());
   else setBackground(AdempierePLAF.getFieldBackground_Normal());
 } //  setBackground
 /**
  * Set Background based on editable / mandatory / error
  *
  * @param error if true, set background to error color, otherwise mandatory/editable
  */
 public void setBackground(boolean error) {
   Color c = null;
   if (error) c = AdempierePLAF.getFieldBackground_Error();
   else if (!m_rw) c = AdempierePLAF.getFieldBackground_Inactive();
   else if (m_mandatory) c = AdempierePLAF.getFieldBackground_Mandatory();
   else c = AdempierePLAF.getFieldBackground_Normal();
   setBackground(c);
 } //  setBackground
  /**
   * Return centered, white Check Box
   *
   * @param table
   * @param value
   * @param isSelected
   * @param hasFocus
   * @param row
   * @param col
   * @return Component
   */
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    //  Background & Foreground
    Color bg = AdempierePLAF.getFieldBackground_Normal();
    //  Selected is white on blue in Windows
    if (isSelected && !hasFocus) bg = table.getSelectionBackground();
    //  row not selected or field has focus
    else {
      //  Inactive Background
      if (!table.isCellEditable(row, col)) bg = AdempierePLAF.getFieldBackground_Inactive();
    }
    //  Set Color
    m_check.setBackground(bg);

    //  Value
    setValue(value);
    return m_check;
  } //	getTableCellRendererComponent