S
Scott Steiner
Hi,
I want to get the following arrangment of buttons:
# button 0 #
# button 1 ## button 2#
but I'm getting this instead:
# button 0 #
# button 1 #
here's the code, what am I doing wrong?
pane.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
JButton button;
button = new JButton("Button 0");
c.weightx = 1;
c.gridwidth = 2;
c.gridx = 0;
c.gridy = 0;
pane.add(button, c);
button = new JButton("Button 1");
c.weightx = 0.5;
c.gridx = 0;
c.gridy = 1;
pane.add(button, c);
button = new JButton("Button 2");
c.weightx = 0.5;
c.gridx = 1;
c.gridy = 1;
pane.add(button, c);
I want to get the following arrangment of buttons:
# button 0 #
# button 1 ## button 2#
but I'm getting this instead:
# button 0 #
# button 1 #
here's the code, what am I doing wrong?
pane.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
JButton button;
button = new JButton("Button 0");
c.weightx = 1;
c.gridwidth = 2;
c.gridx = 0;
c.gridy = 0;
pane.add(button, c);
button = new JButton("Button 1");
c.weightx = 0.5;
c.gridx = 0;
c.gridy = 1;
pane.add(button, c);
button = new JButton("Button 2");
c.weightx = 0.5;
c.gridx = 1;
c.gridy = 1;
pane.add(button, c);