src/windows/native/sun/windows/awt_Component.cpp

Print this page




 475 void
 476 AwtComponent::CreateHWnd(JNIEnv *env, LPCWSTR title,
 477                          DWORD windowStyle,
 478                          DWORD windowExStyle,
 479                          int x, int y, int w, int h,
 480                          HWND hWndParent, HMENU hMenu,
 481                          COLORREF colorForeground,
 482                          COLORREF colorBackground,
 483                          jobject peer)
 484 {
 485     if (env->EnsureLocalCapacity(2) < 0) {
 486         return;
 487     }
 488 
 489     /*
 490      * The window class of multifont label must be "BUTTON" because
 491      * "STATIC" class can't get WM_DRAWITEM message, and m_peerObject
 492      * member is referred in the GetClassName method of AwtLabel class.
 493      * So m_peerObject member must be set here.
 494      */

 495     m_peerObject = env->NewGlobalRef(peer);




 496     RegisterClass();
 497 
 498     jobject target = env->GetObjectField(peer, AwtObject::targetID);
 499     jboolean visible = env->GetBooleanField(target, AwtComponent::visibleID);
 500     m_visible = visible;
 501 
 502     if (visible) {
 503         windowStyle |= WS_VISIBLE;
 504     } else {
 505         windowStyle &= ~WS_VISIBLE;
 506     }
 507 
 508     InitPeerGraphicsConfig(env, peer);
 509 
 510     SetLastError(0);
 511     HWND hwnd = ::CreateWindowEx(windowExStyle,
 512                                  GetClassName(),
 513                                  title,
 514                                  windowStyle,
 515                                  x, y, w, h,




 475 void
 476 AwtComponent::CreateHWnd(JNIEnv *env, LPCWSTR title,
 477                          DWORD windowStyle,
 478                          DWORD windowExStyle,
 479                          int x, int y, int w, int h,
 480                          HWND hWndParent, HMENU hMenu,
 481                          COLORREF colorForeground,
 482                          COLORREF colorBackground,
 483                          jobject peer)
 484 {
 485     if (env->EnsureLocalCapacity(2) < 0) {
 486         return;
 487     }
 488 
 489     /*
 490      * The window class of multifont label must be "BUTTON" because
 491      * "STATIC" class can't get WM_DRAWITEM message, and m_peerObject
 492      * member is referred in the GetClassName method of AwtLabel class.
 493      * So m_peerObject member must be set here.
 494      */
 495         if (m_peerObject == NULL) {
 496             m_peerObject = env->NewGlobalRef(peer);
 497         }
 498 
 499         DASSERT (env->IsSameObject(m_peerObject, peer));
 500 
 501     RegisterClass();
 502 
 503     jobject target = env->GetObjectField(peer, AwtObject::targetID);
 504     jboolean visible = env->GetBooleanField(target, AwtComponent::visibleID);
 505     m_visible = visible;
 506 
 507     if (visible) {
 508         windowStyle |= WS_VISIBLE;
 509     } else {
 510         windowStyle &= ~WS_VISIBLE;
 511     }
 512 
 513     InitPeerGraphicsConfig(env, peer);
 514 
 515     SetLastError(0);
 516     HWND hwnd = ::CreateWindowEx(windowExStyle,
 517                                  GetClassName(),
 518                                  title,
 519                                  windowStyle,
 520                                  x, y, w, h,