selectedValue = CANCEL;
setVisible(false);
}
});
ButtonBarBuilder builder = new ButtonBarBuilder();
builder.addGlue();
//buttons
JButton saveAnywayButton = new JButton("Save Anyway");
saveAnywayButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
selectedValue = SAVE_ANYWAY;
setVisible(false);
}
});
builder.addGridded(saveAnywayButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
selectedValue = CANCEL;
setVisible(false);
}
});
getRootPane().setDefaultButton(saveAnywayButton);
if (dialogType.equals(SaveErrorsDialog.EXIT_DIALOG)){
JButton exitWithoutSavingButton = new JButton("Exit Whithout Saving");
exitWithoutSavingButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
selectedValue = EXIT_WITHOUT_SAVING;
setVisible(false);
}
});
builder.addRelatedGap();
builder.addGridded(exitWithoutSavingButton);
builder.addRelatedGap();
builder.addGridded(cancelButton);
} else if (dialogType.equals(SaveErrorsDialog.CLOSE_DIALOG)){
JButton closeWithoutSavingButton = new JButton("Close Whithout Saving");
closeWithoutSavingButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
selectedValue = CLOSE_WITHOUT_SAVING;
setVisible(false);
}
});
builder.addRelatedGap();
builder.addGridded(closeWithoutSavingButton);
builder.addRelatedGap();
builder.addGridded(cancelButton);
} else if (dialogType.equals(SaveErrorsDialog.SAVE_DIALOG)){
builder.addRelatedGap();
builder.addGridded(cancelButton);
}
JPanel buttonPane = new JPanel();
buttonPane = builder.getPanel();
//Put everything together, using the content pane's BorderLayout.
Container contentPane = getContentPane();