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