Skip to content

Commit afa1d92

Browse files
authored
Merge pull request #5680 from IllianiCBT/datePicker_warning
Added Warning for Campaign Dates Before 2470
2 parents b08988a + 4cf3be1 commit afa1d92

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Diff for: MekHQ/resources/mekhq/resources/DateChooser.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ friday.text=Fri
3030
saturday.text=Sat
3131
sunday.text=Sun
3232
dayPicker.tooltip=Click on a day to choose it
33-
dateField.text=Click on the date to edit it
33+
dateField.text=<html><div style='text-align: center;'><b>Campaigns prior to 2470 are not supported.</b>\
34+
<br>\
35+
<br>Click on the date to edit it.</div></html>
3436
confirmDate.text=Confirm Date
3537

3638
# createEraButtons

Diff for: MekHQ/src/mekhq/gui/dialog/DateChooser.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private void initialize(Component owner, LocalDate date) {
200200
contentPane.add(dayGrid, BorderLayout.CENTER);
201201

202202
// Create the date label
203-
JLabel dateLabel = new JLabel(resources.getString("dateField.text"), JLabel.CENTER);
203+
JLabel dateLabel = new JLabel(String.format(resources.getString("dateField.text")));
204204

205205
// Set up the date input text field with the current campaign date.
206206
dateField = new JFormattedTextField(this.date);
@@ -566,10 +566,11 @@ public void keyReleased(KeyEvent event) {}
566566
*/
567567
private boolean updateDateFromDateField() {
568568
LocalDate newDate = parseDate(dateField.getText());
569+
569570
if (newDate == null) {
570-
JOptionPane.showMessageDialog(this,
571+
JOptionPane.showMessageDialog(null,
571572
"Invalid Date Format\nTry: yyyy-MM-dd", "Date Format",
572-
JOptionPane.WARNING_MESSAGE);
573+
JOptionPane.WARNING_MESSAGE);
573574
return false;
574575
}
575576

0 commit comments

Comments
 (0)