Solved

Getting 4 columns for 3 more buttons.

Posted on 2004-03-31
3
183 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now