in src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java [187:254]
private JPanel buildDontWarnAndOKPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.weightx = 1.0;
c.anchor = GridBagConstraints.LINE_START;
dontwarnIfNoReceiver = new JCheckBox(" Always start Chainsaw with this configuration ");
panel.add(dontwarnIfNoReceiver, c);
saveButton = new JButton(" Save configuration as... ");
c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 1;
c.gridy = 0;
c.insets = new Insets(0, 0, 0, 10);
panel.add(saveButton, c);
okButton = new JButton(" OK ");
cancelButton = new JButton(" Cancel ");
List<JButton> okCancelButtons = SwingHelper.orderOKCancelButtons(okButton, cancelButton);
c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 2;
c.gridy = 0;
c.insets = new Insets(0, 0, 0, 10);
panel.add(okCancelButtons.get(0), c);
c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 3;
c.gridy = 0;
panel.add(okCancelButtons.get(1), c);
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
panelModel.setCancelled(true);
completionActionListener.actionPerformed(new ActionEvent(this, -1, "cancelled"));
}
});
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
panelModel.setCancelled(false);
if (logFileFormatComboBox.getSelectedItem() != null && !(logFileFormatComboBox.getSelectedItem().toString().trim().equals(""))) {
panelModel.setLogFormat(logFileFormatComboBox.getSelectedItem().toString());
}
completionActionListener.actionPerformed(new ActionEvent(this, -1, "ok"));
}
});
saveButton.addActionListener(e -> {
try {
URL url = browseFile("Choose a path and file name to save", false);
if (url != null) {
File file = new File(url.toURI());
panelModel.setSaveConfigFile(file);
}
} catch (Exception ex) {
logger.error(
"Error browsing for log file", ex);
}
});
return panel;
}