My MASKFORMAT is "##:00" which allow rounded hours but can I include that ## can only contain [0-23]?
what would that code look like?

private PropertyChangeSupport propertySupport;
    public static final String PROP_TICKING_PROPERTY = "clock is active";
   //public static final String MASKFORMAT = "##/##/#### ##:##:## UM";
    public static final String MASKFORMAT = "##:00";
    //public static final String SIMPLEDATEFORMATMASK = "yyyy-MM-dd HH:mm:ss a";
    public static final String SIMPLEDATEFORMATMASK = "H:mm";
    private SimpleDateFormat sdf = new SimpleDateFormat(SIMPLEDATEFORMATMASK);
    private static final int TIMERINTERVAL = 1000000000;
    private Timer timer = new Timer(TIMERINTERVAL, this);
    private boolean ticking = true;

Is there someone that can decipher this?

private static final String EMAILPATTERN = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";

can I use something similar to just allow [0-23]?

or better yet can someone decipher this one ?

private static final String TIME_PATTERN_24_HOUR = "(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])";

That is too much . I would have to set a pattern and figue out how to use
the defaultformatter etc.
I just validate the range on submit. thanks.

try {
            ////////////// are the hour fields valid?
            int sub = Integer.parseInt(txtFieldArray[startTimeAvailableIndex].getText().substring(0, 2));
            System.out.println(C + M + AND + sub + ":sub : \n");
            if (sub > 23) {
                cancelUpdate();
                txtFieldArray[startTimeAvailableIndex].setText("");
                bValid = false;
                throw new model.err.InvalidHourValueException();
            }
            sub = Integer.parseInt(txtFieldArray[endTimeAvailableIndex].getText().substring(0, 2));
            if (sub > 23) {
                cancelUpdate();
                txtFieldArray[endTimeAvailableIndex].setText("");
                bValid = false;
                throw new model.err.InvalidHourValueException();
            }
        } catch (InvalidHourValueException ex) {
            String x = ex.getMessage();
            System.out.println("Error: " + x);
            ViewUtils vu = new ViewUtils();
            vu.addExceptionMessage(x);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.