Hi friend,
I suggest you to refer following example of 'Box class', which will give you something idea about the use of this class:
Code:
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JTextField;
public class BoxDM
{
public static void main(String argsw[]) {
JFrame verticalFrame1 = new JFrame("Vertical");
verticalFrame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Box verticalBox1 = Box.createVerticalBox();
verticalBox1.add(new JLabel("Top"));
verticalBox1.add(new JTextField("Middle"));
verticalBox1.add(new JButton("Bottom"));
verticalFrame1.add(verticalBox, BorderLayout.CENTER);
verticalFrame1.setSize(250, 150);
verticalFrame1.setVisible(true);
}
}
Bookmarks