I have some trouble with laying out a dialog's components.
Can anybody provide me with some source code?
Presently I try to layout the dialog with a BoxLayout. It should contain 5 rows. The rows should have a label describing the component on the right side of this label.
The first row should have a label and then a JComboBox should follow.
The following 4 rows should have a label and the a JTextField should follow.
The problem: The labels aren't at the same y-coordinate as the components right beneath!
Maybe there is a better LayoutManager to use. As I said before I use a BoxLayout. I have made a JPanel for the Labels and a JPanel for the components described by the JLabels. These JPanels use a GridLayout and then I have layed out these JPanels within the Boxes.
The Components which should be in the Dialog:
1. An Image and a text(JLabel) describing the use of the Dialog (both in one row).
2. A JSeparator
3. A JLabel and a JComboBox (both in one row)
4. 5 JLabels in one column and for each JLabel one JTextField right beside the JLabel. Only in the first row of these five a JComboBox should be rather than a JTextField!
The two last rows holding a JLabel and a JTextField each should be followed by another JLabel.
The JComboBox as well as the JTextFields should appaer at the same x-coordinate and they should not take the space left to the right side of the JDialog!
5. A JSeparator
6. Two JButtons (OK and Cancel)
I hope anyone can provide me with some source code to reach what I want. Maybe the BoxLayout shouldn't be taken in this case? (Of course, I don't want absolute coordinates for the components, it should be scalable!)