|
BorderFactory to set position?
Hi! I defined a BoxLayout JPanel because I need to show in this order:
a checkbox
a textfield
another checkbox
another texfield
and this works fine:
JPanel jPanelBoEx = new JPanel();
jPanelVars.add(jPanelBoEx, BorderLayout.LINE_START);
jPanelBoEx.setLayout(new BoxLayout(jPanelBoEx, BoxLayout.PAGE_AXIS));
jPanelBoEx.add(jchkbox1);
jPanelBoEx.add(jTextField1);
jPanelBoEx.add(jchkbox2);
jPanelBoEx.add(jTextField2);
But I need not to show them in the center, they must be shifted some position to the right so I use this:
jPanelBoEx.setBorder(BorderFactory.createEmptyBord er(0, 160, 0, 0));
To shift the four of them to the right, but I need the two labels to be more to the right than the 2 checkboxes..
How could I do that?
Thanks in advance.
|