Rectangle area = Display.getDefault().getClientArea();
int upPosition = area.height - 100;int downPosition = area.height + 100;

// Test.java
//主界面,其中只有一個button,當點擊時調用Popup在右下角顯示像MSN和QQ一樣的popup界面。
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Test {
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell();
shell.setText("aaa");
shell.setSize(250, 150);
final Button button = new Button(shell, SWT.NONE);
button.setBounds(50, 20, 100, 25);
button.setText("button");
//監聽button的事件,當用戶點擊時調用Popup類顯示popup界面。
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//實例化popup類,構造函數為popup界面中出現的提示信息。
新聞熱點
疑難解答