Switching to GridbagLayout produces error
Author: Viktor Zacek |
07/16/09 01:45 |
Greetings!
1. create new "Swing Main Application" or "JDialog"
2. switch to tab "Layout", drag GridbagLayout to Form.
3. errors occur... line "GridBagLayout thisLayout = new GridBagLayout();" is misplaced, it should be before first access to "thisLayout".
Code in initGUI is:
thisLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1};
thisLayout.rowHeights = new int[] {7, 7, 7, 7};
thisLayout.columnWeights = new double[] {0.1, 0.1, 0.1, 0.1};
GridBagLayout thisLayout = new GridBagLayout();
thisLayout.columnWidths = new int[] {7, 7, 7, 7};
getContentPane().setLayout(thisLayout);
This error does not occur when creating any other option like JPanel or JFrame.
Best regards,
Viktor |
|