Hi,
I need a label, a textfield and a button in 2 rows. I used flow layout for that. But after adding all components to the Jpanel which inherits JFrame, only 2nd row is displayed. Please help where am going wrong and I am very new to Java Swing.
Thanks in advance
What I have tried:
//This inherits JFrame
FlowLayout flowLayout=new FlowLayout();
JPanel pCfgFileControl=new JPanel();
pCfgFileControl.setLayout(flowLayout);
flowLayout.setAlignment(FlowLayout.TRAILING);
pCfgFileControl.add(new JButton("Button 1"));
pCfgFileControl.add(new JButton("Button 2"));
pCfgFileControl.add(new JButton("Button 3"));
pCfgFileControl.add(new JButton("Long-Named Button 4"));
pCfgFileControl.add(new JButton("5"));
pCfgFileControl.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
JPanel pLogFileControls = new JPanel();
pLogFileControls.setLayout(new FlowLayout());
pLogFileControls.add(new JButton("Button 1"));
pLogFileControls.add(new JButton("Button 2"));
pLogFileControls.add(new JButton("Button 3"));
pLogFileControls.add(new JButton("Long-Named Button 4"));
pLogFileControls.add(new JButton("5"));
add(pCfgFileControl, BorderLayout.NORTH);
add(pLogFileControls, BorderLayout.NORTH);