本文整理匯總了Java中org.openide.windows.WindowManager.findTopComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java WindowManager.findTopComponent方法的具體用法?Java WindowManager.findTopComponent怎麽用?Java WindowManager.findTopComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.windows.WindowManager
的用法示例。
在下文中一共展示了WindowManager.findTopComponent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTopComponents
import org.openide.windows.WindowManager; //導入方法依賴的package包/類
/** Used to get array for view and for persistence */
public TopComponent [] getTopComponents() {
List<TopComponent> tcList = new ArrayList<TopComponent>(tcIdList.size());
WindowManager wm = WindowManager.getDefault();
for (int i = 0; i < tcIdList.size(); i++) {
String tcId = tcIdList.get( i );
TopComponent tc = null;
Reference<TopComponent> ref = tcCache.get( tcId );
if( null != ref ) {
tc = ref.get();
}
if( null == tc ) {
tc = wm.findTopComponent( tcId );
if( null != tc )
tcCache.put( tcId, new WeakReference<TopComponent>( tc ) );
}
if ((tc != null) && tc.isOpened()) {
tcList.add(tc);
}
}
return tcList.toArray(new TopComponent[tcList.size()]);
}
示例2: getUI
import org.openide.windows.WindowManager; //導入方法依賴的package包/類
private SnapshotsWindowUI getUI(boolean create) {
if (ui == null) {
WindowManager wm = WindowManager.getDefault();
for (TopComponent tc : TopComponent.getRegistry().getOpened())
if (tc.getClientProperty(SnapshotsWindowUI.ID) != null)
ui = (SnapshotsWindowUI)tc;
if (ui == null && create)
ui = (SnapshotsWindowUI)wm.findTopComponent(SnapshotsWindowUI.ID);
if (ui == null && create)
ui = new SnapshotsWindowUI();
}
return ui;
}
示例3: showPalette
import org.openide.windows.WindowManager; //導入方法依賴的package包/類
static void showPalette() {
WindowManager wm = WindowManager.getDefault();
TopComponent palette = wm.findTopComponent("CommonPalette"); // NOI18N
if (null == palette) {
Logger.getLogger(PaletteSwitch.class.getName()).log(Level.INFO, "Cannot find CommonPalette component."); // NOI18N
//for unit-testing
palette = getDefault();
}
if (!palette.isOpened()) {
palette.open();
}
}