当前位置: 首页>>代码示例>>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;未经允许,请勿转载。