Link to home
Start Free TrialLog in
Avatar of Drop_of_Rain
Drop_of_Rain

asked on

Getting 4 columns for 3 more buttons.

I was able to get 4 rows with the buttoms but for some reason I can't get 4 columns for 3 more buttons.


final JLabel l1 = new JLabel();
        l1.setBorder(BorderFactory.createLineBorder(Color.yellow));

        p1.setBorder(BorderFactory.createLoweredBevelBorder());
        p4.setBorder(BorderFactory.createLoweredBevelBorder());
        p4.setBackground(Color.blue);
       
        p1.setLayout(new BorderLayout());
        add(p1, BorderLayout.EAST);
        p1.add(p2);
        p1.setLayout(new GridLayout(1,2));
        p1.add(p2);
        p1.add(p3, BorderLayout.CENTER);

        p2.setLayout(new GridLayout(1,1));
        p2.add(p4);

        p4.setLayout(new BorderLayout());
        add(p4, BorderLayout.CENTER);
        p4.setLayout(new GridLayout(3,3));
        p4.add(b1); p4.add(b2); p4.add(b3);
        p4.add(b4); p4.add(l1); p4.add(b5);
        p4.add(b6); p4.add(b7); p4.add(b8);
       
        p5.setLayout(new GridLayout(5,1));
        p5.add(new JLabel("Name 1\n"));
        p5.add(new JLabel("Name 2"));
        p5.add(new JLabel("Name 3"));
        p5.add(new JLabel("Name 4"));
        p5.add(new JLabel("Name 5"));
       
       
        p3.setLayout(new GridLayout(1,3));
        p3.add(new JPanel()); p3.add(p5);
        p3.add(new JPanel());

       
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Drop_of_Rain
Drop_of_Rain

ASKER

I had tried that I could see the row when I added a row, I thought that I would see the column as well. I added more buttons and there it was.