public void zDrawTextFieldIndicators ( ) { if ( ! isEnabled ( ) ) { // (Possibility: DisabledComponent) // Note: The time should always be validated (as if the component lost focus), before // the component is disabled. timeTextField . setBackground ( new Color ( 240 , 240 , 240 ) ) ; timeTextField . setForeground ( new Color ( 109 , 109 , 109 ) ) ; timeTextField . setFont ( settings . fontValidTime ) ; return ; } // Reset all atributes to normal before going further. // (Possibility: ValidFullOrEmptyValue) timeTextField . setBackground ( settings . getColor ( TimeArea . TextFieldBackgroundValidTime ) ) ; timeTextField . setForeground ( settings . getColor ( TimeArea . TimePickerTextValidTime ) ) ; timeTextField . setFont ( settings . fontValidTime ) ; // Get the text, and check to see if it is empty. String timeText = timeTextField . getText ( ) ; boolean textIsEmpty = timeText . trim ( ) . isEmpty ( ) ; // Handle the various possibilities. if ( textIsEmpty ) { if ( settings . getAllowEmptyTimes ( ) ) { // (Possibility: ValidFullOrEmptyValue) } else { // (Possibility: DisallowedEmptyValue) timeTextField . setBackground ( settings . getColor ( TimeArea . TextFieldBackgroundDisallowedEmptyTime ) ) ; } return ; } // The text is not empty. LocalTime parsedTime = InternalUtilities . getParsedTimeOrNull ( timeText , settings . getFormatForDisplayTime ( ) , settings . getFormatForMenuTimes ( ) , settings . formatsForParsing , settings . getLocale ( ) ) ; if ( parsedTime == null ) { // (Possibility: UnparsableValue) timeTextField . setBackground ( settings . getColor ( TimeArea . TextFieldBackgroundInvalidTime ) ) ; timeTextField . setForeground ( settings . getColor ( TimeArea . TimePickerTextInvalidTime ) ) ; timeTextField . setFont ( settings . fontInvalidTime ) ; return ; } // The text was parsed to a value. TimeVetoPolicy vetoPolicy = settings . getVetoPolicy ( ) ; boolean isTimeVetoed = InternalUtilities . isTimeVetoed ( vetoPolicy , parsedTime ) ; if ( isTimeVetoed ) { // (Possibility: VetoedValue) timeTextField . setBackground ( settings . getColor ( TimeArea . TextFieldBackgroundVetoedTime ) ) ; timeTextField . setForeground ( settings . getColor ( TimeArea . TimePickerTextVetoedTime ) ) ; timeTextField . setFont ( settings . fontVetoedTime ) ; } }
zDrawTextFieldIndicators This will draw the text field indicators to indicate to the user the state of any text in the text field including the validity of any time that has been typed . The text field indicators include the text field background color foreground color font color and font .