类似qq上线提示的一个java程序
来源:互联网 发布:医学 教学 仿真软件 编辑:程序博客网 时间:2024/04/28 04:29
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class Popup extends Thread {
Shell shell;
protected int moveStep = 2;
protected int upPosition;
protected int downPosition;
protected int leftPosition;
public Popup(final String message) {
shell = new Shell(SWT.ON_TOP);
shell.setBackground(new Color(Display.getCurrent(), 23, 184, 237));
Text text = new Text(shell, SWT.MULTI | SWT.WRAP);
text.setBounds(10, 20, 180, 80);
text.setBackground(shell.getBackground());
text.setForeground(new Color(Display.getCurrent(), 221, 55, 84));
text.setText(message);
Rectangle area = Display.getDefault().getClientArea();
upPosition = area.height - 100;
downPosition = area.height + 100;
leftPosition = area.width - 180;
shell.setSize(180, 100);
shell.setLocation(leftPosition, downPosition);
shell.open();
}
public void run() {
Display display = shell.getDisplay();
while (true) {
try {
Thread.sleep(10);
if ((downPosition - moveStep) > upPosition) {
display.asyncExec(new Runnable() {
public void run() {
shell.setLocation(
leftPosition,
downPosition - moveStep);
downPosition -= moveStep;
}
});
} else {
Thread.sleep(6000);
display.asyncExec(new Runnable() {
public void run() {
shell.dispose();
}
});
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
- 类似qq上线提示的一个java程序
- 一个类似QQ的java聊天程序
- 用JavaScript实现类似QQ好友上线的提示窗体
- 用Java写的一个类似QQ登陆界面的程序 Java QQ登陆界面
- 编写一个类似qq的屏幕捕捉程序
- 一个简单的多线程即时通讯程序(类似QQ,MSN)
- 一个简单的多线程即时通讯程序(类似QQ,MSN)
- 【转】一个简单的多线程即时通讯程序(类似QQ,MSN)
- java课程程序设计-----一个类似QQ登录的界面
- 类似msn,qq的右下角消息提示
- JS实现类似qq的提示框
- 类似QQ的提示消息数量
- 小知识总结--winform 类似QQ的右下角提示窗口不会被其他程序挡住方法
- 实现类似qq的聊天小程序
- 一个类似QQ登陆框的EDIT
- 实现一个类似QQ的社交聊天工具
- java类似QQ的聊天室程序的实现(下)(服务器端程序)
- java 类似QQ的本地聊天室程序实现(上)(客户端程序)
- 相当与dir命令的java程序
- 读文件
- 我的完美新娘 - Part 3
- 如果数据表或字段名是SQL关键字怎么办
- c# 读写文本文件(一般用于日志文件的编程)
- 类似qq上线提示的一个java程序
- MySQL性能优化全攻略
- 著名Java培训专家梁立新老师中关村图书大厦读者见面会即将举行
- 如何调用.chm帮助文件
- c# 如何响应键盘事件 一般用于察看帮助或日志
- 被检验试图
- swt大杂合
- JAVA正则表达式4种常用功能
- 使用C#创建webservice及三种调用方式