Getting a Component name as a string



Say I make an object, a control.

JButton <i><b>Button_1</i></b> = new JButton("whatever");


now say i want to retrieve the name of the JButton, that is
"Button_1", as a string. How do i do this. I have extended buttons
with a setName()/getName() method but there must be an easier way than
wrapping every object i want to do this with. It is probably really
simple and I'm probably a total clown for not knowing, but any pointer
to where i can learn more about this would be appreciated.

.


Quantcast