Solved

4 Y axis boxlayouts in a layout

Posted on 2004-04-02
3
229 Views
Last Modified: 2010-03-31
How to make up 4 Y axis boxlayouts in a layout to go into a tabbedpane?



// Create vertical box container
    box = new Box(BoxLayout.Y_AXIS);
   
    // Here is a another way to create a vertical box container
    box = Box.createVerticalBox();
   
    // Add components
    box.add(component1);
    box.add(component2);
0
Comment
Question by:Drop_of_Rain
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 125 total points
ID: 10739357
Don't know exactly what you mean.

>> How to make up 4 Y axis boxlayouts in a layout to go into a tabbedpane?
You mean one panel/tab of a tabbedpane
So in fact how to make - on a panel - 4 Y-axis box layouts.
Containing what?
In my example each boxlayout contains 3 JLabels; could be whatever:

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();

        setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));

        jLabel1.setText("jLabel1");
        jPanel1.add(jLabel1);

        jLabel2.setText("jLabel2");
        jPanel1.add(jLabel2);

        jLabel3.setText("jLabel3");
        jPanel1.add(jLabel3);

        add(jPanel1);

        jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.Y_AXIS));

        jLabel4.setText("jLabel4");
        jPanel2.add(jLabel4);

        jLabel5.setText("jLabel5");
        jPanel2.add(jLabel5);

        jLabel6.setText("jLabel6");
        jPanel2.add(jLabel6);

        add(jPanel2);

        jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.Y_AXIS));

        jLabel7.setText("jLabel7");
        jPanel3.add(jLabel7);

        jLabel8.setText("jLabel8");
        jPanel3.add(jLabel8);

        jLabel9.setText("jLabel9");
        jPanel3.add(jLabel9);

        add(jPanel3);

        jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));

        jLabel10.setText("jLabel10");
        jPanel4.add(jLabel10);

        jLabel11.setText("jLabel11");
        jPanel4.add(jLabel11);

        jLabel12.setText("jLabel12");
        jPanel4.add(jLabel12);

        add(jPanel4);
0
 

Author Comment

by:Drop_of_Rain
ID: 10739424
I am still learning how to describe in proper code terms.

Thanks, great example.

friend, christopher
0
 
LVL 37

Expert Comment

by:zzynx
ID: 10739461
>> I am still learning how to describe in proper code terms.
That's OK.
We both do our best: you to formulate, I to interpret.
We can't do more, do we?

Thanks again Christopher
:)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
count11 challenge 6 47
topping1 challenge 7 51
pairs challenge 5 44
Java array passed to SQL where clause 23 43
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

758 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

22 Experts available now in Live!

Get 1:1 Help Now