I added main panel and next add to button panel to it. According to check box , select and deselect I change button text. but one text not visible fully.
This is my lay out code.
public RestartTreatmentDialog()
{
final GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 0, 0 };
gridBagLayout.rowHeights = new int[] { 0, 0, 0 };
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
getContentPane().setLayout(gridBagLayout);
final GridBagConstraints gbc_panel = new GridBagConstraints();
gbc_panel.insets = new Insets(0, 0, 5, 0);
gbc_panel.fill = GridBagConstraints.BOTH;
gbc_panel.gridx = 0;
gbc_panel.gridy = 0;
getContentPane().add(getTopPanel(), gbc_panel);
final GridBagConstraints gbc_panel_1 = new GridBagConstraints();
gbc_panel_1.fill = GridBagConstraints.VERTICAL;
gbc_panel_1.gridx = 0;
gbc_panel_1.gridy = 1;
getContentPane().add(getButtonPanel(), gbc_panel_1);
}
This is button panel.
if (buttonPanel == null)
{
buttonPanel = new Panel();
final GridBagLayout gbl_buttonPanel = new GridBagLayout();
gbl_buttonPanel.columnWidths = new int[] { 0, 0, 0 };
gbl_buttonPanel.rowHeights = new int[] { 0, 0 };
gbl_buttonPanel.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
gbl_buttonPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
buttonPanel.setLayout(gbl_buttonPanel);
final GridBagConstraints gbc_button = new GridBagConstraints();
gbc_button.insets = new Insets(0, 0, 5, 5);
gbc_button.gridx = 0;
gbc_button.gridy = 0;
buttonPanel.add(getRestartButton(), gbc_button);
final GridBagConstraints gbc_button_1 = new GridBagConstraints();
gbc_button_1.insets = new Insets(0, 0, 5, 0);
gbc_button_1.gridx = 1;
gbc_button_1.gridy = 0;
buttonPanel.add(getCancelButton(), gbc_button_1);
}
some solution:
1) set a fix bigger size for your left button, so when you cange size you have no problem some code
2) cange button left to right and set the size like automatic some code