Solved

Getting 4 columns for 3 more buttons.

Posted on 2004-03-31
3
201 Views
Last Modified: 2010-03-31
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());

       
0
Comment
Question by:Drop_of_Rain
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 75 total points
ID: 10727992
>  p4.setLayout(new GridLayout(3,3));

 p4.setLayout(new GridLayout(3,4));
0
 

Author Comment

by:Drop_of_Rain
ID: 10728053
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 10728069
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 38
couple of eclipse 5 36
login jsp example 24 49
expectj telnet failing 5 36
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question