Closed objectDisorientedProgrammer closed 4 years ago
This change would also lend nicely to combining the edit/save button since they are mutually exclusive
EditWindow.java combine save/edit button
starting around line 258
// TODO consider combining the edit and save buttons as they are mutually exclusive.
// Combining would reduce the clutter within the edit window.
saveButton = new JButton("Save");
saveButton.setEnabled(false); // disable by default until user wants to edit
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(editable == true)
{
editable = !editable; // toggle edit status
setEditingEntry(editable); // disable editing
editButton.setEnabled(true); // enable clicking 'edit' again
saveButton.setEnabled(false); // disable saving
updateDataValues(); // save changes
}
}
});
// TODO consider combining the edit and save buttons as they are mutually exclusive.
// Combining would reduce the clutter within the edit window.
editButton = new JButton("Edit");
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(editable == false)
{
editable = !editable; // toggle edit status
setEditingEntry(editable); // enable editing
// editButton.setEnabled(false); // disable clicking 'edit' again
// saveButton.setEnabled(true); // allow saving
//frame.getContentPane().repaint(); // redraw the frame
editButton.setText("Save");
}
else
{
editable = !editable; // toggle edit status
setEditingEntry(editable); // disable editing
// editButton.setEnabled(true); // enable clicking 'edit' again
// saveButton.setEnabled(false); // disable saving
updateDataValues(); // save changes
editButton.setText("Edit");
}
}
});
Related to #1
Technically this change will allow me to remove the close button from the edit window as well (in favor of the user hitting the x at the window boarder).