Hello Guys,
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)
location: class.javax.swing.JPanel.
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
at gridbaglayout.GridBagLayout.main(GridBagLayout.java:21)
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 :-)