سؤال

NetBeans IDE 7.4 is not recognizing GridLayout Manager gives an error:

no suitable method found for setLayout(GridLayout)     
  method Container.setLayout(LayoutManager) is not applicable       
    (argument mismatch; GridLayout cannot be converted to LayoutManager)     
  method JFrame.setLayout(LayoutManager) is not applicable       
    (argument mismatch; GridLayout cannot be converted to LayoutManager)

Do you know what could be wrong? I have uninstalled and reinstalled JDK and IDE to no avail. Don't know what to do.

هل كانت مفيدة؟

المحلول

setLayout(new GridLayout());

Then Shift + Ctrl + I to resolve all imports.

Works perfectly fine for me. You might be forgetting to instantiate.

The only other think I can see happening is that you have defined your own GridLayout class withing the same package, and that GridLayout is not a LayoutManager

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top