I'm trying to learn how to use the GridBagLayout manager... but when I write it like the following: JPanel panel = new JPanel(new GridBagLayout());, Java tells me the following: cannot find symbol
symbol: constructor JPanel(gridbaglayout.GridBagLayout)
When this didn't work, I tried type casting JPanel panel = new JPanel((LayoutManager) new GridBagLayout());, this give me an error when I compile the code :Exception in thread "main" java.lang.ClassCastException: gridbaglayout.GridBagLayout cannot be cast to java.awt.LayoutManager
What am I doing wrong?, I looked at http://download.oracle.com/javase/tutorial/uiswing/layout/gridbag.html and this is how they show it but it doesn't work for me.
Any help is appreciated :-)