< prev index next >

jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp

Print this page




 266     jobject self = secs->textfield;
 267     jchar echo = secs->echoChar;
 268 
 269     AwtTextField *c = NULL;
 270 
 271     PDATA pData;
 272     JNI_CHECK_PEER_GOTO(self, ret);
 273     c = (AwtTextField *)pData;
 274     if (::IsWindow(c->GetHWnd()))
 275     {
 276         c->SendMessage(EM_SETPASSWORDCHAR, echo);
 277         // Fix for 4307281: force redraw so that changes will take effect
 278         VERIFY(::InvalidateRect(c->GetHWnd(), NULL, FALSE));
 279     }
 280 ret:
 281     env->DeleteGlobalRef(self);
 282 
 283     delete secs;
 284 }
 285 
































 286 
 287 /************************************************************************
 288  * WTextFieldPeer native methods
 289  */
 290 
 291 extern "C" {
 292 
 293 /*
 294  * Class:     sun_awt_windows_WTextFieldPeer
 295  * Method:    create
 296  * Signature: (Lsun/awt/windows/WComponentPeer;)V
 297  */
 298 JNIEXPORT void JNICALL
 299 Java_sun_awt_windows_WTextFieldPeer_create(JNIEnv *env, jobject self,
 300                                            jobject parent)
 301 {
 302     TRY;
 303 
 304     PDATA pData;
 305     JNI_CHECK_PEER_RETURN(parent);




 266     jobject self = secs->textfield;
 267     jchar echo = secs->echoChar;
 268 
 269     AwtTextField *c = NULL;
 270 
 271     PDATA pData;
 272     JNI_CHECK_PEER_GOTO(self, ret);
 273     c = (AwtTextField *)pData;
 274     if (::IsWindow(c->GetHWnd()))
 275     {
 276         c->SendMessage(EM_SETPASSWORDCHAR, echo);
 277         // Fix for 4307281: force redraw so that changes will take effect
 278         VERIFY(::InvalidateRect(c->GetHWnd(), NULL, FALSE));
 279     }
 280 ret:
 281     env->DeleteGlobalRef(self);
 282 
 283     delete secs;
 284 }
 285 
 286 /*
 287 Remove any LF, CRLF i.e. EOL characters from pStr
 288 */
 289 int AwtTextField::RemoveEOL(WCHAR *pStr)
 290 {
 291     int i, nLen = 0;
 292     if (pStr) {
 293         /* check to see if there are any LF's */
 294         if (wcschr(pStr, L'\n') == NULL) {
 295             return static_cast<int>(wcslen(pStr));
 296         }
 297 
 298         for (i = 0; pStr[i] != 0; i++) {
 299             if (m_isLFonly == TRUE) {
 300                 if (pStr[i] == L'\n') {
 301                     pStr[nLen++] = ' ';
 302                     continue;
 303                 }
 304             }
 305             else {
 306                 if (pStr[i] == L'\r' && pStr[i + 1] == L'\n') {
 307                     pStr[nLen++] = ' ';
 308                     ++i;
 309                     continue;
 310                 }
 311             }
 312             pStr[nLen++] = pStr[i];
 313         }
 314         pStr[nLen] = 0;
 315     }
 316     return nLen;
 317 }
 318 
 319 /************************************************************************
 320  * WTextFieldPeer native methods
 321  */
 322 
 323 extern "C" {
 324 
 325 /*
 326  * Class:     sun_awt_windows_WTextFieldPeer
 327  * Method:    create
 328  * Signature: (Lsun/awt/windows/WComponentPeer;)V
 329  */
 330 JNIEXPORT void JNICALL
 331 Java_sun_awt_windows_WTextFieldPeer_create(JNIEnv *env, jobject self,
 332                                            jobject parent)
 333 {
 334     TRY;
 335 
 336     PDATA pData;
 337     JNI_CHECK_PEER_RETURN(parent);


< prev index next >