I have a label in my JFrame. It's variable name is l_1001.
I want to get this variable name in output. How can I do it?
I tried
System.out.print(l_1001.getName())
But output rotates null.
I have a label in my JFrame. It's variable name is l_1001.
I want to get this variable name in output. How can I do it?
I tried
System.out.print(l_1001.getName())
But output rotates null.
See the docs, JLabel#getName():
Gets the name of the component.
In Java, you cannot simply return the name of the variable (without using reflection), you should set it before, you can use JLabel#setName to do that.