I have created GUI window using gridbaglayout. Window contains 1 columns and 2 rows. First and second row contains two JButton with no vertical space. If i set java and window look and feel it work perfectly fine but when i set motif look and feel vertical space automatically appears. Not able to understand. If somebody is having solution please let me know as early as possible. Attaching code for ur reference import java.awt.*; import java.awt.event.*; import java.awt.Font; import javax.swing.*; import javax.swing.event.*; import javax.swing.BorderFactory; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import com.sun.java.swing.plaf.motif.MotifLookAndFeel;
buttonTestPanel = new JPanel(); UIBButtonTestGridBagLayout = new GridBagLayout(); UIBButtonTestGridBagConstraints= new GridBagConstraints(); UIBButtonTestEtchedBorder = BorderFactory.createEtchedBorder();
//set the border to the panel if(bPaintBorder) { buttonTestPanel.setBorder(UIBButtonTestTitleBorder); } buttonTestPanel.setLayout(UIBButtonTestGridBagLayout); //buttonTestPanel.setLayout(new GridLayout(2,1,0,0));
objButtonOne = new JButton("Button1"); objButtonOne.setPreferredSize(new Dimension(60,40)); //buttonTestPanel.add(objButtonOne); addComp(objButtonOne,UIBButtonTestGridBagConstraints,buttonTestPanel,1,1,1,GridBagConstraints.WEST);
objButtonTwo = new JButton("Button2"); objButtonTwo.setPreferredSize(new Dimension(60,40)); //buttonTestPanel.add(objButtonTwo); addComp(objButtonTwo,UIBButtonTestGridBagConstraints,buttonTestPanel,1,2,1,GridBagConstraints.WEST);