@@ -407,7 +407,7 @@ private void initComponents() {
407
407
miaBtns .add (miaCheck );
408
408
kiaCheck = new JCheckBox ("" );
409
409
kiaBtns .add (kiaCheck );
410
-
410
+
411
411
hitSlider = new JSlider (JSlider .HORIZONTAL , 0 , 5 , Math .min (status .getHits (),5 ));
412
412
hitSlider .setMajorTickSpacing (1 );
413
413
hitSlider .setPaintTicks (true );
@@ -418,9 +418,12 @@ private void initComponents() {
418
418
if (status .isMissing ()) {
419
419
miaCheck .setSelected (true );
420
420
}
421
+
422
+ kiaCheck .addItemListener (new CheckBoxKIAListener (hitSlider , miaCheck , null ));
421
423
if (status .isDead ()) {
422
424
kiaCheck .setSelected (true );
423
425
}
426
+
424
427
gridBagConstraints = new java .awt .GridBagConstraints ();
425
428
gridBagConstraints .gridx = 0 ;
426
429
gridBagConstraints .gridy = i ;
@@ -440,8 +443,6 @@ private void initComponents() {
440
443
gridBagConstraints .weightx = 1.0 ;
441
444
pnlPilotStatus .add (kiaCheck , gridBagConstraints );
442
445
i ++;
443
-
444
- kiaCheck .addItemListener (new CheckBoxKIAListener (hitSlider , miaCheck , null ));
445
446
}
446
447
pnlMain .add (pnlPilotStatus , PILOTPANEL );
447
448
@@ -480,7 +481,7 @@ private void initComponents() {
480
481
j ++;
481
482
prstatuses .add (status );
482
483
nameLbl = new JLabel ("<html>" + status .getName () + "<br><i> " + status .getUnitName () + "</i></html>" );
483
- miaCheck = new JCheckBox ( "" );
484
+
484
485
hitSlider = new JSlider (JSlider .HORIZONTAL , 0 , 5 , Math .min (status .getHits (),5 ));
485
486
hitSlider .setMajorTickSpacing (1 );
486
487
hitSlider .setPaintTicks (true );
@@ -492,7 +493,7 @@ private void initComponents() {
492
493
hitSlider .setEnabled (false );
493
494
}
494
495
pr_hitSliders .add (hitSlider );
495
- miaCheck . setSelected ( status . isMissing ());
496
+
496
497
gridBagConstraints = new java .awt .GridBagConstraints ();
497
498
gridBagConstraints .gridx = 0 ;
498
499
gridBagConstraints .gridy = i ;
@@ -522,9 +523,9 @@ private void initComponents() {
522
523
gridBagConstraints .weightx = 1.0 ;
523
524
pnlPrisonerStatus .add (btnViewPrisoner , gridBagConstraints );
524
525
i ++;
525
-
526
+
526
527
kiaCheck .addItemListener (new CheckBoxKIAListener (hitSlider , prisonerCheck , btnViewPrisoner ));
527
-
528
+
528
529
// if the person is dead, set the checkbox and skip all this captured stuff
529
530
if (status .getHits () > 5 || status .isDead ()) {
530
531
kiaCheck .setSelected (true );
@@ -1220,21 +1221,23 @@ private void finish() {
1220
1221
//now personnel
1221
1222
for (int i = 0 ; i < pstatuses .size (); i ++) {
1222
1223
PersonStatus status = pstatuses .get (i );
1223
- status .setMissing (miaBtns .get (i ).isSelected ());
1224
- status .setDead (kiaBtns .get (i ).isSelected ());
1224
+
1225
1225
if (hitSliders .get (i ).isEnabled ()) {
1226
1226
status .setHits (hitSliders .get (i ).getValue ());
1227
1227
}
1228
+ status .setMissing (miaBtns .get (i ).isSelected ());
1229
+ status .setDead (kiaBtns .get (i ).isSelected ());
1228
1230
}
1229
1231
1230
1232
//now prisoners
1231
1233
for (int i = 0 ; i < prstatuses .size (); i ++) {
1232
1234
PrisonerStatus status = prstatuses .get (i );
1233
- status . setDead ( prisonerKiaBtns . get ( i ). isSelected ());
1235
+
1234
1236
if (pr_hitSliders .get (i ).isEnabled ()) {
1235
1237
status .setHits (pr_hitSliders .get (i ).getValue ());
1236
1238
}
1237
1239
status .setCaptured (prisonerBtns .get (i ).isSelected ());
1240
+ status .setDead (prisonerKiaBtns .get (i ).isSelected ());
1238
1241
}
1239
1242
1240
1243
//now salvage
@@ -1354,7 +1357,10 @@ private void checkSalvageRights() {
1354
1357
}
1355
1358
1356
1359
for (JCheckBox box : salvageBoxes ) {
1357
- if (!box .isSelected () && currentSalvagePct >= maxSalvagePct ) {
1360
+
1361
+ if (!box .isSelected () && currentSalvagePct >= maxSalvagePct
1362
+ // always eligible with 100% salvage rights even when current == max
1363
+ && maxSalvagePct < 100 ) {
1358
1364
box .setEnabled (false );
1359
1365
} else {
1360
1366
box .setEnabled (true );
@@ -1561,26 +1567,26 @@ private class CheckBoxKIAListener implements ItemListener {
1561
1567
private JSlider slider ;
1562
1568
private JCheckBox checkbox ;
1563
1569
private JButton button ;
1564
-
1570
+
1565
1571
public CheckBoxKIAListener (JSlider slider , JCheckBox checkBox , JButton button ) {
1566
1572
this .slider = slider ;
1567
1573
this .checkbox = checkBox ;
1568
1574
this .button = button ;
1569
1575
}
1570
-
1576
+
1571
1577
@ Override
1572
1578
public void itemStateChanged (ItemEvent e ) {
1573
1579
JCheckBox kiaChk = (JCheckBox )e .getSource ();
1574
1580
boolean enable = !kiaChk .isSelected ();
1575
-
1581
+
1576
1582
if (slider != null ) {
1577
1583
slider .setEnabled (enable );
1578
1584
}
1579
-
1585
+
1580
1586
if (checkbox != null ) {
1581
1587
checkbox .setEnabled (enable );
1582
1588
}
1583
-
1589
+
1584
1590
if (button != null ) {
1585
1591
button .setEnabled (enable );
1586
1592
}
0 commit comments