Вопрос

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