我開發。我正在使用SWT Novocode氣球窗口一個RCP應用程序的外殼。我需要顯示按鈕click.but一個BaloonWindow每當我在按鈕每次單擊創建一個新的氣球窗口只顯示一個殼如果要是以前打開不顯示另一個shell
我的代碼如下
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
BalloonWindow baloonWindow=new BalloonWindow(HandlerUtil.getActiveWorkbenchWindow(event).getShell(),SWT.ON_TOP|SWT.TOOL|SWT.CLOSE);
baloonWindow.setText("XYZ");
baloonWindow.setAnchor(SWT.RIGHT|SWT.TOP);
baloonWindow.setLocation(1290, 90);
Composite c = baloonWindow.getContents();
String array[]=new String[2];
array[0]="A";
array[1]="B";
c.setLayout(new FillLayout());
TableViewer t=new TableViewer(c,SWT.NONE);
t.setContentProvider(new ArrayContentProvider());
t.setInput(array);
c.pack(true);
baloonWindow.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
有人能幫助me.how只顯示一個氣球窗口如果氣球窗口打開,則不應允許另一個氣球窗口打開,或者在任何給定的時間點只應保持一個氣球窗口打開。
我不知道你正在使用的技術什麼,但我在你的代碼,當你創建一個新的你不隱藏任何以前的「氣球」窗口看到。 – atas
這就是我想要做的。我只有一個氣球。在每一個按鈕點擊一個新的氣囊被打開,因此它創建balloons.I一疊找不到隱藏了例如'hideBalloon()' – Abhit
像「調用setVisible(假)」也許氣球的任何方法? – atas