Java JLabel setResultRecordCountColour(JLabel label, boolean limitSet, Integer limitRecords, Integer ActualRecords)

Here you can find the source of setResultRecordCountColour(JLabel label, boolean limitSet, Integer limitRecords, Integer ActualRecords)

Description

set Result Record Count Colour

License

Open Source License

Declaration

public static void setResultRecordCountColour(JLabel label, boolean limitSet, Integer limitRecords,
            Integer ActualRecords) 

Method Source Code

//package com.java2s;
/**//w ww  .  j a v a  2s  . com
 * @author David Garratt
 * 
 * Project Name : Commander4j
 * 
 * Filename     : JUtility.java
 * 
 * Package Name : com.commander4j.util
 * 
 * License      : GNU General Public License
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * http://www.commander4j.com/website/license.html.
 * 
 */

import java.awt.Color;

import javax.swing.JLabel;

public class Main {
    public static void setResultRecordCountColour(JLabel label, boolean limitSet, Integer limitRecords,
            Integer ActualRecords) {
        String warning = "";

        if (ActualRecords > 0) {
            if (limitSet) {
                if (ActualRecords >= limitRecords) {
                    label.setForeground(Color.RED);
                    warning = " Number of records returned constrained by user defined limit.";
                } else {
                    label.setForeground(Color.BLACK);
                }
            } else {
                label.setForeground(Color.BLACK);
            }

            label.setText(String.valueOf(ActualRecords) + " record(s) retrieved." + warning);
        } else {
            label.setForeground(Color.BLACK);
            label.setText("0 records shown.");
        }
    }
}

Related

  1. setBoundsForJLabel(JLabel label, int xOffset, int yOffset)
  2. setErrorBackground(JLabel comp)
  3. setMnemonic(JLabel label, JComponent message, char mnemonic)
  4. setModelValue(JLabel lbl, String value)
  5. setNSLabel(JLabel nsLabel, String str)
  6. setStatusLabel(JLabel label)
  7. width(JLabel c)