Skip to content

Commit

Permalink
Add tooltips to restore buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
asvitkine committed Dec 27, 2021
1 parent 42eb46e commit e169754
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/impsave/InfoPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ public void setGameInfo(GameInfo info) {
BorderFactory.createEmptyBorder(2, 2, 2, 2)));
grid.setLayout(new GridLayout(5, 2));
JButton button = new JButton("- Autosave -");
button.setName(info.fileNamePrefix + "A.imp");
String targetFile = info.fileNamePrefix + "A.imp";
button.setName(targetFile);
button.setToolTipText("Restore to " + targetFile);
button.addActionListener(this);
grid.add(button);
grid.add(new JPanel());
Expand Down Expand Up @@ -204,12 +206,15 @@ public void itemStateChanged(ItemEvent unused) {
} else {
button.setText(getRestoreButtonNamePrefix(i) + saveDb.getSoloSaveGameName(i));
}
button.setName(saveDb.getFilename(info.fileNamePrefix, i));
String targetFile = saveDb.getFilename(info.fileNamePrefix, i);
button.setName(targetFile);
button.setToolTipText("Restore to " + targetFile);
i++;
} else {
button.setText(" Select for Restore ");
String targetFile = Utils.truncateAtChar(fileToRestore.getParentFile().getName(), ' ');
button.setName(targetFile);
button.setToolTipText("Restore to " + targetFile);
}
button.setEnabled(true);
}
Expand Down

0 comments on commit e169754

Please sign in to comment.