What is java.awt.Component.getName() used for? It always seems to be null in the applications I build with NetBeans. I\'m thinking of storing some help text p
The component.getName() method is mostly used with listeners. If you set the name of a component (component.setName(name)) you can call to that specific component from within a method of a Listener.
Example:
public void someMethodOfsomeListener(SomeEvent e){
if (e.getComponent().getName().equals(component.getName())
//do stuff...
}
Be aware that you have to explicitly set the name of the component, otherwise it will return null.