StevenZhang
asked on
How to change item position in a Dialog box.
There is dialog box which has two items as following:
AAA: AAA ComboBox
BBB: BBB ComboBox
I want to change it in the dialog as the following:
AAA: AAA ComboBox BBB: BBB ComboBox
Could you help me to reslove it? My codes is as following:
final PanelBean centerPanel = new PanelBean(new SpringLayout());
final LabelBean AAALabel = new LabelBean(AAA_TEXT);
AAALabel.setHorizontalAlig nment(Labe lBean.RIGH T);
centerPanel.add(AAALabel);
....
AAACombo = new PreferencableComboBoxBean( studentAAAStructs, AAA_STUDENT_ETC_COMBOBOX_P REF_KEY_ST RING, "0" );
final PanelBean AAAFlowPanel = new PanelBean( new FlowLayout(FlowLayout.LEFT , 0, 0) );
Dimension prefSize = AAACombo.getPreferredSize( );
AAACombo.setPreferredSize( new Dimension(185, prefSize.height) );
AAAFlowPanel.add( AAACombo );
centerPanel.add( AAAFlowPanel );
final LabelBean BBBLabel = new LabelBean(BBB_TEXT);
BBBLabel.setHorizontalAlig nment(Labe lBean.RIGH T);
centerPanel.add(BBBLabel);
.....
BBBCombo = new PreferencableComboBoxBean( BBBTypes, BBB_ETC_COMBOBOX_PREF_KEY_ STRING, "0" );
final PanelBean BBBFlowPanel = new PanelBean( new FlowLayout(FlowLayout.LEFT , 0, 0) );
Dimension BBBPrefSize = BBBCombo.getPreferredSize( );
BBBCombo.setPreferredSize( new Dimension(185, BBBPrefSize.height) );
BBBFlowPanel.add( BBBCombo );
centerPanel.add( BBBFlowPanel );
Thanks.
AAA: AAA ComboBox
BBB: BBB ComboBox
I want to change it in the dialog as the following:
AAA: AAA ComboBox BBB: BBB ComboBox
Could you help me to reslove it? My codes is as following:
final PanelBean centerPanel = new PanelBean(new SpringLayout());
final LabelBean AAALabel = new LabelBean(AAA_TEXT);
AAALabel.setHorizontalAlig
centerPanel.add(AAALabel);
....
AAACombo = new PreferencableComboBoxBean(
final PanelBean AAAFlowPanel = new PanelBean( new FlowLayout(FlowLayout.LEFT
Dimension prefSize = AAACombo.getPreferredSize(
AAACombo.setPreferredSize(
AAAFlowPanel.add( AAACombo );
centerPanel.add( AAAFlowPanel );
final LabelBean BBBLabel = new LabelBean(BBB_TEXT);
BBBLabel.setHorizontalAlig
centerPanel.add(BBBLabel);
.....
BBBCombo = new PreferencableComboBoxBean(
final PanelBean BBBFlowPanel = new PanelBean( new FlowLayout(FlowLayout.LEFT
Dimension BBBPrefSize = BBBCombo.getPreferredSize(
BBBCombo.setPreferredSize(
BBBFlowPanel.add( BBBCombo );
centerPanel.add( BBBFlowPanel );
Thanks.
ASKER
I used SpringLayout to resolve it by myself. Anyway, Thanks.
ASKER
The soultion is to re-arrange the panels, then adjust the parm of the following function.
SpringUtilities.makeCompac tGrid(cent erPanel, 2, 4,
5, 5,
5, 5);
Anyway, Thanks.
SpringUtilities.makeCompac
5, 5,
5, 5);
Anyway, Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
with 'glue' and 'struts' you can position those 6 components as fine as you want:
Box panel = Box.createHorizontalBox();
.......
panel.add(AAAlabel);
panel.add(Box.createHorizo
panel.add(AAAfield); // What ever that is ...
panel.add(Box.createHorizo
panel.add(AAAcomboBox);
panel.add(Box.createHorizo
.....
and so on.
;JOOP!