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