Insert FlowLayout to BorderLayout

How Can I insert FlowLayout to BorderLayout, can somebody give me solution here is my code.

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.event.*;

class Frame2extends JFrame{

private JLabel label1, label2, label3, label4, label5;

Frame2(){

setLayout(new BorderLayout(5, 5));

label1 =new JLabel("Frame 2CENTER");

add(label1, BorderLayout.CENTER);

label1.setOpaque(true);

label1.setBackground(Color.RED);

label2 =new JLabel("Frame 2NORTH");

add(label2, BorderLayout.NORTH);

label3 =new JLabel("Frame 2 WEST ");

add(label3, BorderLayout.WEST);

label4 =new JLabel("Frame 2 EAST ");

add(label4, BorderLayout.EAST);

label5 =new JLabel("Frame 2 SOUTH ");

add(label5, BorderLayout.SOUTH);

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

setSize(360, 350);

setVisible(true);

setLocationRelativeTo(null);

}

publicstaticvoid main(String[] args)

{

Frame2 frame2 =new Frame2();

frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame2.setSize(600, 500);

frame2.setVisible(true);

}

}

I try make this but nothing happen

setLayout(new FlowLayout(BorderLayout.EAST));

label4 =new JLabel("Frame 2 EAST ");

add(label4);

[2462 byte] By [wandora] at [2007-11-26 22:47:47]
# 1

If you want another layout inside a layout, you need to do something like the following:

JPanel mainPanel = new JPanel(new BorderLayout());

JPanel anotherPanel = new JPanel(new FlowLayout());

mainPanel.add(anotherPanel,BorderLayout.NORTH);

mainPanel.add(...other stuff);

anotherPanel.add(...other stuff);

Nethera at 2007-7-10 12:06:58 > top of Java-index,Desktop,Core GUI APIs...