I'm trying to do a loop thru all the button text in a form, but i can't find any solution for Java !!
i did something like :
 for(JButton temp : this)
 {
        if(JButton.getText() == "A")
        {
          JButton.enabled(false);
        }
 }
but no luck
p.s. my problem is not about the equals statement !! I want to loop thru all button in my window.
here is the working result thanks to MadProgrammer:
for(Component comp : jPanel2.getComponents()) 
            {
                if(comp instanceof JButton)
                {
                   JButton btn = (JButton)comp;                       
                   if(btn.getText().equals("A")) 
                   {
                     btn.setEnabled(false); 
                   }
                }
            }
 
     
     
     
    