How to make String value to call specific existed JButton variable name in java?
So, I know there is this: int number = Integer.parseInt("5"); String numtxt = Integer.toString(12); double number = Double.parseDouble("4.5"); String numbertxt = Double.toString(8.2); String letter = Character.toString('B'); char letter = "stringText".charAt(0); so on... but what I don't know how to make String value to call existed JButton variable name dynamically; is it even possible? Let's say, I have 4 JButton called btn1, btn2, btn3 and btnFillNumber; I create a String called buttonName; package testing; public class Testing extends javax.swing.JFrame { String buttonName; int num; public