本文整理汇总了C++中AwtComponent::CreateControlID方法的典型用法代码示例。如果您正苦于以下问题:C++ AwtComponent::CreateControlID方法的具体用法?C++ AwtComponent::CreateControlID怎么用?C++ AwtComponent::CreateControlID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AwtComponent
的用法示例。
在下文中一共展示了AwtComponent::CreateControlID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
/* Create a new AwtScrollPane object and window. */
AwtScrollPane* AwtScrollPane::Create(jobject self, jobject parent)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jobject target = NULL;
AwtScrollPane* c = NULL;
try {
if (env->EnsureLocalCapacity(1) < 0) {
return NULL;
}
PDATA pData;
AwtComponent* awtParent;
JNI_CHECK_PEER_GOTO(parent, done);
awtParent = (AwtComponent*)pData;
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
target = env->GetObjectField(self, AwtObject::targetID);
JNI_CHECK_NULL_GOTO(target, "null target", done);
c = new AwtScrollPane();
{
DWORD style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
jint scrollbarDisplayPolicy =
env->GetIntField(target, scrollbarDisplayPolicyID);
if (scrollbarDisplayPolicy
== java_awt_ScrollPane_SCROLLBARS_ALWAYS) {
style |= WS_HSCROLL | WS_VSCROLL;
}
DWORD exStyle = WS_EX_CLIENTEDGE;
if (GetRTL()) {
exStyle |= WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR;
if (GetRTLReadingOrder())
exStyle |= WS_EX_RTLREADING;
}
jint x = env->GetIntField(target, AwtComponent::xID);
jint y = env->GetIntField(target, AwtComponent::yID);
jint width = env->GetIntField(target, AwtComponent::widthID);
jint height = env->GetIntField(target, AwtComponent::heightID);
c->CreateHWnd(env, L"", style, exStyle,
x, y, width, height,
awtParent->GetHWnd(),
reinterpret_cast<HMENU>(static_cast<INT_PTR>(
awtParent->CreateControlID())),
::GetSysColor(COLOR_WINDOWTEXT),
::GetSysColor(COLOR_WINDOW),
self);
}
} catch (...) {
env->DeleteLocalRef(target);
throw;
}
done:
env->DeleteLocalRef(target);
return c;
}
示例2: Create
AwtCheckbox* AwtCheckbox::Create(jobject peer, jobject parent)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jstring label = NULL;
jobject target = NULL;
AwtCheckbox *checkbox = NULL;
try {
if (env->EnsureLocalCapacity(2) < 0) {
return NULL;
}
AwtComponent* awtParent;
JNI_CHECK_NULL_GOTO(parent, "null parent", done);
awtParent = (AwtComponent*)JNI_GET_PDATA(parent);
JNI_CHECK_NULL_GOTO(awtParent, "null awtParent", done);
target = env->GetObjectField(peer, AwtObject::targetID);
JNI_CHECK_NULL_GOTO(target, "null target", done);
checkbox = new AwtCheckbox();
{
DWORD style = WS_CHILD | WS_CLIPSIBLINGS | BS_OWNERDRAW;
LPCWSTR defaultLabelStr = L"";
LPCWSTR labelStr = defaultLabelStr;
DWORD exStyle = 0;
if (GetRTL()) {
exStyle |= WS_EX_RIGHT;
if (GetRTLReadingOrder())
exStyle |= WS_EX_RTLREADING;
}
label = (jstring)env->GetObjectField(target, AwtCheckbox::labelID);
if (label != NULL) {
labelStr = JNU_GetStringPlatformChars(env, label, 0);
}
if (labelStr != 0) {
jint x = env->GetIntField(target, AwtComponent::xID);
jint y = env->GetIntField(target, AwtComponent::yID);
jint width = env->GetIntField(target, AwtComponent::widthID);
jint height = env->GetIntField(target, AwtComponent::heightID);
checkbox->CreateHWnd(env, labelStr, style, exStyle,
x, y, width, height,
awtParent->GetHWnd(),
reinterpret_cast<HMENU>(static_cast<INT_PTR>(
awtParent->CreateControlID())),
::GetSysColor(COLOR_WINDOWTEXT),
::GetSysColor(COLOR_BTNFACE),
peer);
if (labelStr != defaultLabelStr) {
JNU_ReleaseStringPlatformChars(env, label, labelStr);
}
} else {
throw std::bad_alloc();
}
}
} catch (...) {
env->DeleteLocalRef(label);
env->DeleteLocalRef(target);
throw;
}
done:
env->DeleteLocalRef(label);
env->DeleteLocalRef(target);
return checkbox;
}