import java.awt.*;
import sun.awt.*;
import sun.awt.windows.*;
import javax.swing.*;
import java.awt.event.*;
public class Frame1 extends JFrame {
int windowHWND = 0;
JButton jButton1 = new JButton();
public Frame1() {
//windowHWND = this.getHwnd();
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public int getHwnd() {
DrawingSurfaceInfo w = (DrawingSurfaceInfo) ((DrawingSurface) getPeer()).getDrawingSurfaceInfo();
w.lock();
WDrawingSurfaceInfo win32 = (WDrawingSurfaceInfo) w;
int hwnd = win32.getHWnd();
w.unlock();
return hwnd;
}
static {
System.loadLibrary("windowOnTop");
}
public static native void WindowAlwaysOnTop(int hwnd, boolean flag);
public static void main(String[] args) {
Frame1 frame11 = new Frame1();
frame11.setSize(400,400);
frame11.setVisible(true);
}
private void jbInit() throws Exception {
jButton1.setText("jButton1");
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(WindowEvent e) {
this_windowOpened(e);
}
public void windowClosing(WindowEvent e) {
this_windowClosing(e);
}
});
this.getContentPane().add(jButton1, BorderLayout.NORTH);
}
void this_windowOpened(WindowEvent e) {
windowHWND = this.getHwnd();
System.out.println("the value is: " + this.getHwnd());
this.WindowAlwaysOnTop(windowHWND, true);
}
void this_windowClosing(WindowEvent e) {
System.exit(0);
}
}
JNI.rar_java jni_jni
版权申诉
107 浏览量
2022-09-14
16:25:32
上传
评论
收藏 9KB RAR 举报
APei
- 粉丝: 63
- 资源: 1万+
最新资源
- 基于matlab实现车牌识别程序,和论文,自己做的,做毕业设计的可以看看 .rar
- Windows系统下安装与配置Neo4j的步骤
- 基于matlab实现潮流计算和最优潮流计算的程序1,对毕业设计有一定用处.rar
- 基于大数据学习资源推荐系统的设计与实现(部署视频)-kaic.mp4
- 哈工大形式语言和自动机2022期末含答案
- Windows系统下安装与配置Neo4j的步骤
- 哈希算法(Hash Algorithm)是一种将任意长度的二进制数据映射为较短的、固定长度的二进制值的函数.txt
- Windows系统下安装与配置Neo4j的步骤
- 在二叉树或更复杂的树形结构中,先序输出叶结点.txt
- 列出所有祖先结点的概念通常与树形结构或图论中的节点相关.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈