simple netbeans question

BoBlake
BoBlake used Ask the Experts™
on
Why won't netbeans find "initComponents()" in the following code?

Thanks for any help.  This is driving me nuts.  I've used this syntax before, but I'm missing something!

Bo

package ToyTestOne;
 
public class ToyApp extends javax.swing.JFrame
{
 
    Toy myToy;
 
    public ToyApp()
    {
        myToy = new Toy("GI Joe", 'B', "6-12", 12.99);
 
        initComponents();  // compiler says it cannot find symbol: method initComponents
 
    }
 
    public static void main(String[] args)
    {
    }
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You have no initComponents method anywhere in your code, so it can't be found. Your class doesn't have one, nor does the class it inherits from (JFrame).
Can you clarify where is this initComponents method you're referring to? In which class it is defined? Is it in one of your classes?
I guess, you have created GUI using NetBean auto generated code.
Then, there must be a method as below: where all the gui components will be created.

@SuppressWarnings("unchecked")
   // <editor-fold defaultstate = "collapsed" desc = "Generated Code"> //GEN-BEGIN:initComponents
   private void initComponents()
    {
....
....
}

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial