FLOW FRAME LAYOUT IN JAVA


import javax.swing.*;
import java.awt.*;
class FlowLayoutGUI{
JFrame frame;
JButton button1;
JTextField text;
Button button2;
public void initialization(){
frame = new JFrame("HELLO");
button1 = new JButton("ok");
text = new JTextField("Hello",5);
button2 = new Button("nxt");
Container a = frame.getContentPane();
frame.setLayout(new FlowLayout());
a.add(button1);a.add(text);a.add(button2);
a.setBackground(Color.red);
frame.setVisible(true);
frame.setSize(300,300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public FlowLayoutGUI(){
initialization();
}
}