Java Code Examples for javax.swing.JComponent#setName()
The following examples show how to use
javax.swing.JComponent#setName() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans File: TerminalContainerCommon.java License: Apache License 2.0 | 6 votes |
@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); }
Example 2
Source Project: raccoon4 File: MenuBarBuilder.java License: Apache License 2.0 | 6 votes |
/** * Add an item/menu to the menubar. Items are appended to their parent * container in the same order in which they are added. This implies that * parent items must be created before children can be added. * * @param path * where to add. * @param item * what to add. NOTE: this should be an instance of {@link JMenu}, * {@link JMenuItem}, {@link JRadioButtonMenuItem}, * {@link JCheckBoxMenuItem} or {@link JSeparator}. Nesting menus is * perfectly fine (though not from a usability point of view). * @return this reference for chaining. */ public MenuBarBuilder add(String path, JComponent item) { maps.put(path, item); if (localizer != null && item instanceof JMenuItem) { Action a = ((JMenuItem) item).getAction(); localizer.localize(a, getLocalizationKey(path)); } String parentPath = path.substring(0, Math.max(path.lastIndexOf(PATHSEPARATOR), 0)); JComponent parent = maps.get(parentPath); if (item.getName() == null) { item.setName(path); // for unit tests } if (parent == null) { mbar.add(item); } else { parent.add(item); } return this; }
Example 3
Source Project: snap-desktop File: BundleForm.java License: GNU General Public License v3.0 | 6 votes |
private JComponent getEditorComponent(OSFamily osFamily, String propertyName,String controlName, boolean isFolder) { if (osFamily == OSFamily.all) { osFamily = OSFamily.windows; } PropertyContainer propertyContainer = propertyContainers.get(osFamily); BindingContext bindingContext = bindingContexts.get(osFamily); PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName); if (isFolder) { propertyDescriptor.setAttribute("directory", true); } PropertyEditor propertyEditor = PropertyEditorRegistry.getInstance().findPropertyEditor(propertyDescriptor); JComponent editorComponent = propertyEditor.createEditorComponent(propertyDescriptor, bindingContext); if (controlName != null) { editorComponent.setName(controlName); } return editorComponent; }
Example 4
Source Project: netbeans File: NewProjectWizard.java License: Apache License 2.0 | 5 votes |
@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; }
Example 5
Source Project: netbeans File: ProjectCustomizerTest.java License: Apache License 2.0 | 4 votes |
public JComponent createComponent(Category category, Lookup context) { JComponent c = new JPanel(); c.setName(name); return c; }
Example 6
Source Project: snap-desktop File: PlacemarkManagerTopComponent.java License: GNU General Public License v3.0 | 4 votes |
private void setComponentName(JComponent component, String name) { component.setName(getClass().getName() + "." + name); }
Example 7
Source Project: snap-desktop File: GcpGeoCodingForm.java License: GNU General Public License v3.0 | 4 votes |
private void setComponentName(JComponent component, String name) { component.setName(getClass().getName() + name); }