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


Java JComponent.setName方法代碼示例

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


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

示例1: setTitle

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
   public void setTitle(JComponent comp, String title) {
/* OLD
if (title == null)
    title = originalName;
*/

// Remember title in attributes
// It gets recalled when we switch from tabbed to soleComponent mode
Attributes attrs = attributesFor(comp);
attrs.title = title;

// output2 uses the name property of the JComponent to
// remember the title.
// So do we for good measure.
comp.setName(title);

if (!contains(comp))
    return;

setTitleWork(comp, title);
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:TerminalContainerCommon.java

示例2: createTemplateChooser

import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
protected WizardDescriptor.Panel<WizardDescriptor> createTemplateChooser() {
    WizardDescriptor.Panel<WizardDescriptor> panel = new ProjectTemplatePanel();
    JComponent jc = (JComponent)panel.getComponent ();
    jc.setPreferredSize( new java.awt.Dimension (500, 340) );
    jc.setName (NbBundle.getBundle (NewProjectWizard.class).getString ("LBL_NewProjectWizard_Name")); // NOI18N
    jc.getAccessibleContext ().setAccessibleName (NbBundle.getBundle (NewProjectWizard.class).getString ("ACSN_NewProjectWizard")); // NOI18N
    jc.getAccessibleContext ().setAccessibleDescription (NbBundle.getBundle (NewProjectWizard.class).getString ("ACSD_NewProjectWizard")); // NOI18N
    jc.putClientProperty (WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, new Integer (0));
    jc.putClientProperty (WizardDescriptor.PROP_CONTENT_DATA, new String[] {
            NbBundle.getBundle (NewProjectWizard.class).getString ("LBL_NewProjectWizard_Name"), // NOI18N
            NbBundle.getBundle (NewProjectWizard.class).getString ("LBL_NewProjectWizard_Dots")}); // NOI18N
            
    return panel;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:NewProjectWizard.java

示例3: updateEdgeMenu

import javax.swing.JComponent; //導入方法依賴的package包/類
/**
   * Update edge menu with context sensitive menu items.
   * @param graphEdge the current GraphEdge
   */
  private void updateEdgeMenu(GraphEdge graphEdge) {
      
  	if (this.edgePopup == null) return;
  	
  	// --- Remove the old customized entries ---------------
  	Component[] comps = this.edgePopup.getComponents();
  	for (int i = 0; i < comps.length; i++) {
  		Component comp = comps[i];
  		if (comp!=null && comp.getName()!=null && comp.getName().startsWith(MENU_ITEM_NAME_PREFIX)) {
  			this.edgePopup.remove(comp);
  		}
}
  	
  	// --- Evaluate for a NetworkComponent -----------------
  	Vector<NetworkComponent> netComps = this.getNetworkComponents(graphEdge);
  	if (netComps!=null) {
  		// --- Add the context sensitive JMenueItems -------
  		NetworkComponent netComp = netComps.iterator().next();
  		NetworkModel netModel = this.basicGraphGui.getGraphEnvironmentController().getNetworkModel();
  		NetworkComponentAdapter adapter = netModel.getNetworkComponentAdapter(this.graphController, netComp);
  		if (adapter!=null) {
  			// --- Get the context menu items -------------- 
  			Vector<JComponent> adapterJComponents2Add = adapter.invokeGetJPopupMenuElements(netComp);
      		if (adapterJComponents2Add!=null) {
      			if (adapterJComponents2Add.size()>0) {
      				// --- Add Separator -------------------
      				this.edgePopup.add(this.getNewSeparator(netComp.getId()+ "Adapter"));
      				for (int i = 0; i < adapterJComponents2Add.size(); i++) {
					JComponent item = adapterJComponents2Add.get(i);
					item.setName(MENU_ITEM_NAME_PREFIX + netComp.getId()+ i);
					this.edgePopup.add(item);
				}
      			}
      		}
  		}
  	}
  }
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:42,代碼來源:GraphEnvironmentPopupPlugin.java

示例4: createComponent

import javax.swing.JComponent; //導入方法依賴的package包/類
public JComponent createComponent(Category category, Lookup context) {
    JComponent c = new JPanel();
    c.setName(name);
    return c;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:ProjectCustomizerTest.java

示例5: addOptionTab

import javax.swing.JComponent; //導入方法依賴的package包/類
/**
 * Adds a Project-Tab and a new Base Folder (child of root!) to the OptionDialog.
 *
 * @param title the title
 * @param icon the icon
 * @param component the component
 * @param toolTipText the tool tip text
 */
public void addOptionTab(String title, Icon icon, JComponent component, String toolTipText) {
	component.setName(title); 							
	this.jTabbedPaneRight.addTab(title, icon, component, toolTipText);
	this.addOptionTabNode(title);
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:14,代碼來源:OptionDialog.java


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