當前位置: 首頁>>代碼示例>>Java>>正文


Java JToolBar.getComponentCount方法代碼示例

本文整理匯總了Java中javax.swing.JToolBar.getComponentCount方法的典型用法代碼示例。如果您正苦於以下問題:Java JToolBar.getComponentCount方法的具體用法?Java JToolBar.getComponentCount怎麽用?Java JToolBar.getComponentCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JToolBar的用法示例。


在下文中一共展示了JToolBar.getComponentCount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: stealJToolBarFromOntologyClassEditorJPanel

import javax.swing.JToolBar; //導入方法依賴的package包/類
/**
 * Steal the components of a JToolBar for a {@link OntologyClassEditorJPanel}.
 * @param ocep the OntologyClassEditorJPanel
 */
private void stealJToolBarFromOntologyClassEditorJPanel(OntologyClassEditorJPanel ocep) {
	
	if (ocep==null) return;
	if (this.jToolBar4UserFunction==null) return;
	
	JToolBar jToolBarUserFunctions = ocep.getJToolBarUserFunctions();
	if (jToolBarUserFunctions!=null) {
		Container containerUserFunctions = jToolBarUserFunctions.getParent();
		while (jToolBarUserFunctions.getComponentCount()>0) {
			Component comp = jToolBarUserFunctions.getComponent(0);
			this.getStolenComponentsFromJToolBarOfOntologyClassEditorJPanel().add(comp);
			jToolBarUserFunctions.remove(comp);
		}
		if (containerUserFunctions!=null) {
			containerUserFunctions.remove(jToolBarUserFunctions);	
		}
		ocep.validate();
		ocep.repaint();	
	}
	
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:26,代碼來源:DynTableJPanel.java

示例2: processToolBar

import javax.swing.JToolBar; //導入方法依賴的package包/類
/** Post-processes an already constructed toolbar.
 */
private void processToolBar(JToolBar toolBar) {
    for (int i = 0; i < toolBar.getComponentCount(); i++) {
        Component element = toolBar.getComponent(i);
        if (element instanceof JButton) {
            JButton button = (JButton) element;
            Action action = button.getAction();
            if (action != null) {
                getJGraph().addAccelerator(action);
            }
        }
    }
    // ensure the JGraph gets focus as soon as the graph panel
    // is clicked anywhere
    // for reasons not clear to me, mouse listeners do not work on
    // the level of the JGraphPanel
    toolBar.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            getJGraph().requestFocus();
        }
    });
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:25,代碼來源:GraphEditorTab.java

示例3: desableFocus

import javax.swing.JToolBar; //導入方法依賴的package包/類
protected void desableFocus(final JToolBar bar) {
    for (int i = 0; i < bar.getComponentCount(); i++) {
        bar.getComponent(i).setFocusable(false);
    }
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:6,代碼來源:MainFrame.java


注:本文中的javax.swing.JToolBar.getComponentCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。