色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

java窗體和c 窗體

Java窗體和C窗體是兩種不同的窗口應(yīng)用程序開發(fā)技術(shù)。Java窗體是使用Java語(yǔ)言和AWT(Abstract Window Toolkit)或Swing API(Application Programming Interface)創(chuàng)建的窗體應(yīng)用程序,而C窗體是使用C語(yǔ)言和WinAPI(Windows Application Programming Interface)創(chuàng)建的窗口應(yīng)用程序。

Java窗體示例代碼:
import java.awt.*;
import javax.swing.*;
public class MyFrame extends JFrame {
public MyFrame() {
setTitle("My Java Window");
setSize(400, 300);
setLocationRelativeTo(null); // 居中顯示
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// 創(chuàng)建一個(gè)容器
Container cp = getContentPane();
// 在容器中添加一個(gè)標(biāo)簽
JLabel label = new JLabel("Hello, Java Window!");
cp.add(label);
}
public static void main(String[] args) {
MyFrame frame = new MyFrame();
frame.setVisible(true);
}
}
C窗體示例代碼:
#includeLRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) {
TCHAR szClassName[] = TEXT("MyCWindow");
WNDCLASSEX wcex;
// 注冊(cè)窗口類
wcex.cbSize = sizeof(wcex);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szClassName;
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wcex);
// 創(chuàng)建窗口
HWND hWnd = CreateWindow(szClassName, TEXT("My C Window"),
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
400, 300, NULL, NULL, hInstance, NULL);
// 顯示窗口
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
// 消息循環(huán)
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
switch (message) {
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// 在窗口中繪制文本
TextOut(hdc, 10, 10, TEXT("Hello, C Window!"), 16);
EndPaint(hWnd, &ps);
break;
}
case WM_DESTROY: {
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}