protected int drawUnselectedText(Graphics g,int x,int y,int p0,int p1) throws BadLocationException {
  Container c=getContainer();
  if (c instanceof JPasswordField) {
    JPasswordField f=(JPasswordField)c;
    if (!f.echoCharIsSet()) {
      return super.drawUnselectedText(g,x,y,p0,p1);
    }
    if (f.isEnabled()) {
      g.setColor(f.getForeground());
    }
 else {
      g.setColor(f.getDisabledTextColor());
    }
    char echoChar=f.getEchoChar();
    int n=p1 - p0;
    for (int i=0; i < n; i++) {
      x=drawEchoCharacter(g,x,y,echoChar);
    }
  }
  return x;
}

protected int drawUnselectedText ( Graphics g , int x , int y , int p0 , int p1 ) throws BadLocationException { Container c = getContainer ( ) ; if ( c instanceof JPasswordField ) { JPasswordField f = ( JPasswordField ) c ; if ( ! f . echoCharIsSet ( ) ) { return super . drawUnselectedText ( g , x , y , p0 , p1 ) ; } if ( f . isEnabled ( ) ) { g . setColor ( f . getForeground ( ) ) ; } else { g . setColor ( f . getDisabledTextColor ( ) ) ; } char echoChar = f . getEchoChar ( ) ; int n = p1 - p0 ; for ( int i = 0 ; i < n ; i ++ ) { x = drawEchoCharacter ( g , x , y , echoChar ) ; } } return x ; }
renders the given range in the model as normal unselected text . this sets the foreground color and echos the characters using the value returned by getechochar ( ) .
