63 }
64
65 /* Create a new AwtLabel object and window. */
66 AwtLabel* AwtLabel::Create(jobject labelPeer, jobject parent)
67 {
68 JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
69
70 jobject target = NULL;
71 AwtLabel* awtLabel = NULL;
72
73 try {
74 if (env->EnsureLocalCapacity(1) < 0) {
75 return NULL;
76 }
77
78 PDATA pData;
79 AwtCanvas* awtParent;
80
81 JNI_CHECK_PEER_GOTO(parent, done);
82 awtParent = (AwtCanvas*)pData;
83 JNI_CHECK_NULL_GOTO(awtParent, "awtParent", done);
84 target = env->GetObjectField(labelPeer, AwtObject::targetID);
85 JNI_CHECK_NULL_GOTO(target, "target", done);
86
87 awtLabel = new AwtLabel();
88
89 {
90 DWORD style = WS_CHILD | WS_CLIPSIBLINGS;
91
92 DWORD exStyle = 0;
93 if (GetRTLReadingOrder())
94 exStyle |= WS_EX_RTLREADING;
95
96 jint x = env->GetIntField(target, AwtComponent::xID);
97 jint y = env->GetIntField(target, AwtComponent::yID);
98 jint width = env->GetIntField(target, AwtComponent::widthID);
99 jint height = env->GetIntField(target, AwtComponent::heightID);
100 awtLabel->CreateHWnd(env, L"", style, exStyle,
101 x, y, width, height,
102 awtParent->GetHWnd(),
103 NULL,
375 sas->label = env->NewGlobalRef(self);
376 sas->alignment = alignment;
377
378 AwtToolkit::GetInstance().SyncCall(AwtLabel::_SetAlignment, sas);
379 // global ref and sas are deleted in _SetAlignment
380
381 CATCH_BAD_ALLOC;
382 }
383
384 /*
385 * Class: sun_awt_windows_WLabelPeer
386 * Method: create
387 * Signature: (Lsun/awt/windows/WComponentPeer;)V
388 */
389 JNIEXPORT void JNICALL
390 Java_sun_awt_windows_WLabelPeer_create(JNIEnv *env, jobject self,
391 jobject parent)
392 {
393 TRY;
394
395 PDATA pData;
396 JNI_CHECK_PEER_RETURN(parent);
397 AwtToolkit::CreateComponent(self, parent,
398 (AwtToolkit::ComponentFactory)
399 AwtLabel::Create);
400 JNI_CHECK_PEER_CREATION_RETURN(self);
401
402 CATCH_BAD_ALLOC;
403 }
404
405 /*
406 * Class: sun_awt_windows_WLabelPeer
407 * Method: lazyPaint
408 * Signature: ()V
409 */
410 JNIEXPORT void JNICALL
411 Java_sun_awt_windows_WLabelPeer_lazyPaint(JNIEnv *env, jobject self)
412 {
413 TRY;
414
415 jobject selfGlobalRef = env->NewGlobalRef(self);
416
417 AwtToolkit::GetInstance().SyncCall(AwtLabel::_LazyPaint, (void *)selfGlobalRef);
418 // selfGlobalRef is deleted in _LazyPaint
419
420 CATCH_BAD_ALLOC;
|
63 }
64
65 /* Create a new AwtLabel object and window. */
66 AwtLabel* AwtLabel::Create(jobject labelPeer, jobject parent)
67 {
68 JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
69
70 jobject target = NULL;
71 AwtLabel* awtLabel = NULL;
72
73 try {
74 if (env->EnsureLocalCapacity(1) < 0) {
75 return NULL;
76 }
77
78 PDATA pData;
79 AwtCanvas* awtParent;
80
81 JNI_CHECK_PEER_GOTO(parent, done);
82 awtParent = (AwtCanvas*)pData;
83
84 target = env->GetObjectField(labelPeer, AwtObject::targetID);
85 JNI_CHECK_NULL_GOTO(target, "target", done);
86
87 awtLabel = new AwtLabel();
88
89 {
90 DWORD style = WS_CHILD | WS_CLIPSIBLINGS;
91
92 DWORD exStyle = 0;
93 if (GetRTLReadingOrder())
94 exStyle |= WS_EX_RTLREADING;
95
96 jint x = env->GetIntField(target, AwtComponent::xID);
97 jint y = env->GetIntField(target, AwtComponent::yID);
98 jint width = env->GetIntField(target, AwtComponent::widthID);
99 jint height = env->GetIntField(target, AwtComponent::heightID);
100 awtLabel->CreateHWnd(env, L"", style, exStyle,
101 x, y, width, height,
102 awtParent->GetHWnd(),
103 NULL,
375 sas->label = env->NewGlobalRef(self);
376 sas->alignment = alignment;
377
378 AwtToolkit::GetInstance().SyncCall(AwtLabel::_SetAlignment, sas);
379 // global ref and sas are deleted in _SetAlignment
380
381 CATCH_BAD_ALLOC;
382 }
383
384 /*
385 * Class: sun_awt_windows_WLabelPeer
386 * Method: create
387 * Signature: (Lsun/awt/windows/WComponentPeer;)V
388 */
389 JNIEXPORT void JNICALL
390 Java_sun_awt_windows_WLabelPeer_create(JNIEnv *env, jobject self,
391 jobject parent)
392 {
393 TRY;
394
395 AwtToolkit::CreateComponent(self, parent,
396 (AwtToolkit::ComponentFactory)
397 AwtLabel::Create);
398
399 CATCH_BAD_ALLOC;
400 }
401
402 /*
403 * Class: sun_awt_windows_WLabelPeer
404 * Method: lazyPaint
405 * Signature: ()V
406 */
407 JNIEXPORT void JNICALL
408 Java_sun_awt_windows_WLabelPeer_lazyPaint(JNIEnv *env, jobject self)
409 {
410 TRY;
411
412 jobject selfGlobalRef = env->NewGlobalRef(self);
413
414 AwtToolkit::GetInstance().SyncCall(AwtLabel::_LazyPaint, (void *)selfGlobalRef);
415 // selfGlobalRef is deleted in _LazyPaint
416
417 CATCH_BAD_ALLOC;
|