diff --git a/.gitignore b/.gitignore index a23cba54..e03e26ed 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,13 @@ fabric.properties # .idea/misc.xml # *.ipr +# Eclipse +/.metadata/ +.classpath +.project +.settings/ +/*/bin + ### Gradle ### .gradle diff --git a/Data/Equipment/ammunition.json b/Data/Equipment/ammunition.json index e650fd6b..6db49066 100644 --- a/Data/Equipment/ammunition.json +++ b/Data/Equipment/ammunition.json @@ -8935,7 +8935,7 @@ "ActualName": "Ammo: Fluid Gun (Coolant)", "CritName": "@ Fluid Gun (Coolant)", "LookupName": "@ Fluid Gun (Coolant)", - "MegaMekName": "FluidGunCoolantAmmo", + "MegaMekName": "ISFluidGun Ammo", "BookRef": "Tactical Operations", "Tonnage": 1.0, "Cost": 3000.0, @@ -9012,7 +9012,7 @@ "ActualName": "Ammo: Fluid Gun (Corrosive)", "CritName": "@ Fluid Gun (Corrosive)", "LookupName": "@ Fluid Gun (Corrosive)", - "MegaMekName": "FluidGunCorrosiveAmmo", + "MegaMekName": "ISFluidGun Ammo", "BookRef": "Tactical Operations", "Tonnage": 1.0, "Cost": 5000.0, @@ -9089,7 +9089,7 @@ "ActualName": "Ammo: Fluid Gun (Flame Retardant Foam)", "CritName": "@ Fluid Gun (Flm Rtrdnt)", "LookupName": "@ Fluid Gun (Flame Retardant Foam)", - "MegaMekName": "FluidGunFoamAmmo", + "MegaMekName": "ISFluidGun Ammo", "BookRef": "Tactical Operations", "Tonnage": 1.0, "Cost": 1000.0, @@ -9166,7 +9166,7 @@ "ActualName": "Ammo: Fluid Gun (Inferno Fuel)", "CritName": "@ Fluid Gun (Inferno Fuel)", "LookupName": "@ Fluid Gun (Inferno Fuel)", - "MegaMekName": "FluidGunInfernoFuelAmmo", + "MegaMekName": "ISFluidGun Ammo", "BookRef": "Tactical Operations", "Tonnage": 1.0, "Cost": 2000.0, @@ -9243,7 +9243,7 @@ "ActualName": "Ammo: Fluid Gun (Oil Slick)", "CritName": "@ Fluid Gun (Oil Slick)", "LookupName": "@ Fluid Gun (Oil Slick)", - "MegaMekName": "FluidGunOilSlickAmmo", + "MegaMekName": "ISFluidGun Ammo", "BookRef": "Tactical Operations", "Tonnage": 1.0, "Cost": 2000.0, @@ -9320,7 +9320,7 @@ "ActualName": "Ammo: Fluid Gun (Paint/Obscurant)", "CritName": "@ Fluid Gun (Pnt/Obscrnt)", "LookupName": "@ Fluid Gun (Paint/Obscurant)", - "MegaMekName": "FluidGunPaintAmmo", + "MegaMekName": "ISFluidGun Ammo", "BookRef": "Tactical Operations", "Tonnage": 1.0, "Cost": 1000.0, @@ -9397,7 +9397,7 @@ "ActualName": "Ammo: Fluid Gun (Water)", "CritName": "@ Fluid Gun (Water)", "LookupName": "@ Fluid Gun (Water)", - "MegaMekName": "FluidGunWaterAmmo", + "MegaMekName": "ISFluidGun Ammo", "BookRef": "Tactical Operations", "Tonnage": 1.0, "Cost": 500.0, diff --git a/Data/Equipment/equipment.json b/Data/Equipment/equipment.json index b08f7cab..ff6df25c 100644 --- a/Data/Equipment/equipment.json +++ b/Data/Equipment/equipment.json @@ -606,7 +606,7 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresFusion": false, + "RequiresFusion": false, "RequiresNuclear": false, "RequiresPowerAmps": true, "Availability": { @@ -703,7 +703,7 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresFusion": false, + "RequiresFusion": false, "RequiresNuclear": false, "RequiresPowerAmps": true, "Availability": { @@ -800,9 +800,8 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresFusion": false, + "RequiresFusion": false, "RequiresNuclear": false, - "RequiresPowerAmps": true, "Availability": { "IS_SL": "E", "IS_SW": "F", @@ -898,9 +897,8 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresFusion": false, + "RequiresFusion": false, "RequiresNuclear": false, - "RequiresPowerAmps": true, "Availability": { "IS_SL": "F", "IS_SW": "X", @@ -1533,9 +1531,9 @@ "Exclusions": [ "C3 Computer (Master)", "C3 Computer (Slave)", - "C3 Boosted Computer (Master)", - "C3 Boosted Computer (Slave)", - "C3 Emergency Master", + "C3 Boosted Computer (Master)", + "C3 Boosted Computer (Slave)", + "C3 Emergency Master", "Null Signature System", "Void Signature System" ] @@ -2448,7 +2446,7 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresFusion": true, + "RequiresFusion": true, "RequiresNuclear": false, "RequiresPowerAmps": true, "Availability": { @@ -3361,7 +3359,7 @@ }, "BattleForceAbilities": [ "WAT", - "ECM" + "ECM" ] }, "Bridgelayer, Light": { @@ -4032,100 +4030,6 @@ "-" ] }, - "Lift Hoist": { - "ActualName": "Lift Hoist", - "CritName": "Lift Hoist", - "Type": "IE", - "LookupName": "Lift Hoist", - "MegaMekName": "LiftHoist", - "BookReference": "Tech Manual", - "ChatName": "LftHst", - "Specials": "-", - "Crits": 3, - "CVSpace": 1, - "LotSize": 0, - "AmmoIndex": 0, - "ShtRange": 0, - "MedRange": 0, - "LngRange": 0, - "Heat": 0, - "MaxAllowed": 2, - "Tonnage": 3.0, - "Cost": 50000.0, - "OffBV": 0.0, - "DefBV": 0.0, - "MinTons": 0.0, - "MaxTons": 0.0, - "VariableIncrement": 0.0, - "TonsPerCrit": 0.0, - "CostPerTon": 0.0, - "HasAmmo": false, - "alloc_head": false, - "alloc_ct": false, - "alloc_torsos": true, - "alloc_arms": true, - "alloc_legs": false, - "alloc_front": true, - "alloc_sides": true, - "alloc_rear": true, - "alloc_turret": true, - "alloc_body": false, - "CanSplit": false, - "CanMountRear": true, - "Explosive": false, - "VariableSize": false, - "RequiresQuad": false, - "Availability": { - "IS_SL": "A", - "IS_SW": "A", - "IS_CI": "A", - "IS_DA": "A", - "IS_TechRating": "A", - "CL_SL": "X", - "CL_SW": "A", - "CL_CI": "A", - "CL_DA": "A", - "CL_TechRating": "A", - "IS_RandDStartDate": 0, - "IS_PrototypeDate": 0, - "IS_IntroDate": 1950, - "IS_ExtinctDate": 0, - "IS_ReIntroDate": 0, - "CL_RandDStartDate": 0, - "CL_PrototypeDate": 0, - "CL_IntroDate": 1950, - "CL_ExtinctDate": 0, - "CL_ReIntroDate": 0, - "RulesLevelBM": 1, - "RulesLevelIM": 1, - "RulesLevelCV": 1, - "RulesLevelAF": -1, - "RulesLevelCF": -1, - "TechBase": 2, - "IS_IntroFaction": "PS", - "IS_ReIntroFaction": "--", - "IS_RandDFaction": "--", - "IS_PrototypeFaction": "--", - "CL_IntroFaction": "PS", - "CL_ReIntroFaction": "--", - "CL_RandDFaction": "--", - "CL_PrototypeFaction": "--", - "IS_WentExtinct": false, - "IS_ReIntroduced": false, - "IS_IsPrototype": false, - "CL_WentExtinct": false, - "CL_ReIntroduced": false, - "CL_IsPrototype": false, - "PBMAllowed": true, - "PIMAllowed": true, - "PrimitiveOnly": false, - "SuperHeavyCompatible": true, - "SuperHeavyOnly": false - }, - "BattleForceAbilities": [ - "-" - ] - }, "Nail Gun": { "ActualName": "Nail Gun", "CritName": "Nail Gun", @@ -4351,7 +4255,7 @@ "alloc_sides": true, "alloc_rear": true, "alloc_turret": true, - "alloc_body": false, + "alloc_body": true, "CanSplit": false, "CanMountRear": true, "Explosive": false, @@ -5071,7 +4975,7 @@ "CritName": "Cargo, Liquid", "Type": "IE", "LookupName": "Cargo, Liquid", - "MegaMekName": "CargoLiquid", + "MegaMekName": "Liquid Storage", "BookReference": "Tech Manual", "ChatName": "LqdCrgo", "Specials": "-", @@ -6425,7 +6329,7 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresFusion": true, + "RequiresFusion": true, "RequiresNuclear": false, "RequiresPowerAmps": true, "Availability": { @@ -6477,9 +6381,9 @@ }, "BattleForceAbilities": [ "NOVA", - "PRB", - "RCN", - "ECM" + "PRB", + "RCN", + "ECM" ] }, "Centurion Weapon System": { @@ -6525,6 +6429,7 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, + "RequiresPowerAmps": true, "Availability": { "IS_SL": "F", "IS_SW": "F", @@ -6858,6 +6763,100 @@ "-" ] }, + "Combat Vehicle Escape Pod": { + "ActualName": "Combat Vehicle Escape Pod", + "CritName": "Combat Vehicle Escape Pod", + "Type": "PE", + "LookupName": "Combat Vehicle Escape Pod", + "MegaMekName": "ISCombatVehicleEscapePod", + "BookReference": "TO:AU&E", + "ChatName": "CVEP", + "Specials": "OS", + "Crits": 1, + "CVSpace": 1, + "LotSize": 0, + "AmmoIndex": 0, + "ShtRange": 0, + "MedRange": 0, + "LngRange": 0, + "Heat": 0, + "MaxAllowed": 1, + "Tonnage": 4.0, + "Cost": 10000.0, + "OffBV": 0.0, + "DefBV": 0.0, + "MinTons": 0.0, + "MaxTons": 0.0, + "VariableIncrement": 0.0, + "TonsPerCrit": 0.0, + "CostPerTon": 0.0, + "HasAmmo": false, + "alloc_head": false, + "alloc_ct": false, + "alloc_torsos": false, + "alloc_arms": false, + "alloc_legs": false, + "alloc_front": false, + "alloc_sides": false, + "alloc_rear": true, + "alloc_turret": false, + "alloc_body": false, + "CanSplit": false, + "CanMountRear": false, + "Explosive": false, + "VariableSize": false, + "RequiresQuad": false, + "Availability": { + "IS_SL": "X", + "IS_SW": "X", + "IS_CI": "E", + "IS_DA": "E", + "IS_TechRating": "D", + "CL_SL": "X", + "CL_SW": "X", + "CL_CI": "X", + "CL_DA": "X", + "CL_TechRating": "X", + "IS_RandDStartDate": 3032, + "IS_PrototypeDate": 3038, + "IS_IntroDate": 3079, + "IS_ExtinctDate": 0, + "IS_ReIntroDate": 0, + "CL_RandDStartDate": 0, + "CL_PrototypeDate": 0, + "CL_IntroDate": 0, + "CL_ExtinctDate": 0, + "CL_ReIntroDate": 0, + "RulesLevelBM": -1, + "RulesLevelIM": -1, + "RulesLevelCV": 3, + "RulesLevelAF": -1, + "RulesLevelCF": -1, + "TechBase": 0, + "IS_IntroFaction": "LC", + "IS_ReIntroFaction": "--", + "IS_RandDFaction": "FC", + "IS_PrototypeFaction": "FC", + "CL_IntroFaction": "--", + "CL_ReIntroFaction": "--", + "CL_RandDFaction": "--", + "CL_PrototypeFaction": "--", + "IS_WentExtinct": false, + "IS_ReIntroduced": false, + "IS_IsPrototype": false, + "CL_WentExtinct": false, + "CL_ReIntroduced": false, + "CL_IsPrototype": false, + "PBMAllowed": false, + "PIMAllowed": false, + "PrimitiveOnly": false, + "SuperHeavyCompatible": true, + "SuperHeavyOnly": false + }, + "BattleForceAbilities": [ + "ES" + ] + }, "Paramedic Equipment": { "ActualName": "Paramedic Equipment", "CritName": "Paramedic", @@ -7277,7 +7276,6 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresPowerAmps": true, "Availability": { "IS_SL": "X", "IS_SW": "X", @@ -7328,7 +7326,7 @@ "BattleForceAbilities": [ "DJ" ], - "Exclusions": [ + "Exclusions": [ "RISC Viral Jammer (Homing)" ] }, @@ -7375,7 +7373,6 @@ "Explosive": false, "VariableSize": false, "RequiresQuad": false, - "RequiresPowerAmps": true, "Availability": { "IS_SL": "X", "IS_SW": "X", @@ -7426,7 +7423,7 @@ "BattleForceAbilities": [ "HJ" ], - "Exclusions": [ + "Exclusions": [ "RISC Viral Jammer (Decoy)" ] }, diff --git a/Data/Equipment/physicals.json b/Data/Equipment/physicals.json index 0e8bc089..ce02ee5a 100644 --- a/Data/Equipment/physicals.json +++ b/Data/Equipment/physicals.json @@ -38,7 +38,7 @@ "Alloc_Legs": false, "CanSplit": false, "PowerAmps": false, - "TripleStrengthMyomerAffectsBV": true, + "TripleStrengthMyomerAffectsBV": true, "Availability": { "IS_SL": "X", "IS_SW": "F", @@ -122,7 +122,7 @@ "ReplacesHand": false, "RequiresLowerArm": true, "ReplacesLowerArm": false, - "TripleStrengthMyomerAffectsBV": true, + "TripleStrengthMyomerAffectsBV": true, "Alloc_HD": false, "Alloc_CT": false, "Alloc_Torso": false, @@ -213,7 +213,7 @@ "ReplacesHand": false, "RequiresLowerArm": true, "ReplacesLowerArm": false, - "TripleStrengthMyomerAffectsBV": true, + "TripleStrengthMyomerAffectsBV": true, "Alloc_HD": false, "Alloc_CT": false, "Alloc_Torso": false, @@ -395,7 +395,7 @@ "ReplacesHand": true, "RequiresLowerArm": true, "ReplacesLowerArm": false, - "TripleStrengthMyomerAffectsBV": true, + "TripleStrengthMyomerAffectsBV": true, "Alloc_HD": false, "Alloc_CT": false, "Alloc_Torso": false, @@ -576,7 +576,7 @@ "ReplacesHand": false, "RequiresLowerArm": true, "ReplacesLowerArm": false, - "TripleStrengthMyomerAffectsBV": true, + "TripleStrengthMyomerAffectsBV": true, "Alloc_HD": false, "Alloc_CT": false, "Alloc_Torso": false, @@ -674,7 +674,7 @@ "Alloc_Legs": false, "CanSplit": false, "PowerAmps": false, - "TripleStrengthMyomerAffectsBV": true, + "TripleStrengthMyomerAffectsBV": true, "Availability": { "IS_SL": "X", "IS_SW": "X", @@ -1755,7 +1755,7 @@ "Heavy Duty Pile-Driver": { "ActualName": "Heavy Duty Pile-Driver", "CritName": "Heavy Duty Pile-Driver", - "MegaMekName": "HeavyDutyPile-Driver", + "MegaMekName": "Pile Driver", "LookupName": "Heavy Duty Pile-Driver", "ChatName": "HDPD", "Type": "PA", @@ -2127,7 +2127,7 @@ "ToHitLong": 0, "DamageAdd": 5, "CritAdd": 1, - "PWClass": 5, + "PWClass": 4, "TonMult": 0.0, "CritMult": 0.0, "TonAdd": 2.0, diff --git a/Data/Equipment/quirks.json b/Data/Equipment/quirks.json index 4895c6ec..41b1cf3e 100644 --- a/Data/Equipment/quirks.json +++ b/Data/Equipment/quirks.json @@ -1,4 +1,40 @@ { + "Accurate Weapon": { + "name": "Accurate Weapon", + "cost": 1, + "description": "Being of exceptional design, a weapon or bay is more accurate than normal, and receives a –1 Target Number modifier. The cost is 1 point per 5 points (or fraction thereof) of maximum damage the weapon or bay can inflict in a single Damage Value grouping. More than one weapon or bay on a unit can receive this positive quirk, but the cost for each must be paid. If the “weapon” deals 0 damage (such as TAG), the cost is 2 points.", + "positive": true, + "battlemech": true, + "industrialmech": true, + "combatvehicle": true, + "battlearmor": true, + "aerospacefighter": true, + "conventionalfighter": true, + "dropship": true, + "jumpship": false, + "warship": true, + "spacestation": true, + "protomech": true, + "isvariable": true + }, + "Anti-Aircraft Targeting": { + "name": "Anti-Aircraft Targeting", + "cost": 1, + "description": "Some 'Mechs, like the Rifleman, have an advanced targeting system that can accurately target airborne units. This includes 'Mechs performing a combat drop (see p. 20, SO), but not jumping 'Mechs. All attacks against such units while airborne (not grounded) receive a –2 Target Number modifier. The cost is 1 point per 7 points (or fraction thereof ) of maximum damage that all the weapons mounted on the 'Mech can inflict (excluding physical attack weapons). This bonus is only available when the 'Mech itself is on the ground.", + "positive": true, + "battlemech": true, + "industrialmech": true, + "combatvehicle": true, + "battlearmor": false, + "aerospacefighter": false, + "conventionalfighter": false, + "dropship": false, + "jumpship": false, + "warship": false, + "spacestation": false, + "protomech": false, + "isvariable": true + }, "Atmospheric Flyer": { "name": "Atmospheric Flyer", "cost": 3, @@ -56,7 +92,7 @@ "Battlefists": { "name": "Battlefists", "cost": 2, - "description": "The Battlefists quirk applies only to ’Mechs that are equipped with hand actuators. This quirk reflects ’Mechs that feature hands which are better designed for melee combat as a consequence of their unique configuration (such as the Awesome’s mace-like fist, or the Pillager’s sharpened “knuckles”). This quirk is only paid for once, even if the ’Mech has two fists. If the ’Mech has two hands, and this quirk is only meant to apply to one of those hands, this must be specified (the cost remains the same). A ’Mech with Battlefists receives a –1 Target Number modifier when making Punch attacks.", + "description": "The Battlefists quirk applies only to 'Mechs that are equipped with hand actuators. This quirk reflects 'Mechs that feature hands which are better designed for melee combat as a consequence of their unique configuration (such as the Awesome's mace-like fist, or the Pillager's sharpened “knuckles”). This quirk is only paid for once, even if the 'Mech has two fists. If the 'Mech has two hands, and this quirk is only meant to apply to one of those hands, this must be specified (the cost remains the same). A 'Mech with Battlefists receives a –1 Target Number modifier when making Punch attacks.", "positive": true, "battlemech": true, "industrialmech": true, @@ -107,10 +143,10 @@ "protomech": false, "isvariable": false }, - "Compact ‘Mech": { - "name": "Compact ‘Mech", + "Compact 'Mech": { + "name": "Compact 'Mech", "cost": 1, - "description": "This Quirk describes a ’Mech that is particularly slim in stature, such as the Jackalope. It enables the ’Mech to share a BattleMech cubicle with another Compact ’Mech. It also allows a ’Mech recovery vehicle to transport two Compact ’Mechs. In both cases, the combined tonnage of the two ’Mechs cannot exceed relevant tonnage limits. The Compact ’Mech quirk only provides this bonus for transportation purposes Compact ’Mechs cannot share the same space at the same time when undergoing maintenance or repairs. This quirk can only be applied to ’Mechs that also possess the Narrow/Low Profile quirk, and is further limited to ’Mechs of medium weight (55 tons) or less.", + "description": "This Quirk describes a 'Mech that is particularly slim in stature, such as the Jackalope. It enables the 'Mech to share a BattleMech cubicle with another Compact 'Mech. It also allows a 'Mech recovery vehicle to transport two Compact 'Mechs. In both cases, the combined tonnage of the two 'Mechs cannot exceed relevant tonnage limits. The Compact 'Mech quirk only provides this bonus for transportation purposes Compact 'Mechs cannot share the same space at the same time when undergoing maintenance or repairs. This quirk can only be applied to 'Mechs that also possess the Narrow/Low Profile quirk, and is further limited to 'Mechs of medium weight (55 tons) or less.", "positive": true, "battlemech": true, "industrialmech": true, @@ -146,7 +182,7 @@ "Directional Torso Mount": { "name": "Directional Torso Mount", "cost": 2, - "description": "A well-known feature of the original Goliath, a Directional Torso Mount acts as a somewhat more restrictive BattleMech shoulder turret, allowing any weapons in the mount to shoot in either the front arc or the rear arc, depending on the mount’s current facing. The mount’s facing is set at the start of the game, and can be changed at the same time torso twists are made. However, unlike a torso twist, it does not reset at each End Phase: the arc chosen remains until deliberately changed. The mount rotates with any torso twist as normal. Each time a location with a Directional Torso Mount takes a hit (Front or Rear), the player must roll 2D6. A result of 9+ means the mount is destroyed and its weapon locked in its current arc, in addition to the normal effects of the attack. The 3-point version of this quirk is available only to quad ’Mechs. In this case, the mount operates as a full turret, capable of rotating a full 360 degrees. No weapon with location placement restrictions (such as a heavy Gauss rifle) can be placed in a Directional Torso Mount", + "description": "A well-known feature of the original Goliath, a Directional Torso Mount acts as a somewhat more restrictive BattleMech shoulder turret, allowing any weapons in the mount to shoot in either the front arc or the rear arc, depending on the mount's current facing. The mount's facing is set at the start of the game, and can be changed at the same time torso twists are made. However, unlike a torso twist, it does not reset at each End Phase: the arc chosen remains until deliberately changed. The mount rotates with any torso twist as normal. Each time a location with a Directional Torso Mount takes a hit (Front or Rear), the player must roll 2D6. A result of 9+ means the mount is destroyed and its weapon locked in its current arc, in addition to the normal effects of the attack. No weapon with location placement restrictions (such as a heavy Gauss rifle) can be placed in a Directional Torso Mount", "positive": true, "battlemech": true, "industrialmech": true, @@ -159,7 +195,25 @@ "warship": false, "spacestation": false, "protomech": false, - "isvariable": true + "isvariable": false + }, + "Directional Torso Mount, Quad": { + "name": "Directional Torso Mount, Quad", + "cost": 3, + "description": "The 3-point version of the Directional Torso Mount quirk is available only to quad 'Mechs. In this case, the mount operates as a full turret, capable of rotating a full 360 degrees. Each time a location with a Directional Torso Mount takes a hit (Front or Rear), the player must roll 2D6. A result of 9+ means the mount is destroyed and its weapon locked in its current arc, in addition to the normal effects of the attack. No weapon with location placement restrictions (such as a heavy Gauss rifle) can be placed in a Directional Torso Mount", + "positive": true, + "battlemech": true, + "industrialmech": true, + "combatvehicle": false, + "battlearmor": false, + "aerospacefighter": false, + "conventionalfighter": false, + "dropship": false, + "jumpship": false, + "warship": false, + "spacestation": false, + "protomech": false, + "isvariable": false }, "Distracting": { "name": "Distracting", @@ -236,7 +290,7 @@ "Extended Torso Twist": { "name": "Extended Torso Twist", "cost": 3, - "description": "When torso twisting, the `Mech can change its facing by one or two hexsides. Quad ’Mechs normally cannot torso twist at all. However, a quad ’Mech with this quirk can perform a normal (not extended) torso twist.", + "description": "When torso twisting, the `Mech can change its facing by one or two hexsides. Quad 'Mechs normally cannot torso twist at all. However, a quad 'Mech with this quirk can perform a normal (not extended) torso twist.", "positive": true, "battlemech": true, "industrialmech": true, @@ -254,7 +308,7 @@ "Fine Manipulators": { "name": "Fine Manipulators", "cost": 0, - "description": "Though ’Mechs generally rely on hand actuators for any manual work, some units, such as the Jupiter, feature manipulators otherwise more commonly found on vehicles for delicate work. A ’Mech with this quirk may mount up to one Manipulator (see TM, p. 245) in each side torso and/or arm location. These do not follow the normal construction rules and are weight free the exact number must be specified.", + "description": "Though 'Mechs generally rely on hand actuators for any manual work, some units, such as the Jupiter, feature manipulators otherwise more commonly found on vehicles for delicate work. A 'Mech with this quirk may mount up to one Manipulator (see TM, p. 245) in each side torso and/or arm location. These do not follow the normal construction rules and are weight free the exact number must be specified.", "positive": true, "battlemech": true, "industrialmech": true, @@ -290,7 +344,7 @@ "Good Reputation": { "name": "Good Reputation", "cost": 0, - "description": "Whether due to clever marketing, use by an iconic MechWarrior, or proven capabilities, some ’Mechs are extremely popular. Such ’Mechs are worth a premium on the open market, as buyer demand means that acquiring one at its base price is almost impossible. For each level of this quirk, the ’Mech is worth 10% more C-bills than normal. This quirk is not worth points because it is not, strictly speaking, a bonus to the ’Mech. Note that in some eras and/or locations, such as during the late Third Succession War period, ’Mechs as a whole are so rare that all may be considered to have the 1 point version of this quirk. Furthermore, this quirk is not applicable to Clan machines, as the Clans do not really have a secondary ’Mech market and Inner Sphere customers will gladly pay inflated prices to acquire Clan ’Mechs regardless of their reputation.", + "description": "Whether due to clever marketing, use by an iconic MechWarrior, or proven capabilities, some 'Mechs are extremely popular. Such 'Mechs are worth a premium on the open market, as buyer demand means that acquiring one at its base price is almost impossible. For each level of this quirk, the 'Mech is worth 10% more C-bills than normal. This quirk is not worth points because it is not, strictly speaking, a bonus to the 'Mech. Note that in some eras and/or locations, such as during the late Third Succession War period, 'Mechs as a whole are so rare that all may be considered to have the 1 point version of this quirk. Furthermore, this quirk is not applicable to Clan machines, as the Clans do not really have a secondary 'Mech market and Inner Sphere customers will gladly pay inflated prices to acquire Clan 'Mechs regardless of their reputation.", "positive": true, "battlemech": true, "industrialmech": true, @@ -522,8 +576,8 @@ }, "Narrow/Low Profile": { "name": "Narrow/Low Profile", - "cost": 2, - "description": "If the Margin of Success for a weapon attack made against a Narrow/low profile Unit is 0 or 1, the hit is considered a Glancing Blow.", + "cost": 3, + "description": "If the Margin of Success for a weapon attack made against a Narrow/low profile Unit is 0 or 1, the hit is considered a Glancing Blow. A glancing blow inflicts half the normal damage (rounded down); for weapons that roll on the Cluster Hits Table, instead apply a –4 modifier to the Cluster roll result (with a minimum result of 2). Additionally, apply a –2 modifier when rolling on the Determining Critical Hits Table any time a glancing blow yields the possibility of a critical hit; if using the Advanced Determining Critical Hits rule (see p. 83, TO:AR), apply a –4 modifier instead. This quirk has no effect versus non-weapon attacks, such as falls or physical attacks. It also has no effect versus all-or-nothing weapon attacks, such as Streak missile launchers. If using the Linking Weapons rule (see p. 83, TO:AR), the entire linked group is considered a glancing blow. If also using the Glancing Blow rule (see p. 78, TO:AR), the effects stack (1/4 damage is dealt). Any subtractive damage reduction effects (such as ferro-lamellor armor) are applied after all other damage reduction effects.", "positive": true, "battlemech": true, "industrialmech": true, @@ -541,7 +595,7 @@ "Nimble Jumper": { "name": "Nimble Jumper", "cost": 3, - "description": "Jump jets are brute-force thrusters designed only to transport a ’Mech directly from point A to point B. Some ’Mechs, however, such as the Spider, are especially nimble when jumping. When a ’Mech with this quirk jumps, it need not follow the most direct path to its target hex. Instead, it may deviate from that path by up to one hex of its controller’s choice (assuming the ’Mech has the Jumping MP required, of course additional heat for such a jump is generated as normal for the jump jet type in use). For example, a jump that would normally cover six hexes can instead cover up to seven. If a ’Mech jumps in this fashion, attacks against the ’Mech receive an additional +1 Target Movement Modifier (a total of +2 for jumping, instead of the normal +1 the extra hex traveled is also factored into the ’Mech’s Target Movement Modifier, as normal). However, attacks made by the jumping ’Mech receive the same additional Target Number modifier (a total of +4 for jumping, instead of +3). This quirk can only be taken by light or medium ’Mechs, and only for those that have at least as many Jumping MP as they do Walking MP", + "description": "Jump jets are brute-force thrusters designed only to transport a 'Mech directly from point A to point B. Some 'Mechs, however, such as the Spider, are especially nimble when jumping. When a 'Mech with this quirk jumps, it need not follow the most direct path to its target hex. Instead, it may deviate from that path by up to one hex of its controller's choice (assuming the 'Mech has the Jumping MP required, of course additional heat for such a jump is generated as normal for the jump jet type in use). For example, a jump that would normally cover six hexes can instead cover up to seven. If a 'Mech jumps in this fashion, attacks against the 'Mech receive an additional +1 Target Movement Modifier (a total of +2 for jumping, instead of the normal +1 the extra hex traveled is also factored into the 'Mech's Target Movement Modifier, as normal). However, attacks made by the jumping 'Mech receive the same additional Target Number modifier (a total of +4 for jumping, instead of +3). This quirk can only be taken by light or medium 'Mechs, and only for those that have at least as many Jumping MP as they do Walking MP", "positive": true, "battlemech": true, "industrialmech": true, @@ -559,7 +613,7 @@ "Overhead Arms": { "name": "Overhead Arms", "cost": 2, - "description": "’Mechs equipped with overhead arms—such as the Fire Moth—can deliver ranged, direct-fire attacks while hiding almost completely from view. This quirk cannot be combined with the Low-Mounted Arms quirk, nor can it be taken by any ’Mech that either does not have arms, or lacks any form of direct-fire ranged weaponry in said arms. If standing, a ’Mech with Overhead Arms behind an adjacent Level 2 hill or building can fire its arm-mounted direct-fire weapons over it. Such attacks receive a +2 Target Number modifier. Friendly spotters cannot assist with this type of attack. However, a ’Mech with Overhead Arms is always exposed to return fire in these circumstances: it can still be attacked despite being behind Level 2 terrain. Apply a +2 Target Number modifier to any attacks that pass through such covering terrain, in addition to the normal +1 partial cover modifier. In this case, only arm hits actually strike the target: all other hits strike the covering terrain instead. This form of partial cover is not negated by the attacker being any number of levels higher than the defender", + "description": "'Mechs equipped with overhead arms—such as the Fire Moth—can deliver ranged, direct-fire attacks while hiding almost completely from view. This quirk cannot be combined with the Low-Mounted Arms quirk, nor can it be taken by any 'Mech that either does not have arms, or lacks any form of direct-fire ranged weaponry in said arms. If standing, a 'Mech with Overhead Arms behind an adjacent Level 2 hill or building can fire its arm-mounted direct-fire weapons over it. Such attacks receive a +2 Target Number modifier. Friendly spotters cannot assist with this type of attack. However, a 'Mech with Overhead Arms is always exposed to return fire in these circumstances: it can still be attacked despite being behind Level 2 terrain. Apply a +2 Target Number modifier to any attacks that pass through such covering terrain, in addition to the normal +1 partial cover modifier. In this case, only arm hits actually strike the target: all other hits strike the covering terrain instead. This form of partial cover is not negated by the attacker being any number of levels higher than the defender", "positive": true, "battlemech": true, "industrialmech": true, @@ -613,7 +667,7 @@ "Rugged": { "name": "Rugged", "cost": 1, - "description": "Some ’Mechs are extremely reliable, reducing the frequency with which they require maintenance. The cost is 1 point if the ‘Mech can go for two times as long between maintenance periods as normal, and 2 points if it can go up to three times as long.", + "description": "Some 'Mechs are extremely reliable, reducing the frequency with which they require maintenance. The cost is 1 point if the ‘Mech can go for two times as long between maintenance periods as normal, and 2 points if it can go up to three times as long.", "positive": true, "battlemech": true, "industrialmech": true, @@ -684,8 +738,8 @@ }, "Stabilized Weapon": { "name": "Stabilized Weapon", - "cost": 0, - "description": "Some weapons, such as the center torso and head lasers of the Mongoose, are better cushioned against or otherwise compensated for the increased inaccuracy caused by moving at high speeds. If the ’Mech runs, all Target Numbers for that weapon receive a –1 modifier. The cost is 1 point per 7 points (or fraction thereof) of maximum damage the weapon can inflict in a single Damage Value grouping. If the “weapon” deals 0 damage (such as TAG), the cost is 1 point. More than one weapon can receive this positive quirk, but the cost for each must be paid.", + "cost": 1, + "description": "Some weapons, such as the center torso and head lasers of the Mongoose, are better cushioned against or otherwise compensated for the increased inaccuracy caused by moving at high speeds. If the 'Mech runs, all Target Numbers for that weapon receive a –1 modifier. The cost is 1 point per 7 points (or fraction thereof) of maximum damage the weapon can inflict in a single Damage Value grouping. If the “weapon” deals 0 damage (such as TAG), the cost is 1 point. More than one weapon can receive this positive quirk, but the cost for each must be paid.", "positive": true, "battlemech": true, "industrialmech": true, @@ -721,7 +775,7 @@ "Ubiquitous": { "name": "Ubiquitous", "cost": 1, - "description": "Some ’Mechs, such as the Archer, Wasp, and Locust, have been in production for literally centuries, with thousands or even tens of thousands produced in that time across multiple nations. For other ’Mechs, the manufacturer has gone to exceptional lengths to ensure that parts are readily available, such as mass producing them or using parts from other, more common machines. Whatever the case, when attempting to locate replacement parts for these ’Mechs, apply a –2 Target Number modifier. Note that this quirk does not cross between the Clans and the Inner Sphere. For example, a machine Ubiquitous amongst the Clans would not be Ubiquitous in the Inner Sphere, and vice versa.", + "description": "Some 'Mechs, such as the Archer, Wasp, and Locust, have been in production for literally centuries, with thousands or even tens of thousands produced in that time across multiple nations. For other 'Mechs, the manufacturer has gone to exceptional lengths to ensure that parts are readily available, such as mass producing them or using parts from other, more common machines. Whatever the case, when attempting to locate replacement parts for these 'Mechs, apply a –2 Target Number modifier. Note that this quirk does not cross between the Clans and the Inner Sphere. For example, a machine Ubiquitous amongst the Clans would not be Ubiquitous in the Inner Sphere, and vice versa.", "positive": true, "battlemech": true, "industrialmech": true, @@ -738,7 +792,7 @@ }, "Variable Range Targeting": { "name": "Variable Range Targeting", - "cost": 0, + "cost": 1, "description": "A BattleMech with this quirk has an advanced targeting system that allows it to launch more accurate attacks at either long or short range, at the expense of reduced accuracy at other ranges. During a turn's End Phase, the controlling player must designate whether this improved targeting feature will be active at long or short range the next turn. All weapon attacks at the designated range receive a -1 target number modifier, but all weapon attacks at the alternative range receive a +1 target number modifier (medium range remains unmodified).", "positive": true, "battlemech": true, @@ -757,7 +811,7 @@ "Vestigial Hands": { "name": "Vestigial Hands", "cost": 0, - "description": "A ’Mech with vestigial hands lacks manipulators substantial enough for most game purposes, and does not have hand actuator critical hit slots. However, a ’Mech with vestigial hands may lift and drop items (see Lifting Items (Simplified), p. 21) if a scenario objective requires it.", + "description": "A 'Mech with vestigial hands lacks manipulators substantial enough for most game purposes, and does not have hand actuator critical hit slots. However, a 'Mech with vestigial hands may lift and drop items (see Lifting Items (Simplified), p. 21) if a scenario objective requires it.", "positive": true, "battlemech": true, "industrialmech": true, @@ -919,7 +973,7 @@ "EM Interference": { "name": "EM Interference", "cost": 1, - "description": "An energy weapon is insufficiently shielded and causes interference with other delicate electronics. The turn after the weapon has been fired, the following equipment aboard the ’Mech will not function: any ECM, any Active Probe, Artemis IV FCS, Artemis V FCS, Blue Shield PFD, any C3, Chameleon LPS, Cockpit Command Console, Electronic Warfare Equipment, MASC, MRM FCS, NARC, Null Signature System, Stealth Armor, Streak Launchers, Supercharger, Targeting Computer, and Void Signature System. Alternatively, this quirk can be purchased for the ’Mech itself, in which case the problem occurs whenever any energy weapon on the ’Mech is fired. The cost for this version of the quirk is 2 points, but can only be purchased if the ’Mech has more than one energy weapon.", + "description": "An energy weapon is insufficiently shielded and causes interference with other delicate electronics. The turn after the weapon has been fired, the following equipment aboard the 'Mech will not function: any ECM, any Active Probe, Artemis IV FCS, Artemis V FCS, Blue Shield PFD, any C3, Chameleon LPS, Cockpit Command Console, Electronic Warfare Equipment, MASC, MRM FCS, NARC, Null Signature System, Stealth Armor, Streak Launchers, Supercharger, Targeting Computer, and Void Signature System. Alternatively, this quirk can be purchased for the 'Mech itself, in which case the problem occurs whenever any energy weapon on the 'Mech is fired. The cost for this version of the quirk is 2 points, but can only be purchased if the 'Mech has more than one energy weapon.", "positive": false, "battlemech": true, "industrialmech": true, @@ -1027,7 +1081,7 @@ "Illegal Design": { "name": "Illegal Design", "cost": 0, - "description": "’Mechs designed with this quirk do not follow the existing construction rules for some reason, achieving effects that are not normally allowed in game-play, and which can fail spectacularly at any moment. (Note: The total weight and critical space of all components must still fit within the design’s tonnage and critical space.) If employed, the opposing player may roll 2D6 to determine if the ’Mech with this quirk suffers a catastrophic failure once every 6 turns of combat. On a result of 6 or higher, such catastrophic failure occurs in 1D6 of the ’Mech’s hit locations (using the Front/Back Hit Locations Table). A Critical Hit check is then made for each failure location determined, applying a +4 modifier to the roll result. On any modified roll result of 13+, the location suffers complete collapse if it is an arm, leg, head, wing, main gun, or turret. This will destroy all items within (and any explosive components checks should be made as appropriate for location destruction). If the affected location is none of the above, it suffers 4 critical hits, determined as normal. Illegal ’Mechs suffer an additional +4 Target Number modifier to repair or replace any damaged or destroyed components, and double all repair and maintenance times for work performed on them. If an Illegal ’Mech repair fails, the item gains the Nonfunctional quirk as well. Finally, because they are technically failures at the time of their production, Illegal ’Mechs should also receive the Obsolete quirk (see p. 88), with the year of their obsolescence determined to be the same as their year of introduction", + "description": "'Mechs designed with this quirk do not follow the existing construction rules for some reason, achieving effects that are not normally allowed in game-play, and which can fail spectacularly at any moment. (Note: The total weight and critical space of all components must still fit within the design's tonnage and critical space.) If employed, the opposing player may roll 2D6 to determine if the 'Mech with this quirk suffers a catastrophic failure once every 6 turns of combat. On a result of 6 or higher, such catastrophic failure occurs in 1D6 of the 'Mech's hit locations (using the Front/Back Hit Locations Table). A Critical Hit check is then made for each failure location determined, applying a +4 modifier to the roll result. On any modified roll result of 13+, the location suffers complete collapse if it is an arm, leg, head, wing, main gun, or turret. This will destroy all items within (and any explosive components checks should be made as appropriate for location destruction). If the affected location is none of the above, it suffers 4 critical hits, determined as normal. Illegal 'Mechs suffer an additional +4 Target Number modifier to repair or replace any damaged or destroyed components, and double all repair and maintenance times for work performed on them. If an Illegal 'Mech repair fails, the item gains the Nonfunctional quirk as well. Finally, because they are technically failures at the time of their production, Illegal 'Mechs should also receive the Obsolete quirk (see p. 88), with the year of their obsolescence determined to be the same as their year of introduction", "positive": false, "battlemech": true, "industrialmech": true, @@ -1081,7 +1135,7 @@ "Low-Mounted Arms": { "name": "Low-Mounted Arms", "cost": 2, - "description": "’Mechs equipped with extremely low-mounted arms—such as the Dark Crow—have mounted their arms far too low to take advantage of the ’Mech’s height advantage. This quirk cannot be combined with the Overhead Arms quirk, nor can it be taken by any ’Mech that either does not have arms, or lacks any form of weaponry in its arms. A ’Mech with Low-Mounted Arms fires its arm-mounted weapons as if they are actually mounted in the ’Mech’s legs, even though these arms still rotate with the torso position. As a result, these weapons may be blocked from firing by partial cover such as low hills and buildings. By the same token, attacks against ’Mech with Low-Mounted Arms that pass over partial cover cannot strike the ’Mech’s arms either, and instead will strike the covering terrain.", + "description": "'Mechs equipped with extremely low-mounted arms—such as the Dark Crow—have mounted their arms far too low to take advantage of the 'Mech's height advantage. This quirk cannot be combined with the Overhead Arms quirk, nor can it be taken by any 'Mech that either does not have arms, or lacks any form of weaponry in its arms. A 'Mech with Low-Mounted Arms fires its arm-mounted weapons as if they are actually mounted in the 'Mech's legs, even though these arms still rotate with the torso position. As a result, these weapons may be blocked from firing by partial cover such as low hills and buildings. By the same token, attacks against 'Mech with Low-Mounted Arms that pass over partial cover cannot strike the 'Mech's arms either, and instead will strike the covering terrain.", "positive": false, "battlemech": true, "industrialmech": true, @@ -1171,7 +1225,7 @@ "Non-Functional Item": { "name": "Non-Functional Item", "cost": 5, - "description": "A ’Mech with this quirk has one or more components or pieces of equipment that simply do not work. No amount of repairs or replacement will correct this issue the ’Mech must be redesigned from the ground up to solve the problem. A ’Mech can have multiple Non-functional quirks, but each must be assigned to the specifically non-operational components they possess", + "description": "A 'Mech with this quirk has one or more components or pieces of equipment that simply do not work. No amount of repairs or replacement will correct this issue the 'Mech must be redesigned from the ground up to solve the problem. A 'Mech can have multiple Non-functional quirks, but each must be assigned to the specifically non-operational components they possess", "positive": false, "battlemech": true, "industrialmech": true, @@ -1225,7 +1279,7 @@ "Oversized": { "name": "Oversized", "cost": 2, - "description": "The Oversized quirk cannot be combined with the Narrow/Low Profile quirk, and is further limited to ’Mechs of heavy weight (60 tons) and larger. This quirk describes a ’Mech that has been built physically larger than the norm, such as the Mackie or Scylla. Any Piloting Skill Rolls required of an Oversized ’Mech to avoid damage when passing through buildings suffer a +1 Target Number modifier. Furthermore, they find it harder to use covering terrain effectively: an Oversized ’Mech never receives the +1 Target Number modifier for partial cover when being attacked", + "description": "The Oversized quirk cannot be combined with the Narrow/Low Profile quirk, and is further limited to 'Mechs of heavy weight (60 tons) and larger. This quirk describes a 'Mech that has been built physically larger than the norm, such as the Mackie or Scylla. Any Piloting Skill Rolls required of an Oversized 'Mech to avoid damage when passing through buildings suffer a +1 Target Number modifier. Furthermore, they find it harder to use covering terrain effectively: an Oversized 'Mech never receives the +1 Target Number modifier for partial cover when being attacked", "positive": false, "battlemech": true, "industrialmech": true, @@ -1405,7 +1459,7 @@ "Ramshackle": { "name": "Ramshackle", "cost": 3, - "description": "Decades or even centuries of hard service and substandard maintenance have led to an unpredictable machine patched together with bailing wire and prayers. The ’Mech’s controller rolls 1D6 at the start of the battle. The result indicates what negative quirk, if any, applies to that ’Mech for the duration of the battle: Sensor Ghosts (1), EM Interference (entire ’Mech) (2), Hard to Pilot (3), Cooling System Flaws (4), Poor Performance (5), or no negative result (6)", + "description": "Decades or even centuries of hard service and substandard maintenance have led to an unpredictable machine patched together with bailing wire and prayers. The 'Mech's controller rolls 1D6 at the start of the battle. The result indicates what negative quirk, if any, applies to that 'Mech for the duration of the battle: Sensor Ghosts (1), EM Interference (entire 'Mech) (2), Hard to Pilot (3), Cooling System Flaws (4), Poor Performance (5), or no negative result (6)", "positive": false, "battlemech": true, "industrialmech": true, @@ -1441,7 +1495,7 @@ "Slow Traverse": { "name": "Slow Traverse", "cost": 1, - "description": "The ’Mech has an underpowered turret traverse mechanism. Any turret (or 3-point Directional Torso Mount) on the ’Mech may only rotate one hexside in a turn.", + "description": "The 'Mech has an underpowered turret traverse mechanism. Any turret (or 3-point Directional Torso Mount) on the 'Mech may only rotate one hexside in a turn.", "positive": false, "battlemech": true, "industrialmech": true, @@ -1459,7 +1513,7 @@ "Static Ammo Feed": { "name": "Static Ammo Feed", "cost": 1, - "description": "Weapons with the Static Ammo Feed quirk use a very crude or minimized form of ammunition feed that renders the weapon incapable of switching between multiple ammunition bins. It is most commonly seen in ’Mechs that feature exposed ammunition feeds, such as the Blade or the Cygnus, and thus often occurs in conjunction with the Exposed Weapon Linkage quirk. The Static Ammo Feed quirk must be taken for each affected weapon type the ’Mech carries, though it can cover multiple weapons of that type at the same time. Thus, a ’Mech with two Autocannon/10s and two Autocannon/5s would need two Static Ammo Quirks to account for all four weapons having this issue, if desired—one for the AC/10s and the other for the AC/5s. This quick cannot be applied to weapons without switchable ammunition. Weapons covered by this quirk will be unable to switch between different ammunition types, even if they possess the Switchable (S) feature. Thus, all ammunition carried for a weapon with a Static Ammo Feed must be of the same type throughout play.", + "description": "Weapons with the Static Ammo Feed quirk use a very crude or minimized form of ammunition feed that renders the weapon incapable of switching between multiple ammunition bins. It is most commonly seen in 'Mechs that feature exposed ammunition feeds, such as the Blade or the Cygnus, and thus often occurs in conjunction with the Exposed Weapon Linkage quirk. The Static Ammo Feed quirk must be taken for each affected weapon type the 'Mech carries, though it can cover multiple weapons of that type at the same time. Thus, a 'Mech with two Autocannon/10s and two Autocannon/5s would need two Static Ammo Quirks to account for all four weapons having this issue, if desired—one for the AC/10s and the other for the AC/5s. This quick cannot be applied to weapons without switchable ammunition. Weapons covered by this quirk will be unable to switch between different ammunition types, even if they possess the Switchable (S) feature. Thus, all ammunition carried for a weapon with a Static Ammo Feed must be of the same type throughout play.", "positive": false, "battlemech": true, "industrialmech": true, @@ -1512,7 +1566,7 @@ }, "Weak Head Armor": { "name": "Weak Head Armor", - "cost": 0, + "cost": 1, "description": "The Value of this quirk is equal to the number of armor points effectively lost.", "positive": false, "battlemech": true, diff --git a/Data/Templates/Vee_HTML.html b/Data/Templates/Vee_HTML.html index 5564df49..2a2b9f4a 100644 --- a/Data/Templates/Vee_HTML.html +++ b/Data/Templates/Vee_HTML.html @@ -160,6 +160,7 @@ <+-SSW_REMOVE_IF_BLANK-+>Power Amplifier:<+-SSW_POWER_AMP_TONNAGE-+> <+-SSW_REMOVE_IF_BLANK-+>Turret:<+-SSW_TURRET_TONNAGE-+> +<+-SSW_REMOVE_IF_BLANK-+>Rear Turret:<+-SSW_REAR_TURRET_TONNAGE-+> Armor: <+-SSW_ARMOR_FACTOR-+> points - <+-SSW_ARMOR_TYPE-+> @@ -190,6 +191,7 @@ <+-SSW_LEFT_ARMOR-+>/<+-SSW_RIGHT_ARMOR-+> <+-SSW_REMOVE_IF_BLANK-+>Turret:<+-SSW_TURRET_ARMOR-+> + <+-SSW_REMOVE_IF_BLANK-+>Rear Turret:<+-SSW_REAR_TURRET_ARMOR-+> <+-SSW_REMOVE_IF_BLANK-+>Rotor:<+-SSW_ROTOR_ARMOR-+> diff --git a/build.gradle b/build.gradle index ee16b91f..b9833f03 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } allprojects { - version '0.7.6' + version '0.7.6.1' ext { release='Stable' rev=versionDetails().gitHash diff --git a/saw/build.gradle b/saw/build.gradle index 5c1235e8..1cab545e 100644 --- a/saw/build.gradle +++ b/saw/build.gradle @@ -22,8 +22,9 @@ jar { 'Main-Class' : 'saw.Main', 'Class-Path' : configurations.runtimeClasspath.files .findAll { it.name.endsWith(".jar") }.collect { "lib/${it.name}" }.join(' '), + 'SplashScreen-Image' : 'saw/images/splash.png' ) - jar.archiveName = "SAW.jar" + archiveName = "SAW.jar" } task deleteAssets { diff --git a/saw/src/main/java/saw/Constants.java b/saw/src/main/java/saw/Constants.java index 41e22d54..35d808b4 100644 --- a/saw/src/main/java/saw/Constants.java +++ b/saw/src/main/java/saw/Constants.java @@ -48,7 +48,8 @@ public class Constants { ART4_ART_5 = 2, ART4_APOLLO = 3; public final static int SCREEN_SIZE_NORMAL = 0, - SCREEN_SIZE_WIDE_1280 = 1; + SCREEN_SIZE_WIDE_1280 = 1, + SCREEN_SIZE_WIDE_1600 = 2; public static String GetVersion() { Properties props = new Properties(); diff --git a/saw/src/main/java/saw/Main.java b/saw/src/main/java/saw/Main.java index bc02746d..a230df7f 100644 --- a/saw/src/main/java/saw/Main.java +++ b/saw/src/main/java/saw/Main.java @@ -43,10 +43,6 @@ public class Main { - /** - * @param args the command line arguments - */ - public static void main(String[] args) { Preferences prefs = Preferences.userRoot().node( common.Constants.SAWPrefs ); prefs.remove("FileToOpen"); @@ -119,16 +115,20 @@ public void run() { switch( screensize ) { case Constants.SCREEN_SIZE_WIDE_1280: MainFrame = new frmVeeWide(); - MainFrame.setSize( 1280, 600 ); + MainFrame.setSize( 1280, 625 ); + break; + case Constants.SCREEN_SIZE_WIDE_1600: + MainFrame = new frmVeeWide(); + MainFrame.setSize( 1600, 900 ); break; default: MainFrame = new frmVee(); - //MainFrame.setSize( 800, 600 ); + MainFrame.setSize( 850, 650 ); break; } try { - icon = new ImageIcon(MainFrame.getClass().getResource("/saw/Images/appicon.png")); + icon = new ImageIcon(MainFrame.getClass().getResource("/Images/SSW_Logo.png")); MainFrame.setIconImage(icon.getImage()); } catch (Exception e) { System.out.println("Error loading Icon image...\n" + e.getMessage()); diff --git a/saw/src/main/java/saw/filehandlers/HTMLWriter.java b/saw/src/main/java/saw/filehandlers/HTMLWriter.java index 2aa83bba..276b51bf 100644 --- a/saw/src/main/java/saw/filehandlers/HTMLWriter.java +++ b/saw/src/main/java/saw/filehandlers/HTMLWriter.java @@ -1326,11 +1326,13 @@ private void BuildHash() { lookup.put( "<+-SSW_RIGHT_ARMOR-+>", "" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_RIGHT ) ); lookup.put( "<+-SSW_REAR_ARMOR-+>", "" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_REAR ) ); lookup.put( "<+-SSW_TURRET_ARMOR-+>", "" + (CurVee.isHasTurret1() ? CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_TURRET1 ) : "") ); + lookup.put( "<+-SSW_REAR_TURRET_ARMOR-+>", "" + (CurVee.isHasTurret2() ? CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_TURRET2 ) : "") ); lookup.put( "<+-SSW_ROTOR_ARMOR-+>", "" + (CurVee.IsVTOL() ? CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_ROTOR ) : "") ); lookup.put( "<+-SSW_FRONT_ARMOR_TYPE-+>", " (" + CurVee.GetArmor().GetFrontArmorType().LookupName() + ")" ); lookup.put( "<+-SSW_LEFT_ARMOR_TYPE-+>", " (" + CurVee.GetArmor().GetLeftArmorType().LookupName() + ")" ); lookup.put( "<+-SSW_RIGHT_ARMOR_TYPE-+>", " (" + CurVee.GetArmor().GetRightArmorType().LookupName() + ")" ); lookup.put( "<+-SSW_TURRET_ARMOR_TYPE-+>", (CurVee.isHasTurret1() ? " (" + CurVee.GetArmor().GetTurret1ArmorType().LookupName() + ")" : "") ); + lookup.put( "<+-SSW_REAR_TURRET_ARMOR_TYPE-+>", (CurVee.isHasTurret2() ? " (" + CurVee.GetArmor().GetTurret2ArmorType().LookupName() + ")" : "") ); lookup.put( "<+-SSW_ROTOR_ARMOR_TYPE-+>", ( CurVee.IsVTOL() ? " (" + CurVee.GetArmor().GetRotorArmorType().LookupName() + ")" : "" ) ); lookup.put( "<+-SSW_REAR_ARMOR_TYPE-+>", " (" + CurVee.GetArmor().GetRearArmorType().LookupName() + ")" ); lookup.put( "<+-SSW_ARMOR_COVERAGE-+>", "" + CurVee.GetArmor().GetCoverage() ); @@ -1382,6 +1384,7 @@ private void BuildHash() { lookup.put( "<+-SSW_CONTROLS_TONNAGE-+>", CurVee.GetControls() ); lookup.put( "<+-SSW_LIFTEQUIPMENT_TONNAGE-+>", (CurVee.GetLiftEquipmentTonnage() == 0) ? "" : CurVee.GetLiftEquipmentTonnage() + "" ); lookup.put( "<+-SSW_TURRET_TONNAGE-+>", (CurVee.GetLoadout().GetTurret().GetTonnage() == 0) ? "" : CurVee.GetLoadout().GetTurret().GetTonnage() + "" ); + lookup.put( "<+-SSW_REAR_TURRET_TONNAGE-+>", (CurVee.GetLoadout().GetRearTurret().GetTonnage() == 0) ? "" : CurVee.GetLoadout().GetRearTurret().GetTonnage() + "" ); lookup.put( "<+-SSW_RULES_LEVEL-+>", CommonTools.GetRulesLevelString( CurVee.GetRulesLevel() ) ); if( CurVee.IsOmni() ) { lookup.put( "<+-SSW_POD_TONNAGE-+>", FormatTonnage( ( CurVee.GetTonnage() - CurVee.GetCurrentTons() ), 1 ) ); diff --git a/saw/src/main/java/saw/gui/dlgFiles.java b/saw/src/main/java/saw/gui/dlgFiles.java index 24bff2c7..fdf25b9a 100644 --- a/saw/src/main/java/saw/gui/dlgFiles.java +++ b/saw/src/main/java/saw/gui/dlgFiles.java @@ -56,7 +56,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel1.setText("

Solaris Armorwerks needs to know where you have placed your Unit files.

If you have not downloaded the zip file containing these files yet please go to

http://www.solarisskunkwerks.com/downloads


and download the Master file available there.


Once this file has downloaded you can unzip it wherever you would like as the next step will be to tell SAW where you put them.

"); + jLabel1.setText("

Solaris Armorwerks needs to know where you have placed your Unit files.

If you have not downloaded the zip file containing these files yet please go to

https://github.com/Solaris-Skunk-Werks/SSW-Master/archive/refs/heads/master.zip


and download the Master file available there.


Once this file has downloaded you can unzip it wherever you would like as the next step will be to tell SAW where you put them.

"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); diff --git a/saw/src/main/java/saw/gui/dlgPrefs.form b/saw/src/main/java/saw/gui/dlgPrefs.form index fa547927..2fa8c143 100644 --- a/saw/src/main/java/saw/gui/dlgPrefs.form +++ b/saw/src/main/java/saw/gui/dlgPrefs.form @@ -16,6 +16,7 @@ + @@ -444,7 +445,7 @@ - + @@ -524,6 +525,16 @@ + + + + + + + + + + @@ -536,6 +547,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1224,7 +1267,7 @@ - + @@ -1380,13 +1423,26 @@ + + + + + + + + + + + + + - + diff --git a/saw/src/main/java/saw/gui/dlgPrefs.java b/saw/src/main/java/saw/gui/dlgPrefs.java index 3f8ed6b4..af34b811 100644 --- a/saw/src/main/java/saw/gui/dlgPrefs.java +++ b/saw/src/main/java/saw/gui/dlgPrefs.java @@ -81,6 +81,8 @@ private void SetState() { chkHeatAllMP.setEnabled( true ); } chkHeatUAC.setSelected( Prefs.getBoolean( "HeatACFullRate", false ) ); + chkHeatStreaks.setSelected( Prefs.getBoolean( "HeatStreaksHalfRate", false ) ); + chkCostAmmoMult.setSelected( Prefs.getBoolean( "CostAmmoMult", false ) ); chkAutoAddECM.setSelected( Prefs.getBoolean( "AutoAddECM", true ) ); chkMaxNotInt.setSelected( Prefs.getBoolean( "UseMaxArmorInstead", false ) ); @@ -127,6 +129,9 @@ private void SetState() { case saw.Constants.SCREEN_SIZE_WIDE_1280: rdoWidescreen.setSelected( true ); break; + case saw.Constants.SCREEN_SIZE_WIDE_1600: + rdoLargescreen.setSelected(true); + break; default: rdoNormalSize.setSelected( true ); break; @@ -152,6 +157,8 @@ private void SaveState() { Prefs.putBoolean( "HeatExcludeJumpMP", chkHeatJumpMP.isSelected() ); Prefs.putBoolean( "HeatExcludeAllMP", chkHeatAllMP.isSelected() ); Prefs.putBoolean( "HeatACFullRate", chkHeatUAC.isSelected() ); + Prefs.putBoolean( "HeatStreaksHalfRate", chkHeatStreaks.isSelected() ); + Prefs.putBoolean( "CostAmmoMult", chkCostAmmoMult.isSelected() ); Prefs.putBoolean( "UseMaxArmorInstead", chkMaxNotInt.isSelected() ); Prefs.putBoolean( "ArmorUseCustomPercent", chkCustomPercents.isSelected() ); Prefs.putBoolean( "ArmorMaxHead", rdoArmorMaxHead.isSelected() ); @@ -193,6 +200,8 @@ private void SaveState() { Prefs.putInt( "SSWScreenSize", saw.Constants.SCREEN_SIZE_NORMAL ); } else if( rdoWidescreen.isSelected() ) { Prefs.putInt( "SSWScreenSize", saw.Constants.SCREEN_SIZE_WIDE_1280 ); + } else if (rdoLargescreen.isSelected()) { + Prefs.putInt( "SSWScreenSize", saw.Constants.SCREEN_SIZE_WIDE_1600); } } @@ -214,6 +223,8 @@ private void SetDefaults() { Prefs.putBoolean( "HeatExcludeJumpMP", false ); Prefs.putBoolean( "HeatExcludeAllMP", false ); Prefs.putBoolean( "HeatACFullRate", false ); + Prefs.putBoolean( "HeatStreaksHalfRate", false ); + Prefs.putBoolean( "CostAmmoMult", false ); Prefs.putBoolean( "UseMaxArmorInstead", false ); Prefs.putBoolean( "ArmorUseCustomPercent", false ); Prefs.putBoolean( "ArmorMaxHead", true ); @@ -292,7 +303,10 @@ private void initComponents() { chkHeatJumpMP = new javax.swing.JCheckBox(); chkHeatAllMP = new javax.swing.JCheckBox(); chkHeatUAC = new javax.swing.JCheckBox(); + chkHeatStreaks = new javax.swing.JCheckBox(); jLabel19 = new javax.swing.JLabel(); + jPanel15 = new javax.swing.JPanel(); + chkCostAmmoMult = new javax.swing.JCheckBox(); jPanel13 = new javax.swing.JPanel(); chkAutoAddECM = new javax.swing.JCheckBox(); jPanel4 = new javax.swing.JPanel(); @@ -349,6 +363,7 @@ private void initComponents() { jPanel14 = new javax.swing.JPanel(); rdoNormalSize = new javax.swing.JRadioButton(); rdoWidescreen = new javax.swing.JRadioButton(); + rdoLargescreen = new javax.swing.JRadioButton(); lblScreenSizeNotice = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); btnSave = new javax.swing.JButton(); @@ -660,6 +675,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); jPanel8.add(chkHeatUAC, gridBagConstraints); + chkHeatStreaks.setText("Streaks have 50% fire rate (ala MML)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 8; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); + jPanel8.add(chkHeatStreaks, gridBagConstraints); + jLabel19.setText("Non-BV Heat Calculations:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; @@ -668,10 +691,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.gridheight = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; pnlConstruction.add(jPanel8, gridBagConstraints); + jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Cost Options")); + jPanel15.setLayout(new java.awt.GridBagLayout()); + + chkCostAmmoMult.setText("Apply weight mult to ammo (ala MML)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); + jPanel15.add(chkCostAmmoMult, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; + pnlConstruction.add(jPanel15, gridBagConstraints); + jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Usability Options")); jPanel13.setLayout(new javax.swing.BoxLayout(jPanel13, javax.swing.BoxLayout.LINE_AXIS)); @@ -1196,11 +1234,19 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; jPanel14.add(rdoWidescreen, gridBagConstraints); - lblScreenSizeNotice.setText("Change requires restart of SSW."); + btgScreenSize.add(rdoLargescreen); + rdoLargescreen.setText("Large Screen (1600 wide)"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + jPanel14.add(rdoLargescreen, gridBagConstraints); + + lblScreenSizeNotice.setText("Change requires restart of SSW."); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; jPanel14.add(lblScreenSizeNotice, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); @@ -1653,6 +1699,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JButton btnSetDefaults; private javax.swing.JButton btnTXTPath; private javax.swing.JCheckBox chkAutoAddECM; + private javax.swing.JCheckBox chkCostAmmoMult; private javax.swing.JCheckBox chkCustomPercents; private javax.swing.JCheckBox chkGroupAmmoAtBottom; private javax.swing.JCheckBox chkHeatAllMP; @@ -1660,6 +1707,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JCheckBox chkHeatJumpMP; private javax.swing.JCheckBox chkHeatOSWeapons; private javax.swing.JCheckBox chkHeatRearWeapons; + private javax.swing.JCheckBox chkHeatStreaks; private javax.swing.JCheckBox chkHeatSystems; private javax.swing.JCheckBox chkHeatUAC; private javax.swing.JCheckBox chkLoadLastMech; @@ -1691,6 +1739,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JPanel jPanel12; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel14; + private javax.swing.JPanel jPanel15; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; @@ -1717,6 +1766,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JRadioButton rdoArmorTorsoPriority; private javax.swing.JRadioButton rdoExportSortIn; private javax.swing.JRadioButton rdoExportSortOut; + private javax.swing.JRadioButton rdoLargescreen; private javax.swing.JRadioButton rdoNormalSize; private javax.swing.JRadioButton rdoWidescreen; private javax.swing.JTextField txtAmmoExportName; diff --git a/saw/src/main/java/saw/gui/frmVee.form b/saw/src/main/java/saw/gui/frmVee.form index 5bdeba55..77f13532 100644 --- a/saw/src/main/java/saw/gui/frmVee.form +++ b/saw/src/main/java/saw/gui/frmVee.form @@ -413,7 +413,23 @@ - + + + + + + + + + + + + + + + + + @@ -421,7 +437,7 @@ - + @@ -445,15 +461,15 @@ - + - + - + - + @@ -1058,7 +1074,7 @@ - + @@ -1070,6 +1086,7 @@ + @@ -1130,6 +1147,8 @@ + + @@ -1197,6 +1216,7 @@ + @@ -1376,11 +1396,34 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -1407,26 +1450,22 @@ - + - - - - - - - - - - - - - - + + + + + + + + + + + - @@ -1434,23 +1473,18 @@ - - - - + - + + - + - - - - + @@ -1491,6 +1525,11 @@ + + + + + @@ -1689,6 +1728,9 @@ + + + @@ -3562,7 +3604,7 @@ - + @@ -4312,10 +4354,10 @@ - + - - + + @@ -5581,7 +5623,7 @@ - + diff --git a/saw/src/main/java/saw/gui/frmVee.java b/saw/src/main/java/saw/gui/frmVee.java index 6100e6b0..d9e19fdc 100644 --- a/saw/src/main/java/saw/gui/frmVee.java +++ b/saw/src/main/java/saw/gui/frmVee.java @@ -37,9 +37,11 @@ import battleforce.BattleForceStats; import common.*; import components.*; +import dialog.dlgQuirks; import dialog.frmForce; import filehandlers.*; import gui.TextPane; +import list.view.tbQuirks; import saw.filehandlers.HTMLWriter; import states.ifState; import visitors.VArmorSetPatchworkLocation; @@ -48,10 +50,10 @@ import visitors.ifVisitor; import javax.swing.*; +import javax.swing.event.ListSelectionListener; import javax.swing.text.JTextComponent; import java.awt.*; import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.event.*; @@ -66,8 +68,8 @@ public final class frmVee extends javax.swing.JFrame implements java.awt.datatra Preferences Prefs; String[] Selections = { "", "" }; public DataFactory data; - private Cursor Hourglass = new Cursor( Cursor.WAIT_CURSOR ); - private Cursor NormalCursor = new Cursor( Cursor.DEFAULT_CURSOR ); + private final Cursor Hourglass = new Cursor( Cursor.WAIT_CURSOR ); + private final Cursor NormalCursor = new Cursor( Cursor.DEFAULT_CURSOR ); boolean Load = false, isLocked = false, SetSource = true; @@ -86,9 +88,10 @@ public final class frmVee extends javax.swing.JFrame implements java.awt.datatra private final AvailableCode PulseModuleAC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); private final AvailableCode CaselessAmmoAC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - private ImageTracker imageTracker = new ImageTracker(); + private final ImageTracker imageTracker = new ImageTracker(); public dlgOpen dOpen = new dlgOpen(this, true); public frmForce dForce = new frmForce(this, imageTracker); + public ArrayList quirks = new ArrayList(); TextPane Overview = new TextPane(); TextPane Capabilities = new TextPane(); @@ -134,11 +137,7 @@ public final class frmVee extends javax.swing.JFrame implements java.awt.datatra public void focusGained(FocusEvent e) { if ( e.getSource() instanceof JTextComponent ) { final JTextComponent textComponent = ((JTextComponent)e.getSource()); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - textComponent.selectAll(); - } - }); + SwingUtilities.invokeLater(textComponent::selectAll); } } }; @@ -212,112 +211,47 @@ public frmVee() { pnlAdditionalFluff.add( Additional ); pnlVariants.add( Variants ); pnlNotables.add( Notables ); + quirks = CurVee.GetQuirks(); pack(); - mnuDetails.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - GetInfoOn(); - ShowInfoOn(CurItem); - } + mnuDetails.addActionListener(evt -> { + GetInfoOn(); + ShowInfoOn(CurItem); }); - mnuSetVariable.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVariableSize(); - } - }); + mnuSetVariable.addActionListener(e -> SetVariableSize()); - mnuSetLotSize.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetAmmoLotSize(); - } - }); + mnuSetLotSize.addActionListener(e -> SetAmmoLotSize()); - mnuAddCapacitor.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - PPCCapacitor(); - } - }); + mnuAddCapacitor.addActionListener(e -> PPCCapacitor()); - mnuAddInsulator.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - LaserInsulator(); - } - }); + mnuAddInsulator.addActionListener(e -> LaserInsulator()); - mnuAddPulseModule.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - PulseModule(); - } - }); + mnuAddPulseModule.addActionListener(e -> PulseModule()); - mnuDumper.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - DumperMount(); - } - }); + mnuDumper.addActionListener(e -> DumperMount()); - mnuCaseless.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SwitchCaseless(); - } - }); + mnuCaseless.addActionListener(e -> SwitchCaseless()); - mnuVGLArcFore.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcFore(); - } - }); + mnuVGLArcFore.addActionListener(e -> SetVGLArcFore()); - mnuVGLArcForeSide.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcForeSide(); - } - }); + mnuVGLArcForeSide.addActionListener(e -> SetVGLArcForeSide()); - mnuVGLArcRear.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcRear(); - } - }); + mnuVGLArcRear.addActionListener(e -> SetVGLArcRear()); - mnuVGLArcRearSide.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcRearSide(); - } - }); + mnuVGLArcRearSide.addActionListener(e -> SetVGLArcRearSide()); - mnuVGLAmmoFrag.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoFrag(); - } - }); + mnuVGLAmmoFrag.addActionListener(e -> SetVGLAmmoFrag()); - mnuVGLAmmoChaff.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoChaff(); - } - }); + mnuVGLAmmoChaff.addActionListener(e -> SetVGLAmmoChaff()); - mnuVGLAmmoIncen.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoIncendiary(); - } - }); + mnuVGLAmmoIncen.addActionListener(e -> SetVGLAmmoIncendiary()); - mnuVGLAmmoSmoke.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoSmoke(); - } - }); + mnuVGLAmmoSmoke.addActionListener(e -> SetVGLAmmoSmoke()); - mnuRemoveItem.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - RemoveItemCritTab(); - } - }); + mnuRemoveItem.addActionListener(e -> RemoveItemCritTab()); mnuVGLArc.setText( "Set VGL Arc" ); mnuVGLArc.add( mnuVGLArcFore ); @@ -382,23 +316,11 @@ public void actionPerformed(ActionEvent e) { ((JSpinner.DefaultEditor)spnRearTurretArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnRotorArmor.getEditor()).getTextField().addFocusListener(spinners); - mnuFluffCut.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed( ActionEvent e ) { - FluffCut( mnuFluff.getInvoker() ); - } - }); + mnuFluffCut.addActionListener(e -> FluffCut( mnuFluff.getInvoker() )); - mnuFluffCopy.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - FluffCopy( mnuFluff.getInvoker() ); - } - }); + mnuFluffCopy.addActionListener(e -> FluffCopy( mnuFluff.getInvoker() )); - mnuFluffPaste.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - FluffPaste( mnuFluff.getInvoker() ); - } - }); + mnuFluffPaste.addActionListener(e -> FluffPaste( mnuFluff.getInvoker() )); mnuFluff.add( mnuFluffCut ); mnuFluff.add( mnuFluffCopy ); @@ -419,18 +341,14 @@ public String getColumnName( int col ) { public Object getValueAt( int row, int col ) { Object o = CurVee.GetLoadout().GetEquipment().get( row ); if( col == 1 ) { - return ((abPlaceable) o).GetManufacturer(); + return CommonTools.UnknownToEmpty( ((abPlaceable) o).GetManufacturer() ); } else { return ((abPlaceable) o).CritName(); } } @Override public boolean isCellEditable( int row, int col ) { - if( col == 0 ) { - return false; - } else { - return true; - } + return col != 0; } @Override public void setValueAt( Object value, int row, int col ) { @@ -442,9 +360,9 @@ public void setValueAt( Object value, int row, int col ) { fireTableCellUpdated( row, col ); } else { ArrayList v = CurVee.GetLoadout().GetEquipment(); - for( int i = 0; i < v.size(); i++ ) { - if( FileCommon.LookupStripArc( ((abPlaceable) v.get( i )).LookupName() ).equals( FileCommon.LookupStripArc( a.LookupName() ) ) ) { - ((abPlaceable) v.get( i )).SetManufacturer( (String) value ); + for (Object o : v) { + if (FileCommon.LookupStripArc(((abPlaceable) o).LookupName()).equals(FileCommon.LookupStripArc(a.LookupName()))) { + ((abPlaceable) o).SetManufacturer((String) value); } } fireTableDataChanged(); @@ -611,29 +529,29 @@ private void SwitchCaseless() { ArrayList replace = new ArrayList(); abPlaceable p; boolean HasOrig = false; - for( int i = 0; i < check.size(); i++ ) { - p = (abPlaceable) check.get( i ); - if( p instanceof RangedWeapon ) { - if( ((RangedWeapon) p).GetAmmoIndex() == origIDX ) { + for (Object o : check) { + p = (abPlaceable) o; + if (p instanceof RangedWeapon) { + if (((RangedWeapon) p).GetAmmoIndex() == origIDX) { HasOrig = true; } } - if( p instanceof Ammunition ) { - replace.add( p ); + if (p instanceof Ammunition) { + replace.add(p); } } // replace any ammo with the new stuff if there are no other original weapons if( ! HasOrig ) { Object[] newammo = data.GetEquipment().GetAmmo( newIDX, CurVee ); - for( int i = 0; i < replace.size(); i++ ) { - p = (abPlaceable) replace.get( i ); - if( ((Ammunition) p).GetAmmoIndex() == origIDX ) { - CurVee.GetLoadout().Remove( p ); - if( newammo.length > 0 ) { - p = data.GetEquipment().GetCopy( (abPlaceable) newammo[0], CurVee); + for (Object o : replace) { + p = (abPlaceable) o; + if (((Ammunition) p).GetAmmoIndex() == origIDX) { + CurVee.GetLoadout().Remove(p); + if (newammo.length > 0) { + p = data.GetEquipment().GetCopy((abPlaceable) newammo[0], CurVee); try { - CurVee.GetLoadout().AddTo( p, LocationIndex.CV_LOC_BODY ); + CurVee.GetLoadout().AddTo(p, LocationIndex.CV_LOC_BODY); } catch (Exception ex) { Media.Messager(ex.getMessage()); } @@ -734,9 +652,9 @@ private void setViewToolbar(boolean Visible) Prefs.putBoolean("ViewToolbar", Visible); //mnuViewToolbar.setState(Visible); if (Visible) { - if (this.getHeight() != 600) { this.setSize(750, 600); } + if (this.getHeight() != 600) { this.setSize(750, 625); } } else { - if (this.getHeight() != 575) { this.setSize(750, 575); } + if (this.getHeight() != 575) { this.setSize(750, 600); } } } private void ConfigureUtilsMenu( java.awt.Component c ) { @@ -747,10 +665,6 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { boolean caseless = LegalCaseless( CurItem ) && CommonTools.IsAllowed( CaselessAmmoAC, CurVee ); boolean lotchange = LegalLotChange( CurItem ); boolean dumper = LegalDumper( CurItem ); - mnuAddCapacitor.setEnabled( cap ); - mnuAddInsulator.setEnabled( insul ); - mnuAddPulseModule.setEnabled(pulseModule); - mnuCaseless.setEnabled( caseless ); mnuAddCapacitor.setVisible( cap ); mnuAddInsulator.setVisible( insul ); mnuAddPulseModule.setVisible(pulseModule); @@ -796,19 +710,11 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { } } if( CurItem instanceof Equipment ) { - if( ((Equipment) CurItem).IsVariableSize() ) { - mnuSetVariable.setVisible( true ); - } else { - mnuSetVariable.setVisible( false ); - } + mnuSetVariable.setVisible(((Equipment) CurItem).IsVariableSize()); } else { mnuSetVariable.setVisible( false ); } - if( CurItem.CoreComponent() || CurItem.LocationLinked() ) { - mnuRemoveItem.setEnabled( false ); - } else { - mnuRemoveItem.setEnabled( true ); - } + mnuRemoveItem.setEnabled(!CurItem.CoreComponent() && !CurItem.LocationLinked()); } private void RemoveItemCritTab() { @@ -863,14 +769,12 @@ public boolean LegalTurretMount( abPlaceable p ) { public boolean LegalLotChange( abPlaceable p ) { if( ! ( p instanceof Ammunition ) ) { return false; } - if( CurVee.UsingFractionalAccounting() ) { return true; } - return false; + return CurVee.UsingFractionalAccounting(); } public boolean LegalDumper( abPlaceable p ) { if ( ! ( p instanceof Equipment ) ) { return false; } - if ( ( (Equipment)p).CritName().equals("Cargo Container") ) { return true; } - return false; + return ((Equipment) p).CritName().equals("Cargo Container"); } public void RefreshInfoPane() { @@ -890,6 +794,41 @@ public void RefreshInfoPane() { txtInfoFreeCrits.setForeground(Color.black); } + if( CurVee.isHasTurret1() ) { + txtTurretInfo.setVisible( true ); + Turret turret = CurVee.GetLoadout().GetTurret(); + if( turret.isTonnageSet() ) { + if( turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + txtTurretInfo.setForeground( Color.red ); + } else { + txtTurretInfo.setForeground( Color.black ); + } + } + } else { + txtTurretInfo.setVisible( false ); + } + if( CurVee.isHasTurret2() ) { + txtRearTurretInfo.setVisible( true ); + Turret turret = CurVee.GetLoadout().GetRearTurret(); + if( turret.isTonnageSet() ) { + if( turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + txtRearTurretInfo.setForeground( Color.red ); + } else { + txtRearTurretInfo.setForeground( Color.black ); + } + } + } else { + txtRearTurretInfo.setVisible( false ); + } + + // fill in the movement summary + String temp = "Max C/F: "; + temp += CurVee.GetAdjustedCruiseMP( false, true ) + "/"; + temp += CurVee.GetAdjustedFlankMP( false, true ); +// temp += CurMech.GetAdjustedJumpingMP( false ) + "/"; +// temp += CurMech.GetAdjustedBoosterMP( false ); + lblMoveSummary.setText( temp ); + // fill in the info if( CurVee.UsingFractionalAccounting() ) { txtInfoTonnage.setText( "Tons: " + CommonTools.RoundFractionalTons( CurVee.GetCurrentTons() ) ); @@ -933,7 +872,7 @@ private void FluffCut( Component c ) { } java.awt.datatransfer.StringSelection export = new java.awt.datatransfer.StringSelection( cut ); java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents( export, (ClipboardOwner) this); + clipboard.setContents( export, this); } private void FluffCopy( Component c ) { @@ -960,7 +899,7 @@ private void FluffCopy( Component c ) { } java.awt.datatransfer.StringSelection export = new java.awt.datatransfer.StringSelection( copy ); java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents( export, (ClipboardOwner) this); + clipboard.setContents( export, this); } private void FluffPaste( Component c ) { @@ -968,7 +907,7 @@ private void FluffPaste( Component c ) { char space = 20; char linereturn = 13; java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); - String txtimport = null; + String txtimport; try { txtimport = (String) clipboard.getData( DataFlavor.stringFlavor ); txtimport.replace(linereturn, space); @@ -977,7 +916,6 @@ private void FluffPaste( Component c ) { e.printStackTrace(); return; } - if( txtimport == null ) { return; } if( c instanceof JEditorPane ) { JEditorPane j = (JEditorPane) c; int insert = j.getCaretPosition(); @@ -997,15 +935,15 @@ private void ResetAmmo() { ArrayList v = CurVee.GetLoadout().GetNonCore(), wep = new ArrayList(); Object a; - for( int i = 0; i < v.size(); i++ ) { - a = v.get( i ); - if( a instanceof ifWeapon ) { - if( ((ifWeapon) a).HasAmmo() ) { - wep.add( a ); + for (Object o : v) { + a = o; + if (a instanceof ifWeapon) { + if (((ifWeapon) a).HasAmmo()) { + wep.add(a); } - } else if( a instanceof Equipment ) { - if( ((Equipment) a).HasAmmo() ) { - wep.add( a ); + } else if (a instanceof Equipment) { + if (((Equipment) a).HasAmmo()) { + wep.add(a); } } } @@ -1039,86 +977,89 @@ private void ResetAmmo() { @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; + GridBagConstraints gridBagConstraints; - pnlInfoPane = new javax.swing.JPanel(); + JPanel pnlInfoPane = new JPanel(); txtInfoTonnage = new javax.swing.JTextField(); txtInfoFreeTons = new javax.swing.JTextField(); txtInfoFreeCrits = new javax.swing.JTextField(); txtTurretInfo = new javax.swing.JTextField(); + txtRearTurretInfo = new javax.swing.JTextField(); txtInfoBattleValue = new javax.swing.JTextField(); txtInfoCost = new javax.swing.JTextField(); tlbIconBar = new javax.swing.JToolBar(); - btnNewVee = new javax.swing.JButton(); - btnOpen = new javax.swing.JButton(); - btnSave = new javax.swing.JButton(); - jSeparator1 = new javax.swing.JToolBar.Separator(); - btnPrint = new javax.swing.JButton(); - jSeparator2 = new javax.swing.JToolBar.Separator(); - btnExportClipboardIcon = new javax.swing.JButton(); - btnExportHTMLIcon = new javax.swing.JButton(); - btnExportTextIcon = new javax.swing.JButton(); - btnExportMTFIcon = new javax.swing.JButton(); - btnChatInfo = new javax.swing.JButton(); - jSeparator3 = new javax.swing.JToolBar.Separator(); - jSeparator25 = new javax.swing.JToolBar.Separator(); - btnAddToForceList = new javax.swing.JButton(); - btnForceList = new javax.swing.JButton(); - jSeparator4 = new javax.swing.JToolBar.Separator(); - btnOptions = new javax.swing.JButton(); - jSeparator21 = new javax.swing.JToolBar.Separator(); - lblSelectVariant = new javax.swing.JLabel(); + JButton btnNewVee = new JButton(); + JButton btnOpen = new JButton(); + JButton btnSave = new JButton(); + JToolBar.Separator jSeparator1 = new JToolBar.Separator(); + JButton btnPrint = new JButton(); + JToolBar.Separator jSeparator2 = new JToolBar.Separator(); + JButton btnExportClipboardIcon = new JButton(); + JButton btnExportHTMLIcon = new JButton(); + JButton btnExportTextIcon = new JButton(); + JButton btnExportMTFIcon = new JButton(); + JButton btnChatInfo = new JButton(); + JToolBar.Separator jSeparator3 = new JToolBar.Separator(); + JToolBar.Separator jSeparator25 = new JToolBar.Separator(); + JButton btnAddToForceList = new JButton(); + JButton btnForceList = new JButton(); + JToolBar.Separator jSeparator4 = new JToolBar.Separator(); + JButton btnOptions = new JButton(); + JToolBar.Separator jSeparator21 = new JToolBar.Separator(); + JLabel lblSelectVariant = new JLabel(); cmbOmniVariant = new javax.swing.JComboBox(); - tbpMainTabPane = new javax.swing.JTabbedPane(); + tbpMainTabPane = new JTabbedPane(); pnlBasicSetup = new javax.swing.JPanel(); - jPanel5 = new javax.swing.JPanel(); - jLabel1 = new javax.swing.JLabel(); + JPanel pnlBasicInfo = new JPanel(); + JLabel jLabel1 = new JLabel(); txtVehicleName = new javax.swing.JTextField(); - jLabel4 = new javax.swing.JLabel(); + JLabel jLabel4 = new JLabel(); txtModel = new javax.swing.JTextField(); - jLabel2 = new javax.swing.JLabel(); + JLabel jLabel2 = new JLabel(); cmbRulesLevel = new javax.swing.JComboBox(); - jLabel5 = new javax.swing.JLabel(); + JLabel jLabel5 = new JLabel(); cmbEra = new javax.swing.JComboBox(); - jLabel3 = new javax.swing.JLabel(); + JLabel jLabel3 = new JLabel(); cmbTechBase = new javax.swing.JComboBox(); lblEraYears = new javax.swing.JLabel(); chkYearRestrict = new javax.swing.JCheckBox(); - jLabel81 = new javax.swing.JLabel(); + JLabel jLabel81 = new JLabel(); txtSource = new javax.swing.JTextField(); - lblProdYear = new javax.swing.JLabel(); + JLabel lblProdYear = new JLabel(); txtProdYear = new javax.swing.JTextField(); cmbProductionEra = new javax.swing.JComboBox(); - pnlChassis = new javax.swing.JPanel(); + JPanel pnlChassis = new JPanel(); cmbMotiveType = new javax.swing.JComboBox(); - jLabel7 = new javax.swing.JLabel(); - jLabel8 = new javax.swing.JLabel(); + JLabel jLabel7 = new JLabel(); + JLabel jLabel8 = new JLabel(); chkOmniVee = new javax.swing.JCheckBox(); chkTrailer = new javax.swing.JCheckBox(); spnTonnage = new javax.swing.JSpinner(); - jLabel9 = new javax.swing.JLabel(); + JLabel jLabel9 = new JLabel(); cmbEngineType = new javax.swing.JComboBox(); - jLabel32 = new javax.swing.JLabel(); + JLabel jLabel32 = new JLabel(); cmbTurret = new javax.swing.JComboBox(); lblVeeClass = new javax.swing.JLabel(); lblVeeLimits = new javax.swing.JLabel(); - jLabel91 = new javax.swing.JLabel(); + JLabel jLabel91 = new JLabel(); spnHeatSinks = new javax.swing.JSpinner(); spnTurretTonnage = new javax.swing.JSpinner(); - pnlMovement = new javax.swing.JPanel(); - jLabel10 = new javax.swing.JLabel(); + spnRearTurretTonnage = new javax.swing.JSpinner(); + JPanel pnlMovement = new JPanel(); + JLabel jLabel10 = new JLabel(); spnCruiseMP = new javax.swing.JSpinner(); - jLabel11 = new javax.swing.JLabel(); + JLabel jLabel11 = new JLabel(); lblFlankMP = new javax.swing.JLabel(); - jLabel13 = new javax.swing.JLabel(); + lblMoveSummary = new javax.swing.JLabel(); + JLabel jLabel13 = new JLabel(); spnJumpMP = new javax.swing.JSpinner(); - pnlChassisMods = new javax.swing.JPanel(); + JPanel pnlChassisMods = new JPanel(); chkFlotationHull = new javax.swing.JCheckBox(); chkLimitedAmph = new javax.swing.JCheckBox(); chkFullAmph = new javax.swing.JCheckBox(); chkDuneBuggy = new javax.swing.JCheckBox(); chkEnviroSealing = new javax.swing.JCheckBox(); - pnlExperimental = new javax.swing.JPanel(); + JPanel pnlExperimental = new JPanel(); chkArmoredMotive = new javax.swing.JCheckBox(); chkCommandConsole = new javax.swing.JCheckBox(); chkEscapePod = new javax.swing.JCheckBox(); @@ -1126,230 +1067,203 @@ private void initComponents() { chkJetBooster = new javax.swing.JCheckBox(); chkSupercharger = new javax.swing.JCheckBox(); chkSponsonTurret = new javax.swing.JCheckBox(); - jPanel11 = new javax.swing.JPanel(); + JPanel jPanel11 = new JPanel(); chkFractional = new javax.swing.JCheckBox(); - pnlSummary = new javax.swing.JPanel(); - jLabel12 = new javax.swing.JLabel(); - jLabel14 = new javax.swing.JLabel(); - jLabel15 = new javax.swing.JLabel(); - jLabel16 = new javax.swing.JLabel(); - jLabel17 = new javax.swing.JLabel(); + JPanel pnlSummary = new JPanel(); + JLabel jLabel12 = new JLabel(); + JLabel jLabel14 = new JLabel(); + JLabel jLabel15 = new JLabel(); + JLabel jLabel16 = new JLabel(); + JLabel jLabel17 = new JLabel(); txtSumIntTons = new javax.swing.JTextField(); txtSumIntAV = new javax.swing.JTextField(); - jLabel18 = new javax.swing.JLabel(); + JLabel jLabel18 = new JLabel(); txtSumEngTons = new javax.swing.JTextField(); txtSumEngAV = new javax.swing.JTextField(); - jLabel19 = new javax.swing.JLabel(); + JLabel jLabel19 = new JLabel(); txtSumLifTons = new javax.swing.JTextField(); txtSumLifAV = new javax.swing.JTextField(); txtSumEngSpace = new javax.swing.JTextField(); - jLabel20 = new javax.swing.JLabel(); + JLabel jLabel20 = new JLabel(); txtSumConTons = new javax.swing.JTextField(); txtSumConAV = new javax.swing.JTextField(); - jLabel21 = new javax.swing.JLabel(); + JLabel jLabel21 = new JLabel(); txtSumJJTons = new javax.swing.JTextField(); - txtSumJJSpace = new javax.swing.JTextField(); + JTextField txtSumJJSpace = new JTextField(); txtSumJJAV = new javax.swing.JTextField(); - jLabel22 = new javax.swing.JLabel(); + JLabel jLabel22 = new JLabel(); txtSumHSTons = new javax.swing.JTextField(); txtSumHSAV = new javax.swing.JTextField(); - jLabel23 = new javax.swing.JLabel(); + JLabel jLabel23 = new JLabel(); txtSumArmTons = new javax.swing.JTextField(); txtSumArmSpace = new javax.swing.JTextField(); txtSumArmAV = new javax.swing.JTextField(); - jLabel24 = new javax.swing.JLabel(); + JLabel jLabel24 = new JLabel(); txtSumTurTons = new javax.swing.JTextField(); txtSumTurAV = new javax.swing.JTextField(); - jLabel25 = new javax.swing.JLabel(); + JLabel jLabel25 = new JLabel(); txtSumRTuTons = new javax.swing.JTextField(); txtSumRTuAV = new javax.swing.JTextField(); - jLabel26 = new javax.swing.JLabel(); + JLabel jLabel26 = new JLabel(); txtSumSpnTons = new javax.swing.JTextField(); txtSumSpnAV = new javax.swing.JTextField(); - jLabel27 = new javax.swing.JLabel(); + JLabel jLabel27 = new JLabel(); txtSumPATons = new javax.swing.JTextField(); txtSumPAAV = new javax.swing.JTextField(); - pnlInformation = new javax.swing.JPanel(); - jLabel29 = new javax.swing.JLabel(); + JPanel pnlInformation = new JPanel(); + JLabel jLabel29 = new JLabel(); lblSupensionFacter = new javax.swing.JLabel(); - jLabel31 = new javax.swing.JLabel(); + JLabel jLabel31 = new JLabel(); lblMinEngineTons = new javax.swing.JLabel(); - jLabel33 = new javax.swing.JLabel(); + JLabel jLabel33 = new JLabel(); lblBaseEngineRating = new javax.swing.JLabel(); - jLabel35 = new javax.swing.JLabel(); + JLabel jLabel35 = new JLabel(); lblFinalEngineRating = new javax.swing.JLabel(); - jLabel28 = new javax.swing.JLabel(); + JLabel jLabel28 = new JLabel(); lblFreeHeatSinks = new javax.swing.JLabel(); - jLabel30 = new javax.swing.JLabel(); + JLabel jLabel30 = new JLabel(); lblNumCrew = new javax.swing.JLabel(); - pnlOmniInfo = new javax.swing.JPanel(); + JPanel pnlOmniInfo = new JPanel(); btnLockChassis = new javax.swing.JButton(); btnAddVariant = new javax.swing.JButton(); btnDeleteVariant = new javax.swing.JButton(); btnRenameVariant = new javax.swing.JButton(); - jPanel2 = new javax.swing.JPanel(); - jPanel6 = new javax.swing.JPanel(); - pnlRightArmor = new javax.swing.JPanel(); + JPanel jPanel2 = new JPanel(); + JPanel jPanel6 = new JPanel(); + JPanel pnlRightArmor = new JPanel(); lblRightIntPts = new javax.swing.JLabel(); - jLabel40 = new javax.swing.JLabel(); - jLabel46 = new javax.swing.JLabel(); + JLabel jLabel40 = new JLabel(); + JLabel jLabel46 = new JLabel(); spnRightArmor = new javax.swing.JSpinner(); - pnlFrontArmor = new javax.swing.JPanel(); + JPanel pnlFrontArmor = new JPanel(); lblFrontIntPts = new javax.swing.JLabel(); - jLabel45 = new javax.swing.JLabel(); - jLabel47 = new javax.swing.JLabel(); + JLabel jLabel45 = new JLabel(); + JLabel jLabel47 = new JLabel(); spnFrontArmor = new javax.swing.JSpinner(); - pnlLeftArmor = new javax.swing.JPanel(); + JPanel pnlLeftArmor = new JPanel(); lblLeftIntPts = new javax.swing.JLabel(); - jLabel41 = new javax.swing.JLabel(); - jLabel48 = new javax.swing.JLabel(); + JLabel jLabel41 = new JLabel(); + JLabel jLabel48 = new JLabel(); spnLeftArmor = new javax.swing.JSpinner(); - pnlRearArmor = new javax.swing.JPanel(); + JPanel pnlRearArmor = new JPanel(); lblRearIntPts = new javax.swing.JLabel(); - jLabel44 = new javax.swing.JLabel(); - jLabel49 = new javax.swing.JLabel(); + JLabel jLabel44 = new JLabel(); + JLabel jLabel49 = new JLabel(); spnRearArmor = new javax.swing.JSpinner(); pnlTurretArmor = new javax.swing.JPanel(); lblTurretIntPts = new javax.swing.JLabel(); - jLabel42 = new javax.swing.JLabel(); - jLabel50 = new javax.swing.JLabel(); + JLabel jLabel42 = new JLabel(); + JLabel jLabel50 = new JLabel(); spnTurretArmor = new javax.swing.JSpinner(); pnlRearTurretArmor = new javax.swing.JPanel(); lblRearTurretIntPts = new javax.swing.JLabel(); - jLabel43 = new javax.swing.JLabel(); - jLabel51 = new javax.swing.JLabel(); + JLabel jLabel43 = new JLabel(); + JLabel jLabel51 = new JLabel(); spnRearTurretArmor = new javax.swing.JSpinner(); pnlRotorArmor = new javax.swing.JPanel(); lblRotorIntPts = new javax.swing.JLabel(); - jLabel92 = new javax.swing.JLabel(); - jLabel93 = new javax.swing.JLabel(); + JLabel jLabel92 = new JLabel(); + JLabel jLabel93 = new JLabel(); spnRotorArmor = new javax.swing.JSpinner(); - jPanel7 = new javax.swing.JPanel(); - jLabel52 = new javax.swing.JLabel(); + JPanel pnlArmorType = new JPanel(); + JLabel jLabel52 = new JLabel(); cmbArmorType = new javax.swing.JComboBox(); chkBalanceLRArmor = new javax.swing.JCheckBox(); chkBalanceFRArmor = new javax.swing.JCheckBox(); btnSetArmorTons = new javax.swing.JButton(); btnUseRemaining = new javax.swing.JButton(); btnMaximize = new javax.swing.JButton(); - jPanel8 = new javax.swing.JPanel(); - jLabel34 = new javax.swing.JLabel(); - jLabel36 = new javax.swing.JLabel(); + JPanel jPanel8 = new JPanel(); + JLabel jLabel34 = new JLabel(); + JLabel jLabel36 = new JLabel(); lblArmorTotals = new javax.swing.JLabel(); lblArmorCoverage = new javax.swing.JLabel(); txtArmorTons = new javax.swing.JTextField(); txtArmorSpace = new javax.swing.JTextField(); lblArmorTonsWasted = new javax.swing.JLabel(); lblArmorLeftInLot = new javax.swing.JLabel(); - jPanel3 = new javax.swing.JPanel(); - tbpWeaponChooser = new javax.swing.JTabbedPane(); - pnlBallistic = new javax.swing.JPanel(); - jSeparator5 = new javax.swing.JSeparator(); - jScrollPane8 = new javax.swing.JScrollPane(); + pnlEquipment = new javax.swing.JPanel(); + tbpWeaponChooser = new JTabbedPane(); lstChooseBallistic = new javax.swing.JList(); - jSeparator6 = new javax.swing.JSeparator(); - pnlEnergy = new javax.swing.JPanel(); - jSeparator7 = new javax.swing.JSeparator(); - jScrollPane9 = new javax.swing.JScrollPane(); lstChooseEnergy = new javax.swing.JList(); - jSeparator8 = new javax.swing.JSeparator(); - pnlMissile = new javax.swing.JPanel(); - jSeparator9 = new javax.swing.JSeparator(); - jScrollPane19 = new javax.swing.JScrollPane(); lstChooseMissile = new javax.swing.JList(); - jSeparator10 = new javax.swing.JSeparator(); - pnlPhysical = new javax.swing.JPanel(); - jSeparator11 = new javax.swing.JSeparator(); - jScrollPane20 = new javax.swing.JScrollPane(); lstChoosePhysical = new javax.swing.JList(); - jSeparator12 = new javax.swing.JSeparator(); - pnlEquipmentChooser = new javax.swing.JPanel(); - jSeparator13 = new javax.swing.JSeparator(); - jScrollPane21 = new javax.swing.JScrollPane(); lstChooseEquipment = new javax.swing.JList(); - jSeparator14 = new javax.swing.JSeparator(); - pnlArtillery = new javax.swing.JPanel(); - jSeparator18 = new javax.swing.JSeparator(); - jScrollPane24 = new javax.swing.JScrollPane(); lstChooseArtillery = new javax.swing.JList(); - jSeparator19 = new javax.swing.JSeparator(); - pnlAmmunition = new javax.swing.JPanel(); - jSeparator15 = new javax.swing.JSeparator(); - jScrollPane22 = new javax.swing.JScrollPane(); lstChooseAmmunition = new javax.swing.JList(); - jSeparator16 = new javax.swing.JSeparator(); - pnlSpecials = new javax.swing.JPanel(); - jLabel37 = new javax.swing.JLabel(); + JPanel pnlSpecials = new JPanel(); + JLabel jLabel37 = new JLabel(); chkUseTC = new javax.swing.JCheckBox(); chkFCSAIV = new javax.swing.JCheckBox(); chkFCSAV = new javax.swing.JCheckBox(); chkFCSApollo = new javax.swing.JCheckBox(); - chkClanCASE = new javax.swing.JCheckBox(); - pnlSelected = new javax.swing.JPanel(); - jScrollPane23 = new javax.swing.JScrollPane(); + chkCASE = new javax.swing.JCheckBox(); + JPanel pnlSelected = new JPanel(); + JScrollPane scrSelectedEquip = new JScrollPane(); lstSelectedEquipment = new javax.swing.JList(); - pnlEquipInfo = new javax.swing.JPanel(); - jLabel38 = new javax.swing.JLabel(); - jLabel39 = new javax.swing.JLabel(); - jLabel53 = new javax.swing.JLabel(); + JPanel pnlEquipInfo = new JPanel(); + JLabel jLabel38 = new JLabel(); + JLabel jLabel39 = new JLabel(); + JLabel jLabel53 = new JLabel(); lblInfoAVSL = new javax.swing.JLabel(); lblInfoAVSW = new javax.swing.JLabel(); lblInfoAVCI = new javax.swing.JLabel(); - jLabel54 = new javax.swing.JLabel(); - jLabel55 = new javax.swing.JLabel(); - jLabel56 = new javax.swing.JLabel(); + JLabel jLabel54 = new JLabel(); + JLabel jLabel55 = new JLabel(); + JLabel jLabel56 = new JLabel(); lblInfoIntro = new javax.swing.JLabel(); lblInfoExtinct = new javax.swing.JLabel(); lblInfoReintro = new javax.swing.JLabel(); - jLabel57 = new javax.swing.JLabel(); - jLabel58 = new javax.swing.JLabel(); - jLabel59 = new javax.swing.JLabel(); - jLabel60 = new javax.swing.JLabel(); - jLabel61 = new javax.swing.JLabel(); + JLabel jLabel57 = new JLabel(); + JLabel jLabel58 = new JLabel(); + JLabel jLabel59 = new JLabel(); + JLabel jLabel60 = new JLabel(); + JLabel jLabel61 = new JLabel(); lblInfoName = new javax.swing.JLabel(); lblInfoType = new javax.swing.JLabel(); lblInfoHeat = new javax.swing.JLabel(); lblInfoDamage = new javax.swing.JLabel(); lblInfoRange = new javax.swing.JLabel(); - jSeparator17 = new javax.swing.JSeparator(); - jLabel62 = new javax.swing.JLabel(); - jLabel63 = new javax.swing.JLabel(); - jLabel64 = new javax.swing.JLabel(); - jLabel65 = new javax.swing.JLabel(); + JSeparator jSeparator17 = new JSeparator(); + JLabel jLabel62 = new JLabel(); + JLabel jLabel63 = new JLabel(); + JLabel jLabel64 = new JLabel(); + JLabel jLabel65 = new JLabel(); lblInfoAmmo = new javax.swing.JLabel(); lblInfoTonnage = new javax.swing.JLabel(); lblInfoCrits = new javax.swing.JLabel(); lblInfoSpecials = new javax.swing.JLabel(); - jSeparator20 = new javax.swing.JSeparator(); - jLabel66 = new javax.swing.JLabel(); + JSeparator jSeparator20 = new JSeparator(); + JLabel jLabel66 = new JLabel(); lblInfoCost = new javax.swing.JLabel(); - jLabel67 = new javax.swing.JLabel(); + JLabel jLabel67 = new JLabel(); lblInfoBV = new javax.swing.JLabel(); - jLabel68 = new javax.swing.JLabel(); + JLabel jLabel68 = new JLabel(); lblInfoMountRestrict = new javax.swing.JLabel(); - jLabel69 = new javax.swing.JLabel(); + JLabel jLabel69 = new JLabel(); lblInfoRulesLevel = new javax.swing.JLabel(); - jLabel6 = new javax.swing.JLabel(); + JLabel jLabel6 = new JLabel(); lblInfoAVDA = new javax.swing.JLabel(); - pnlControls = new javax.swing.JPanel(); - btnRemoveEquip = new javax.swing.JButton(); - btnClearEquip = new javax.swing.JButton(); - btnAddEquip = new javax.swing.JButton(); + JPanel pnlControls = new JPanel(); + JButton btnRemoveEquip = new JButton(); + JButton btnClearEquip = new JButton(); + // Variables declaration - do not modify//GEN-BEGIN:variables + JButton btnAddEquip = new JButton(); cmbNumEquips = new javax.swing.JComboBox(); - jScrollPane1 = new javax.swing.JScrollPane(); + JScrollPane jScrollPane1 = new JScrollPane(); cmbLocation = new javax.swing.JList(); - jPanel4 = new javax.swing.JPanel(); - pnlFluff = new javax.swing.JPanel(); - pnlImage = new javax.swing.JPanel(); + JPanel jPanel4 = new JPanel(); + JPanel pnlFluff = new JPanel(); + JPanel pnlImage = new JPanel(); lblFluffImage = new javax.swing.JLabel(); - jPanel1 = new javax.swing.JPanel(); - btnLoadImage = new javax.swing.JButton(); - btnClearImage = new javax.swing.JButton(); - pnlExport = new javax.swing.JPanel(); - btnExportTXT = new javax.swing.JButton(); - btnExportHTML = new javax.swing.JButton(); - btnExportMTF = new javax.swing.JButton(); - tbpFluffEditors = new javax.swing.JTabbedPane(); + JPanel jPanel1 = new JPanel(); + JButton btnLoadImage = new JButton(); + JButton btnClearImage = new JButton(); + JPanel pnlExport = new JPanel(); + JButton btnExportTXT = new JButton(); + JButton btnExportHTML = new JButton(); + JButton btnExportMTF = new JButton(); + JTabbedPane tbpFluffEditors = new JTabbedPane(); pnlOverview = new javax.swing.JPanel(); pnlCapabilities = new javax.swing.JPanel(); pnlHistory = new javax.swing.JPanel(); @@ -1357,45 +1271,45 @@ private void initComponents() { pnlVariants = new javax.swing.JPanel(); pnlNotables = new javax.swing.JPanel(); pnlAdditionalFluff = new javax.swing.JPanel(); - pnlManufacturers = new javax.swing.JPanel(); - jLabel82 = new javax.swing.JLabel(); - jLabel83 = new javax.swing.JLabel(); - jLabel84 = new javax.swing.JLabel(); - jLabel85 = new javax.swing.JLabel(); - jLabel86 = new javax.swing.JLabel(); - jLabel87 = new javax.swing.JLabel(); - jLabel88 = new javax.swing.JLabel(); - jLabel89 = new javax.swing.JLabel(); + JPanel pnlManufacturers = new JPanel(); + JLabel jLabel82 = new JLabel(); + JLabel jLabel83 = new JLabel(); + JLabel jLabel84 = new JLabel(); + JLabel jLabel85 = new JLabel(); + JLabel jLabel86 = new JLabel(); + JLabel jLabel87 = new JLabel(); + JLabel jLabel88 = new JLabel(); + JLabel jLabel89 = new JLabel(); txtManufacturer = new javax.swing.JTextField(); txtEngineManufacturer = new javax.swing.JTextField(); txtArmorModel = new javax.swing.JTextField(); txtChassisModel = new javax.swing.JTextField(); txtCommSystem = new javax.swing.JTextField(); txtTNTSystem = new javax.swing.JTextField(); - pnlWeaponsManufacturers = new javax.swing.JPanel(); + JPanel pnlWeaponsManufacturers = new JPanel(); chkIndividualWeapons = new javax.swing.JCheckBox(); - scpWeaponManufacturers = new javax.swing.JScrollPane(); + JScrollPane scpWeaponManufacturers = new JScrollPane(); tblWeaponManufacturers = new javax.swing.JTable(); txtManufacturerLocation = new javax.swing.JTextField(); - jLabel90 = new javax.swing.JLabel(); + JLabel jLabel90 = new JLabel(); txtJJModel = new javax.swing.JTextField(); - pnlQuirks = new javax.swing.JPanel(); - lblBattleMechQuirks = new javax.swing.JLabel(); - scpQuirkTable = new javax.swing.JScrollPane(); - tblQuirks = new javax.swing.JTable(); - btnAddQuirk = new javax.swing.JButton(); - jPanel9 = new javax.swing.JPanel(); - pnlBFStats = new javax.swing.JPanel(); - jLabel70 = new javax.swing.JLabel(); - jLabel71 = new javax.swing.JLabel(); - jLabel72 = new javax.swing.JLabel(); - jLabel73 = new javax.swing.JLabel(); - jLabel74 = new javax.swing.JLabel(); - jLabel75 = new javax.swing.JLabel(); - jLabel76 = new javax.swing.JLabel(); - jLabel77 = new javax.swing.JLabel(); - jLabel78 = new javax.swing.JLabel(); - jLabel79 = new javax.swing.JLabel(); + JPanel pnlQuirks = new JPanel(); + JLabel lblBattleMechQuirks = new JLabel(); + JScrollPane scpQuirkTable = new JScrollPane(); + tblQuirks = new JTable(); + JButton btnAddQuirk = new JButton(); + JPanel jPanel9 = new JPanel(); + JPanel pnlBFStats = new JPanel(); + JLabel jLabel70 = new JLabel(); + JLabel jLabel71 = new JLabel(); + JLabel jLabel72 = new JLabel(); + JLabel jLabel73 = new JLabel(); + JLabel jLabel74 = new JLabel(); + JLabel jLabel75 = new JLabel(); + JLabel jLabel76 = new JLabel(); + JLabel jLabel77 = new JLabel(); + JLabel jLabel78 = new JLabel(); + JLabel jLabel79 = new JLabel(); lblBFMV = new javax.swing.JLabel(); lblBFWt = new javax.swing.JLabel(); lblBFOV = new javax.swing.JLabel(); @@ -1406,53 +1320,53 @@ private void initComponents() { lblBFArmor = new javax.swing.JLabel(); lblBFStructure = new javax.swing.JLabel(); lblBFSA = new javax.swing.JLabel(); - jLabel80 = new javax.swing.JLabel(); + JLabel jLabel80 = new JLabel(); lblBFPoints = new javax.swing.JLabel(); - jPanel10 = new javax.swing.JPanel(); - jScrollPane14 = new javax.swing.JScrollPane(); + JPanel jPanel10 = new JPanel(); + JScrollPane jScrollPane14 = new JScrollPane(); jTextAreaBFConversion = new javax.swing.JTextArea(); - jMenuBar1 = new javax.swing.JMenuBar(); - mnuFile = new javax.swing.JMenu(); - mnuNewMech = new javax.swing.JMenuItem(); - mnuLoad = new javax.swing.JMenuItem(); - mnuOpen = new javax.swing.JMenuItem(); - mnuImport = new javax.swing.JMenu(); - mnuImportHMP = new javax.swing.JMenuItem(); - mnuBatchHMP = new javax.swing.JMenuItem(); - jSeparator22 = new javax.swing.JSeparator(); - mnuSave = new javax.swing.JMenuItem(); - mnuSaveAs = new javax.swing.JMenuItem(); - mnuExport = new javax.swing.JMenu(); - mnuExportHTML = new javax.swing.JMenuItem(); - mnuExportMTF = new javax.swing.JMenuItem(); - mnuExportTXT = new javax.swing.JMenuItem(); - mnuExportClipboard = new javax.swing.JMenuItem(); - mnuCreateTCGMech = new javax.swing.JMenuItem(); - jSeparator23 = new javax.swing.JSeparator(); - mnuPrint = new javax.swing.JMenu(); - mnuPrintPreview = new javax.swing.JMenuItem(); - jSeparator24 = new javax.swing.JSeparator(); - mnuExit = new javax.swing.JMenuItem(); - mnuClearFluff = new javax.swing.JMenu(); - mnuSummary = new javax.swing.JMenuItem(); - mnuCostBVBreakdown = new javax.swing.JMenuItem(); - mnuTextTRO = new javax.swing.JMenuItem(); - jSeparator26 = new javax.swing.JSeparator(); - mnuBFB = new javax.swing.JMenuItem(); - jSeparator27 = new javax.swing.JSeparator(); - mnuOptions = new javax.swing.JMenuItem(); + JMenuBar jMenuBar1 = new JMenuBar(); + JMenu mnuFile = new JMenu(); + JMenuItem mnuNewMech = new JMenuItem(); + JMenuItem mnuLoad = new JMenuItem(); + JMenuItem mnuOpen = new JMenuItem(); + JMenu mnuImport = new JMenu(); + JMenuItem mnuImportHMP = new JMenuItem(); + JMenuItem mnuBatchHMP = new JMenuItem(); + JSeparator jSeparator22 = new JSeparator(); + JMenuItem mnuSave = new JMenuItem(); + JMenuItem mnuSaveAs = new JMenuItem(); + JMenu mnuExport = new JMenu(); + JMenuItem mnuExportHTML = new JMenuItem(); + JMenuItem mnuExportMTF = new JMenuItem(); + JMenuItem mnuExportTXT = new JMenuItem(); + JMenuItem mnuExportClipboard = new JMenuItem(); + JMenuItem mnuCreateTCGMech = new JMenuItem(); + JSeparator jSeparator23 = new JSeparator(); + JMenu mnuPrint = new JMenu(); + JMenuItem mnuPrintPreview = new JMenuItem(); + JSeparator jSeparator24 = new JSeparator(); + JMenuItem mnuExit = new JMenuItem(); + JMenu mnuClearFluff = new JMenu(); + JMenuItem mnuSummary = new JMenuItem(); + JMenuItem mnuCostBVBreakdown = new JMenuItem(); + JMenuItem mnuTextTRO = new JMenuItem(); + JSeparator jSeparator26 = new JSeparator(); + JMenuItem mnuBFB = new JMenuItem(); + JSeparator jSeparator27 = new JSeparator(); + JMenuItem mnuOptions = new JMenuItem(); mnuViewToolbar = new javax.swing.JCheckBoxMenuItem(); - mnuClearUserData = new javax.swing.JMenuItem(); - jSeparator30 = new javax.swing.JSeparator(); + JMenuItem mnuClearUserData = new JMenuItem(); + JSeparator jSeparator30 = new JSeparator(); mnuUnlock = new javax.swing.JMenuItem(); - jMenuItem1 = new javax.swing.JMenuItem(); - mnuReloadEquipment = new javax.swing.JMenuItem(); - mnuHelp = new javax.swing.JMenu(); - mnuCredits = new javax.swing.JMenuItem(); - mnuAboutSSW = new javax.swing.JMenuItem(); + JMenuItem jMenuItem1 = new JMenuItem(); + JMenuItem mnuReloadEquipment = new JMenuItem(); + JMenu mnuHelp = new JMenu(); + JMenuItem mnuCredits = new JMenuItem(); + JMenuItem mnuAboutSSW = new JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setMinimumSize(new java.awt.Dimension(800, 600)); + setMinimumSize(new Dimension(800, 600)); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { @@ -1463,49 +1377,57 @@ public void windowClosed(java.awt.event.WindowEvent evt) { txtInfoTonnage.setEditable(false); txtInfoTonnage.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoTonnage.setText("Tonnage: 000.00"); - txtInfoTonnage.setMaximumSize(new java.awt.Dimension(110, 20)); - txtInfoTonnage.setMinimumSize(new java.awt.Dimension(110, 20)); - txtInfoTonnage.setPreferredSize(new java.awt.Dimension(110, 20)); + txtInfoTonnage.setMaximumSize(new Dimension(110, 20)); + txtInfoTonnage.setMinimumSize(new Dimension(110, 20)); + txtInfoTonnage.setPreferredSize(new Dimension(110, 20)); pnlInfoPane.add(txtInfoTonnage); txtInfoFreeTons.setEditable(false); txtInfoFreeTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoFreeTons.setText("Free Tons: 000.00"); - txtInfoFreeTons.setMaximumSize(new java.awt.Dimension(115, 20)); - txtInfoFreeTons.setMinimumSize(new java.awt.Dimension(115, 20)); - txtInfoFreeTons.setPreferredSize(new java.awt.Dimension(115, 20)); + txtInfoFreeTons.setMaximumSize(new Dimension(115, 20)); + txtInfoFreeTons.setMinimumSize(new Dimension(115, 20)); + txtInfoFreeTons.setPreferredSize(new Dimension(115, 20)); pnlInfoPane.add(txtInfoFreeTons); txtInfoFreeCrits.setEditable(false); txtInfoFreeCrits.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoFreeCrits.setText("Space: 00"); - txtInfoFreeCrits.setMaximumSize(new java.awt.Dimension(65, 20)); - txtInfoFreeCrits.setMinimumSize(new java.awt.Dimension(65, 20)); - txtInfoFreeCrits.setPreferredSize(new java.awt.Dimension(65, 20)); + txtInfoFreeCrits.setMaximumSize(new Dimension(65, 20)); + txtInfoFreeCrits.setMinimumSize(new Dimension(65, 20)); + txtInfoFreeCrits.setPreferredSize(new Dimension(65, 20)); pnlInfoPane.add(txtInfoFreeCrits); txtTurretInfo.setEditable(false); txtTurretInfo.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtTurretInfo.setText("Turret: 000.00"); - txtTurretInfo.setMaximumSize(new java.awt.Dimension(120, 20)); - txtTurretInfo.setMinimumSize(new java.awt.Dimension(120, 20)); - txtTurretInfo.setPreferredSize(new java.awt.Dimension(100, 20)); + txtTurretInfo.setText("Turret: 00.0/00.0"); + txtTurretInfo.setMaximumSize(new Dimension(100, 20)); + txtTurretInfo.setMinimumSize(new Dimension(100, 20)); + txtTurretInfo.setPreferredSize(new Dimension(100, 20)); pnlInfoPane.add(txtTurretInfo); + txtRearTurretInfo.setEditable(false); + txtRearTurretInfo.setHorizontalAlignment(javax.swing.JTextField.CENTER); + txtRearTurretInfo.setText("Rear Turret: 00.0/00.0"); + txtRearTurretInfo.setMaximumSize(new Dimension(120, 20)); + txtRearTurretInfo.setMinimumSize(new Dimension(120, 20)); + txtRearTurretInfo.setPreferredSize(new Dimension(120, 20)); + pnlInfoPane.add(txtRearTurretInfo); + txtInfoBattleValue.setEditable(false); txtInfoBattleValue.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoBattleValue.setText("BV: 00,000"); - txtInfoBattleValue.setMaximumSize(new java.awt.Dimension(75, 20)); - txtInfoBattleValue.setMinimumSize(new java.awt.Dimension(75, 20)); - txtInfoBattleValue.setPreferredSize(new java.awt.Dimension(75, 20)); + txtInfoBattleValue.setMaximumSize(new Dimension(75, 20)); + txtInfoBattleValue.setMinimumSize(new Dimension(75, 20)); + txtInfoBattleValue.setPreferredSize(new Dimension(75, 20)); pnlInfoPane.add(txtInfoBattleValue); txtInfoCost.setEditable(false); txtInfoCost.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtInfoCost.setText("Cost: 000,000,000,000.00"); - txtInfoCost.setMaximumSize(new java.awt.Dimension(165, 20)); - txtInfoCost.setMinimumSize(new java.awt.Dimension(165, 20)); - txtInfoCost.setPreferredSize(new java.awt.Dimension(165, 20)); + txtInfoCost.setText("Cost: 000,000,000"); + txtInfoCost.setMaximumSize(new Dimension(120, 20)); + txtInfoCost.setMinimumSize(new Dimension(120, 20)); + txtInfoCost.setPreferredSize(new Dimension(120, 20)); pnlInfoPane.add(txtInfoCost); tlbIconBar.setFloatable(false); @@ -1513,108 +1435,72 @@ public void windowClosed(java.awt.event.WindowEvent evt) { btnNewVee.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document--plus.png"))); // NOI18N btnNewVee.setFocusable(false); - btnNewVee.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnNewVee.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnNewVee.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnNewVeeActionPerformed(evt); - } - }); + btnNewVee.setHorizontalTextPosition(SwingConstants.CENTER); + btnNewVee.setVerticalTextPosition(SwingConstants.BOTTOM); + btnNewVee.addActionListener(this::btnNewVeeActionPerformed); tlbIconBar.add(btnNewVee); btnOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/folder-open-document.png"))); // NOI18N btnOpen.setFocusable(false); - btnOpen.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnOpen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnOpen.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOpenActionPerformed(evt); - } - }); + btnOpen.setHorizontalTextPosition(SwingConstants.CENTER); + btnOpen.setVerticalTextPosition(SwingConstants.BOTTOM); + btnOpen.addActionListener(this::btnOpenActionPerformed); tlbIconBar.add(btnOpen); btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/disk-black.png"))); // NOI18N btnSave.setFocusable(false); - btnSave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnSave.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnSaveActionPerformed(evt); - } - }); + btnSave.setHorizontalTextPosition(SwingConstants.CENTER); + btnSave.setVerticalTextPosition(SwingConstants.BOTTOM); + btnSave.addActionListener(this::btnSaveActionPerformed); tlbIconBar.add(btnSave); tlbIconBar.add(jSeparator1); btnPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/printer.png"))); // NOI18N btnPrint.setFocusable(false); - btnPrint.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnPrint.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnPrint.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnPrintActionPerformed(evt); - } - }); + btnPrint.setHorizontalTextPosition(SwingConstants.CENTER); + btnPrint.setVerticalTextPosition(SwingConstants.BOTTOM); + btnPrint.addActionListener(this::btnPrintActionPerformed); tlbIconBar.add(btnPrint); tlbIconBar.add(jSeparator2); btnExportClipboardIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-clipboard.png"))); // NOI18N btnExportClipboardIcon.setToolTipText("Export Text to Clipboard"); btnExportClipboardIcon.setFocusable(false); - btnExportClipboardIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportClipboardIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportClipboardIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportClipboardIconActionPerformed(evt); - } - }); + btnExportClipboardIcon.setHorizontalTextPosition(SwingConstants.CENTER); + btnExportClipboardIcon.setVerticalTextPosition(SwingConstants.BOTTOM); + btnExportClipboardIcon.addActionListener(this::btnExportClipboardIconActionPerformed); tlbIconBar.add(btnExportClipboardIcon); btnExportHTMLIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-image.png"))); // NOI18N btnExportHTMLIcon.setToolTipText("Export HTML"); btnExportHTMLIcon.setFocusable(false); - btnExportHTMLIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportHTMLIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportHTMLIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportHTMLIconActionPerformed(evt); - } - }); + btnExportHTMLIcon.setHorizontalTextPosition(SwingConstants.CENTER); + btnExportHTMLIcon.setVerticalTextPosition(SwingConstants.BOTTOM); + btnExportHTMLIcon.addActionListener(this::btnExportHTMLIconActionPerformed); tlbIconBar.add(btnExportHTMLIcon); btnExportTextIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-text.png"))); // NOI18N btnExportTextIcon.setToolTipText("Export Text"); btnExportTextIcon.setFocusable(false); - btnExportTextIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportTextIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportTextIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportTextIconActionPerformed(evt); - } - }); + btnExportTextIcon.setHorizontalTextPosition(SwingConstants.CENTER); + btnExportTextIcon.setVerticalTextPosition(SwingConstants.BOTTOM); + btnExportTextIcon.addActionListener(this::btnExportTextIconActionPerformed); tlbIconBar.add(btnExportTextIcon); btnExportMTFIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document--arrow.png"))); // NOI18N btnExportMTFIcon.setToolTipText("Export MTF"); btnExportMTFIcon.setFocusable(false); - btnExportMTFIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportMTFIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportMTFIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportMTFIconActionPerformed(evt); - } - }); + btnExportMTFIcon.setHorizontalTextPosition(SwingConstants.CENTER); + btnExportMTFIcon.setVerticalTextPosition(SwingConstants.BOTTOM); + btnExportMTFIcon.addActionListener(this::btnExportMTFIconActionPerformed); tlbIconBar.add(btnExportMTFIcon); btnChatInfo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/balloon.png"))); // NOI18N btnChatInfo.setToolTipText("Copy Chat Line"); btnChatInfo.setFocusable(false); - btnChatInfo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnChatInfo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnChatInfo.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnChatInfoActionPerformed(evt); - } - }); + btnChatInfo.setHorizontalTextPosition(SwingConstants.CENTER); + btnChatInfo.setVerticalTextPosition(SwingConstants.BOTTOM); + btnChatInfo.addActionListener(this::btnChatInfoActionPerformed); tlbIconBar.add(btnChatInfo); tlbIconBar.add(jSeparator3); tlbIconBar.add(jSeparator25); @@ -1622,37 +1508,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { btnAddToForceList.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/clipboard--plus.png"))); // NOI18N btnAddToForceList.setToolTipText("Add to Force List"); btnAddToForceList.setFocusable(false); - btnAddToForceList.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnAddToForceList.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnAddToForceList.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddToForceListActionPerformed(evt); - } - }); + btnAddToForceList.setHorizontalTextPosition(SwingConstants.CENTER); + btnAddToForceList.setVerticalTextPosition(SwingConstants.BOTTOM); + btnAddToForceList.addActionListener(this::btnAddToForceListActionPerformed); tlbIconBar.add(btnAddToForceList); btnForceList.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/clipboard.png"))); // NOI18N btnForceList.setToolTipText("Force List"); btnForceList.setFocusable(false); - btnForceList.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnForceList.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnForceList.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnForceListActionPerformed(evt); - } - }); + btnForceList.setHorizontalTextPosition(SwingConstants.CENTER); + btnForceList.setVerticalTextPosition(SwingConstants.BOTTOM); + btnForceList.addActionListener(this::btnForceListActionPerformed); tlbIconBar.add(btnForceList); tlbIconBar.add(jSeparator4); btnOptions.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/gear.png"))); // NOI18N btnOptions.setFocusable(false); - btnOptions.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnOptions.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnOptions.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOptionsActionPerformed(evt); - } - }); + btnOptions.setHorizontalTextPosition(SwingConstants.CENTER); + btnOptions.setVerticalTextPosition(SwingConstants.BOTTOM); + btnOptions.addActionListener(this::btnOptionsActionPerformed); tlbIconBar.add(btnOptions); tlbIconBar.add(jSeparator21); @@ -1661,142 +1535,118 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { tlbIconBar.add(lblSelectVariant); cmbOmniVariant.setEnabled(false); - cmbOmniVariant.setMaximumSize(new java.awt.Dimension(150, 20)); - cmbOmniVariant.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbOmniVariant.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbOmniVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbOmniVariantActionPerformed(evt); - } - }); + cmbOmniVariant.setMaximumSize(new Dimension(150, 20)); + cmbOmniVariant.setMinimumSize(new Dimension(150, 20)); + cmbOmniVariant.setPreferredSize(new Dimension(150, 20)); + cmbOmniVariant.addActionListener(this::cmbOmniVariantActionPerformed); tlbIconBar.add(cmbOmniVariant); - jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Basic Information")); + pnlBasicInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Basic Information")); jLabel1.setText("Vehicle Name:"); - txtVehicleName.setMinimumSize(new java.awt.Dimension(150, 20)); - txtVehicleName.setPreferredSize(new java.awt.Dimension(150, 20)); + txtVehicleName.setMinimumSize(new Dimension(150, 20)); + txtVehicleName.setPreferredSize(new Dimension(150, 20)); jLabel4.setText("Model:"); - txtModel.setMinimumSize(new java.awt.Dimension(150, 20)); - txtModel.setPreferredSize(new java.awt.Dimension(150, 20)); + txtModel.setMinimumSize(new Dimension(150, 20)); + txtModel.setPreferredSize(new Dimension(150, 20)); jLabel2.setText("Rules Level:"); - cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced Rules", "Experimental Tech", "Era Specific" })); + cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced", "Experimental" })); cmbRulesLevel.setSelectedIndex(1); - cmbRulesLevel.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbRulesLevel.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbRulesLevel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbRulesLevelActionPerformed(evt); - } - }); + cmbRulesLevel.setMinimumSize(new Dimension(150, 20)); + cmbRulesLevel.setPreferredSize(new Dimension(150, 20)); + cmbRulesLevel.addActionListener(this::cmbRulesLevelActionPerformed); jLabel5.setText("Era:"); cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); cmbEra.setSelectedIndex(1); - cmbEra.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbEra.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbEra.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbEraActionPerformed(evt); - } - }); + cmbEra.setMinimumSize(new Dimension(150, 20)); + cmbEra.setPreferredSize(new Dimension(150, 20)); + cmbEra.addActionListener(this::cmbEraActionPerformed); jLabel3.setText("Tech Base:"); - cmbTechBase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed" })); - cmbTechBase.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbTechBase.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbTechBase.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbTechBaseActionPerformed(evt); - } - }); + cmbTechBase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed Tech" })); + cmbTechBase.setMinimumSize(new Dimension(150, 20)); + cmbTechBase.setPreferredSize(new Dimension(150, 20)); + cmbTechBase.addActionListener(this::cmbTechBaseActionPerformed); lblEraYears.setText("2443~2800"); chkYearRestrict.setText("Restrict Availability by Year"); - chkYearRestrict.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkYearRestrictActionPerformed(evt); - } - }); + chkYearRestrict.addActionListener(this::chkYearRestrictActionPerformed); - jLabel81.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel81.setHorizontalAlignment(SwingConstants.RIGHT); jLabel81.setText("Source:"); - txtSource.setMinimumSize(new java.awt.Dimension(150, 20)); - txtSource.setPreferredSize(new java.awt.Dimension(150, 20)); + txtSource.setMinimumSize(new Dimension(150, 20)); + txtSource.setPreferredSize(new Dimension(150, 20)); lblProdYear.setText("Prod Year/Era:"); txtProdYear.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtProdYear.setDisabledTextColor(new java.awt.Color(0, 0, 0)); - txtProdYear.setMaximumSize(new java.awt.Dimension(60, 20)); - txtProdYear.setMinimumSize(new java.awt.Dimension(60, 20)); - txtProdYear.setPreferredSize(new java.awt.Dimension(60, 20)); - - cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages" })); - cmbProductionEra.setMaximumSize(new java.awt.Dimension(90, 20)); - cmbProductionEra.setMinimumSize(new java.awt.Dimension(90, 20)); - cmbProductionEra.setPreferredSize(new java.awt.Dimension(90, 20)); - cmbProductionEra.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbProductionEraActionPerformed(evt); - } - }); - - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + txtProdYear.setMaximumSize(new Dimension(60, 20)); + txtProdYear.setMinimumSize(new Dimension(60, 20)); + txtProdYear.setPreferredSize(new Dimension(60, 20)); + + cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages", "ilClan" })); + cmbProductionEra.setMaximumSize(new Dimension(90, 20)); + cmbProductionEra.setMinimumSize(new Dimension(90, 20)); + cmbProductionEra.setPreferredSize(new Dimension(90, 20)); + cmbProductionEra.addActionListener(this::cmbProductionEraActionPerformed); + + javax.swing.GroupLayout pnlBasicInfoLayout = new javax.swing.GroupLayout(pnlBasicInfo); + pnlBasicInfo.setLayout(pnlBasicInfoLayout); + pnlBasicInfoLayout.setHorizontalGroup( + pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(22, 22, 22) .addComponent(jLabel2) .addGap(2, 2, 2) .addComponent(cmbRulesLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(60, 60, 60) .addComponent(jLabel5) .addGap(2, 2, 2) .addComponent(cmbEra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(27, 27, 27) .addComponent(jLabel3) .addGap(2, 2, 2) .addComponent(cmbTechBase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(129, 129, 129) .addComponent(lblEraYears)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(5, 5, 5) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel81, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtVehicleName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlBasicInfoLayout.createSequentialGroup() .addGap(2, 2, 2) .addComponent(txtSource, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtModel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))) .addContainerGap(24, Short.MAX_VALUE)) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addComponent(lblProdYear) .addGap(2, 2, 2) .addComponent(txtProdYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1805,46 +1655,46 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(chkYearRestrict)) .addContainerGap(23, Short.MAX_VALUE)) ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + pnlBasicInfoLayout.setVerticalGroup( + pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel1)) .addComponent(txtVehicleName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel4)) .addComponent(txtModel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, 0) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtSource, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel81))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel2)) .addComponent(cmbRulesLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel5)) .addComponent(cmbEra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel3)) .addComponent(cmbTechBase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(2, 2, 2) .addComponent(lblEraYears) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(lblProdYear)) .addComponent(txtProdYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1872,75 +1722,51 @@ public void mousePressed( MouseEvent e ) { pnlChassis.setNextFocusableComponent(spnCruiseMP); cmbMotiveType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Hovercraft", "Naval (Displacement)", "Naval (Hydrofoil)", "Naval (Submarine)", "Tracked", "VTOL", "Wheeled", "WiGE", "Hovercraft (Super Heavy)", "Displacement (Super Heavy)" })); - cmbMotiveType.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbMotiveType.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbMotiveType.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbMotiveTypeActionPerformed(evt); - } - }); + cmbMotiveType.setMinimumSize(new Dimension(150, 20)); + cmbMotiveType.setPreferredSize(new Dimension(150, 20)); + cmbMotiveType.addActionListener(this::cmbMotiveTypeActionPerformed); jLabel7.setText("Motive Type:"); jLabel8.setText("Tonnage:"); chkOmniVee.setText("OmniVehicle"); - chkOmniVee.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkOmniVeeActionPerformed(evt); - } - }); + chkOmniVee.addActionListener(this::chkOmniVeeActionPerformed); chkTrailer.setText("Trailer"); chkTrailer.setEnabled(false); - chkTrailer.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkTrailerActionPerformed(evt); - } - }); + chkTrailer.addActionListener(this::chkTrailerActionPerformed); spnTonnage.setModel(new javax.swing.SpinnerNumberModel(10, 1, null, 1)); - spnTonnage.setMinimumSize(new java.awt.Dimension(45, 20)); - spnTonnage.setPreferredSize(new java.awt.Dimension(45, 20)); - spnTonnage.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnTonnageStateChanged(evt); - } - }); + spnTonnage.setMinimumSize(new Dimension(45, 20)); + spnTonnage.setPreferredSize(new Dimension(45, 20)); + spnTonnage.addChangeListener(this::spnTonnageStateChanged); spnTonnage.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { spnTonnageFocusGained(evt); } }); spnTonnage.addInputMethodListener(new java.awt.event.InputMethodListener() { + public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { + } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnTonnageInputMethodTextChanged(evt); } - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } }); jLabel9.setText("Engine:"); cmbEngineType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "I.C.E.", "Fusion", "Light Fusion", "XL Fusion", "Compact Fusion" })); - cmbEngineType.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbEngineType.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbEngineType.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbEngineTypeActionPerformed(evt); - } - }); + cmbEngineType.setMinimumSize(new Dimension(150, 20)); + cmbEngineType.setPreferredSize(new Dimension(150, 20)); + cmbEngineType.addActionListener(this::cmbEngineTypeActionPerformed); jLabel32.setText("Turret:"); cmbTurret.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No Turret", "Single Turret", "Dual Turret", "Sponson Turrets", "Chin Turret", "Mast Turret" })); - cmbTurret.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbTurretActionPerformed(evt); - } - }); + cmbTurret.addActionListener(this::cmbTurretActionPerformed); - lblVeeClass.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + lblVeeClass.setHorizontalAlignment(SwingConstants.LEFT); lblVeeClass.setText("Assault Vee"); lblVeeLimits.setText("500t Max"); @@ -1948,34 +1774,30 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel91.setText("Heat Sinks:"); spnHeatSinks.setModel(new javax.swing.SpinnerNumberModel(10, 1, null, 1)); - spnHeatSinks.setMinimumSize(new java.awt.Dimension(45, 20)); + spnHeatSinks.setMinimumSize(new Dimension(45, 20)); spnHeatSinks.setNextFocusableComponent(spnCruiseMP); - spnHeatSinks.setPreferredSize(new java.awt.Dimension(45, 20)); - spnHeatSinks.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnHeatSinksStateChanged(evt); - } - }); + spnHeatSinks.setPreferredSize(new Dimension(45, 20)); + spnHeatSinks.addChangeListener(this::spnHeatSinksStateChanged); spnHeatSinks.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { spnHeatSinksFocusGained(evt); } }); spnHeatSinks.addInputMethodListener(new java.awt.event.InputMethodListener() { + public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { + } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnHeatSinksInputMethodTextChanged(evt); } - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } }); spnTurretTonnage.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 50.0d, 0.5d)); spnTurretTonnage.setEnabled(false); - spnTurretTonnage.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnTurretTonnageStateChanged(evt); - } - }); + spnTurretTonnage.addChangeListener(this::spnTurretTonnageStateChanged); + + spnRearTurretTonnage.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 50.0d, 0.5d)); + spnRearTurretTonnage.setEnabled(false); + spnRearTurretTonnage.addChangeListener(this::spnRearTurretTonnageStateChanged); javax.swing.GroupLayout pnlChassisLayout = new javax.swing.GroupLayout(pnlChassis); pnlChassis.setLayout(pnlChassisLayout); @@ -2000,7 +1822,9 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cmbTurret, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(spnTurretTonnage)) + .addComponent(spnTurretTonnage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spnRearTurretTonnage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(pnlChassisLayout.createSequentialGroup() .addComponent(jLabel9) .addGap(2, 2, 2) @@ -2051,7 +1875,8 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel32) .addComponent(cmbTurret, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(spnTurretTonnage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(spnTurretTonnage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(spnRearTurretTonnage, javax.swing.GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlChassisLayout.createSequentialGroup() @@ -2067,31 +1892,29 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { jLabel10.setText("Cruise MP:"); spnCruiseMP.setModel(new javax.swing.SpinnerNumberModel(1, 0, null, 1)); - spnCruiseMP.setMinimumSize(new java.awt.Dimension(45, 20)); - spnCruiseMP.setPreferredSize(new java.awt.Dimension(45, 20)); - spnCruiseMP.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnCruiseMPStateChanged(evt); - } - }); + spnCruiseMP.setMinimumSize(new Dimension(45, 20)); + spnCruiseMP.setPreferredSize(new Dimension(45, 20)); + spnCruiseMP.addChangeListener(this::spnCruiseMPStateChanged); spnCruiseMP.addInputMethodListener(new java.awt.event.InputMethodListener() { + public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { + } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnCruiseMPInputMethodTextChanged(evt); } - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } }); jLabel11.setText("Flank MP:"); lblFlankMP.setText("2"); + lblMoveSummary.setText("W/R: 12/20"); + jLabel13.setText("Jump MP:"); spnJumpMP.setEnabled(false); - spnJumpMP.setMinimumSize(new java.awt.Dimension(45, 20)); + spnJumpMP.setMinimumSize(new Dimension(45, 20)); spnJumpMP.setNextFocusableComponent(chkFlotationHull); - spnJumpMP.setPreferredSize(new java.awt.Dimension(45, 20)); + spnJumpMP.setPreferredSize(new Dimension(45, 20)); javax.swing.GroupLayout pnlMovementLayout = new javax.swing.GroupLayout(pnlMovement); pnlMovement.setLayout(pnlMovementLayout); @@ -2102,38 +1925,33 @@ public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMovementLayout.createSequentialGroup() .addComponent(jLabel10) - .addGap(2, 2, 2) + .addGap(5, 5, 5) .addComponent(spnCruiseMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlMovementLayout.createSequentialGroup() - .addGap(5, 5, 5) - .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addComponent(jLabel11) - .addGap(18, 18, 18) - .addComponent(lblFlankMP)) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addComponent(jLabel13) - .addGap(2, 2, 2) - .addComponent(spnJumpMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))) - .addContainerGap(129, Short.MAX_VALUE)) + .addComponent(jLabel11) + .addGap(18, 18, 18) + .addComponent(lblFlankMP) + .addGap(20, 20, 20) + .addComponent(lblMoveSummary)) + .addGroup(pnlMovementLayout.createSequentialGroup() + .addComponent(jLabel13) + .addGap(10, 10, 10) + .addComponent(spnJumpMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); pnlMovementLayout.setVerticalGroup( pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlMovementLayout.createSequentialGroup() .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addGap(3, 3, 3) - .addComponent(jLabel10)) + .addComponent(jLabel10) .addComponent(spnCruiseMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(2, 2, 2) + .addGap(5, 5, 5) .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11) - .addComponent(lblFlankMP)) - .addGap(2, 2, 2) + .addComponent(lblFlankMP) + .addComponent(lblMoveSummary)) + .addGap(8, 8, 8) .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addGap(3, 3, 3) - .addComponent(jLabel13)) + .addComponent(jLabel13) .addComponent(spnJumpMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); @@ -2143,68 +1961,48 @@ public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { chkFlotationHull.setText("Flotation Hull"); chkFlotationHull.setEnabled(false); - chkFlotationHull.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFlotationHullActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkFlotationHull.addActionListener(this::chkFlotationHullActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlChassisMods.add(chkFlotationHull, gridBagConstraints); chkLimitedAmph.setText("Limited Amphibious"); chkLimitedAmph.setEnabled(false); - chkLimitedAmph.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkLimitedAmphActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkLimitedAmph.addActionListener(this::chkLimitedAmphActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlChassisMods.add(chkLimitedAmph, gridBagConstraints); chkFullAmph.setText("Fully Amphibious"); chkFullAmph.setEnabled(false); - chkFullAmph.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFullAmphActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkFullAmph.addActionListener(this::chkFullAmphActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlChassisMods.add(chkFullAmph, gridBagConstraints); chkDuneBuggy.setText("Dune Buggy"); chkDuneBuggy.setEnabled(false); - chkDuneBuggy.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkDuneBuggyActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkDuneBuggy.addActionListener(this::chkDuneBuggyActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlChassisMods.add(chkDuneBuggy, gridBagConstraints); chkEnviroSealing.setText("Enviro (Vacuum) Sealing"); chkEnviroSealing.setEnabled(false); chkEnviroSealing.setNextFocusableComponent(chkArmoredMotive); - chkEnviroSealing.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkEnviroSealingActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkEnviroSealing.addActionListener(this::chkEnviroSealingActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlChassisMods.add(chkEnviroSealing, gridBagConstraints); pnlExperimental.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Experimental Equipment")); @@ -2218,34 +2016,23 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { chkEscapePod.setText("Combat Vehicle Escape Pod"); chkEscapePod.setEnabled(false); chkEscapePod.setNextFocusableComponent(chkFractional); - chkEscapePod.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkEscapePodActionPerformed(evt); - } - }); + chkEscapePod.addActionListener(this::chkEscapePodActionPerformed); chkMinesweeper.setText("Minesweeper"); chkMinesweeper.setEnabled(false); chkJetBooster.setText("VTOL Jet Booster"); chkJetBooster.setEnabled(false); + chkJetBooster.addActionListener(this::chkJetBoosterActionPerformed); chkSupercharger.setText("Supercharger"); chkSupercharger.setEnabled(false); - chkSupercharger.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkSuperchargerActionPerformed(evt); - } - }); + chkSupercharger.addActionListener(this::chkSuperchargerActionPerformed); chkSponsonTurret.setText("Sponson Turret"); chkSponsonTurret.setEnabled(false); chkSponsonTurret.setNextFocusableComponent(chkFractional); - chkSponsonTurret.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkSponsonTurretActionPerformed(evt); - } - }); + chkSponsonTurret.addActionListener(this::chkSponsonTurretActionPerformed); javax.swing.GroupLayout pnlExperimentalLayout = new javax.swing.GroupLayout(pnlExperimental); pnlExperimental.setLayout(pnlExperimentalLayout); @@ -2287,192 +2074,188 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { chkFractional.setText("Use Fractional Accounting"); chkFractional.setEnabled(false); chkFractional.setNextFocusableComponent(txtVehicleName); - chkFractional.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFractionalActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkFractional.addActionListener(this::chkFractionalActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; jPanel11.add(chkFractional, gridBagConstraints); pnlSummary.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Summary")); pnlSummary.setLayout(new java.awt.GridBagLayout()); jLabel12.setText("Item"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel12, gridBagConstraints); jLabel14.setText("Tonnage"); - pnlSummary.add(jLabel14, new java.awt.GridBagConstraints()); + pnlSummary.add(jLabel14, new GridBagConstraints()); jLabel15.setText("Space"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); pnlSummary.add(jLabel15, gridBagConstraints); jLabel16.setText("Availability"); - pnlSummary.add(jLabel16, new java.awt.GridBagConstraints()); + pnlSummary.add(jLabel16, new GridBagConstraints()); jLabel17.setText("Internal Structure:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel17, gridBagConstraints); txtSumIntTons.setEditable(false); txtSumIntTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumIntTons.setText("000.00"); - txtSumIntTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumIntTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumIntTons.setMinimumSize(new Dimension(50, 20)); + txtSumIntTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumIntTons, gridBagConstraints); txtSumIntAV.setEditable(false); txtSumIntAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumIntAV.setText("X/X-X-X"); - txtSumIntAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumIntAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumIntAV.setMinimumSize(new Dimension(65, 20)); + txtSumIntAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumIntAV, gridBagConstraints); jLabel18.setText("Engine:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel18, gridBagConstraints); txtSumEngTons.setEditable(false); txtSumEngTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumEngTons.setText("000.00"); - txtSumEngTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumEngTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumEngTons.setMinimumSize(new Dimension(50, 20)); + txtSumEngTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumEngTons, gridBagConstraints); txtSumEngAV.setEditable(false); txtSumEngAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumEngAV.setText("X/X-X-X"); - txtSumEngAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumEngAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumEngAV.setMinimumSize(new Dimension(65, 20)); + txtSumEngAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumEngAV, gridBagConstraints); jLabel19.setText("Lift/Dive/Rotor:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel19, gridBagConstraints); txtSumLifTons.setEditable(false); txtSumLifTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumLifTons.setText("000.00"); - txtSumLifTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumLifTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumLifTons.setMinimumSize(new Dimension(50, 20)); + txtSumLifTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumLifTons, gridBagConstraints); txtSumLifAV.setEditable(false); txtSumLifAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumLifAV.setText("X/X-X-X"); - txtSumLifAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumLifAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumLifAV.setMinimumSize(new Dimension(65, 20)); + txtSumLifAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumLifAV, gridBagConstraints); txtSumEngSpace.setEditable(false); txtSumEngSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumEngSpace.setText("00"); - txtSumEngSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtSumEngSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumEngSpace.setMinimumSize(new Dimension(40, 20)); + txtSumEngSpace.setPreferredSize(new Dimension(40, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); pnlSummary.add(txtSumEngSpace, gridBagConstraints); jLabel20.setText("Controls:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel20, gridBagConstraints); txtSumConTons.setEditable(false); txtSumConTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumConTons.setText("000.00"); - txtSumConTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumConTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumConTons.setMinimumSize(new Dimension(50, 20)); + txtSumConTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumConTons, gridBagConstraints); txtSumConAV.setEditable(false); txtSumConAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumConAV.setText("X/X-X-X"); - txtSumConAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumConAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumConAV.setMinimumSize(new Dimension(65, 20)); + txtSumConAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumConAV, gridBagConstraints); jLabel21.setText("Jump Jets:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel21, gridBagConstraints); txtSumJJTons.setEditable(false); txtSumJJTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumJJTons.setText("000.00"); - txtSumJJTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumJJTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumJJTons.setMinimumSize(new Dimension(50, 20)); + txtSumJJTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumJJTons, gridBagConstraints); txtSumJJSpace.setEditable(false); txtSumJJSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumJJSpace.setText("00"); - txtSumJJSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtSumJJSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumJJSpace.setMinimumSize(new Dimension(40, 20)); + txtSumJJSpace.setPreferredSize(new Dimension(40, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); @@ -2481,69 +2264,69 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtSumJJAV.setEditable(false); txtSumJJAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumJJAV.setText("X/X-X-X"); - txtSumJJAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumJJAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumJJAV.setMinimumSize(new Dimension(65, 20)); + txtSumJJAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumJJAV, gridBagConstraints); jLabel22.setText("Heat Sinks:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel22, gridBagConstraints); txtSumHSTons.setEditable(false); txtSumHSTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumHSTons.setText("000.00"); - txtSumHSTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumHSTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumHSTons.setMinimumSize(new Dimension(50, 20)); + txtSumHSTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumHSTons, gridBagConstraints); txtSumHSAV.setEditable(false); txtSumHSAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumHSAV.setText("X/X-X-X"); - txtSumHSAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumHSAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumHSAV.setMinimumSize(new Dimension(65, 20)); + txtSumHSAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumHSAV, gridBagConstraints); jLabel23.setText("Armor:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel23, gridBagConstraints); txtSumArmTons.setEditable(false); txtSumArmTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumArmTons.setText("000.00"); - txtSumArmTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumArmTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumArmTons.setMinimumSize(new Dimension(50, 20)); + txtSumArmTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumArmTons, gridBagConstraints); txtSumArmSpace.setEditable(false); txtSumArmSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumArmSpace.setText("00"); - txtSumArmSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtSumArmSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumArmSpace.setMinimumSize(new Dimension(40, 20)); + txtSumArmSpace.setPreferredSize(new Dimension(40, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 7; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); @@ -2552,132 +2335,132 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtSumArmAV.setEditable(false); txtSumArmAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumArmAV.setText("X/X-X-X"); - txtSumArmAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumArmAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumArmAV.setMinimumSize(new Dimension(65, 20)); + txtSumArmAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumArmAV, gridBagConstraints); jLabel24.setText("Turret:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel24, gridBagConstraints); txtSumTurTons.setEditable(false); txtSumTurTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumTurTons.setText("000.00"); - txtSumTurTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumTurTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumTurTons.setMinimumSize(new Dimension(50, 20)); + txtSumTurTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 8; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumTurTons, gridBagConstraints); txtSumTurAV.setEditable(false); txtSumTurAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumTurAV.setText("X/X-X-X"); - txtSumTurAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumTurAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumTurAV.setMinimumSize(new Dimension(65, 20)); + txtSumTurAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 8; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumTurAV, gridBagConstraints); jLabel25.setText("Rear Turret:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 9; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel25, gridBagConstraints); txtSumRTuTons.setEditable(false); txtSumRTuTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumRTuTons.setText("000.00"); - txtSumRTuTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumRTuTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumRTuTons.setMinimumSize(new Dimension(50, 20)); + txtSumRTuTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 9; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumRTuTons, gridBagConstraints); txtSumRTuAV.setEditable(false); txtSumRTuAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumRTuAV.setText("X/X-X-X"); - txtSumRTuAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumRTuAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumRTuAV.setMinimumSize(new Dimension(65, 20)); + txtSumRTuAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 9; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumRTuAV, gridBagConstraints); jLabel26.setText("Sponsons:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel26, gridBagConstraints); txtSumSpnTons.setEditable(false); txtSumSpnTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumSpnTons.setText("000.00"); - txtSumSpnTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumSpnTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumSpnTons.setMinimumSize(new Dimension(50, 20)); + txtSumSpnTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 10; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumSpnTons, gridBagConstraints); txtSumSpnAV.setEditable(false); txtSumSpnAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumSpnAV.setText("X/X-X-X"); - txtSumSpnAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumSpnAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumSpnAV.setMinimumSize(new Dimension(65, 20)); + txtSumSpnAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 10; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumSpnAV, gridBagConstraints); jLabel27.setText("Power Amplifiers:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 11; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); pnlSummary.add(jLabel27, gridBagConstraints); txtSumPATons.setEditable(false); txtSumPATons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumPATons.setText("000.00"); - txtSumPATons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumPATons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumPATons.setMinimumSize(new Dimension(50, 20)); + txtSumPATons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 11; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlSummary.add(txtSumPATons, gridBagConstraints); txtSumPAAV.setEditable(false); txtSumPAAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtSumPAAV.setText("X/X-X-X"); - txtSumPAAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumPAAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtSumPAAV.setMinimumSize(new Dimension(65, 20)); + txtSumPAAV.setPreferredSize(new Dimension(65, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 11; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlSummary.add(txtSumPAAV, gridBagConstraints); pnlInformation.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Information")); @@ -2709,10 +2492,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { javax.swing.GroupLayout pnlInformationLayout = new javax.swing.GroupLayout(pnlInformation); pnlInformation.setLayout(pnlInformationLayout); pnlInformationLayout.setHorizontalGroup( - pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) .addGroup(pnlInformationLayout.createSequentialGroup() .addContainerGap() - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addGroup(pnlInformationLayout.createSequentialGroup() .addGap(95, 95, 95) .addComponent(jLabel30) @@ -2777,99 +2560,83 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { btnLockChassis.setText("Lock Chassis"); btnLockChassis.setEnabled(false); - btnLockChassis.setMaximumSize(new java.awt.Dimension(200, 23)); - btnLockChassis.setMinimumSize(new java.awt.Dimension(105, 23)); - btnLockChassis.setPreferredSize(new java.awt.Dimension(120, 23)); - btnLockChassis.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnLockChassisActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnLockChassis.setMaximumSize(new Dimension(200, 23)); + btnLockChassis.setMinimumSize(new Dimension(105, 23)); + btnLockChassis.setPreferredSize(new Dimension(120, 23)); + btnLockChassis.addActionListener(this::btnLockChassisActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; pnlOmniInfo.add(btnLockChassis, gridBagConstraints); btnAddVariant.setText("Add Variant"); btnAddVariant.setEnabled(false); - btnAddVariant.setMaximumSize(new java.awt.Dimension(200, 23)); - btnAddVariant.setMinimumSize(new java.awt.Dimension(80, 23)); - btnAddVariant.setPreferredSize(new java.awt.Dimension(120, 23)); - btnAddVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddVariantActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnAddVariant.setMaximumSize(new Dimension(200, 23)); + btnAddVariant.setMinimumSize(new Dimension(80, 23)); + btnAddVariant.setPreferredSize(new Dimension(120, 23)); + btnAddVariant.addActionListener(this::btnAddVariantActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; pnlOmniInfo.add(btnAddVariant, gridBagConstraints); btnDeleteVariant.setText("Delete Variant"); btnDeleteVariant.setEnabled(false); - btnDeleteVariant.setMaximumSize(new java.awt.Dimension(200, 23)); - btnDeleteVariant.setMinimumSize(new java.awt.Dimension(80, 23)); - btnDeleteVariant.setPreferredSize(new java.awt.Dimension(120, 23)); - btnDeleteVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnDeleteVariantActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnDeleteVariant.setMaximumSize(new Dimension(200, 23)); + btnDeleteVariant.setMinimumSize(new Dimension(80, 23)); + btnDeleteVariant.setPreferredSize(new Dimension(120, 23)); + btnDeleteVariant.addActionListener(this::btnDeleteVariantActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; pnlOmniInfo.add(btnDeleteVariant, gridBagConstraints); btnRenameVariant.setText("Rename Variant"); btnRenameVariant.setEnabled(false); - btnRenameVariant.setMinimumSize(new java.awt.Dimension(80, 23)); - btnRenameVariant.setPreferredSize(new java.awt.Dimension(120, 23)); - btnRenameVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRenameVariantActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnRenameVariant.setMinimumSize(new Dimension(80, 23)); + btnRenameVariant.setPreferredSize(new Dimension(120, 23)); + btnRenameVariant.addActionListener(this::btnRenameVariantActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; pnlOmniInfo.add(btnRenameVariant, gridBagConstraints); javax.swing.GroupLayout pnlBasicSetupLayout = new javax.swing.GroupLayout(pnlBasicSetup); pnlBasicSetup.setLayout(pnlBasicSetupLayout); pnlBasicSetupLayout.setHorizontalGroup( - pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addGroup(pnlBasicSetupLayout.createSequentialGroup() - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(pnlChassisMods, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) + .addComponent(pnlChassisMods, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlMovement, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(pnlBasicInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addComponent(pnlExperimental, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlChassis, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addComponent(pnlSummary, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlOmniInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlInformation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(pnlInformation, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)) .addGap(0, 0, 0)) ); pnlBasicSetupLayout.setVerticalGroup( - pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addGroup(pnlBasicSetupLayout.createSequentialGroup() - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) .addGroup(pnlBasicSetupLayout.createSequentialGroup() .addComponent(pnlChassis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlExperimental, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) .addGroup(pnlBasicSetupLayout.createSequentialGroup() .addComponent(pnlOmniInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -2877,10 +2644,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlInformation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlBasicSetupLayout.createSequentialGroup() - .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pnlBasicInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlMovement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(2, 2, 2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlChassisMods, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap()) ); @@ -2892,34 +2659,30 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlRightArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Right")); pnlRightArmor.setLayout(new java.awt.GridBagLayout()); - lblRightIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblRightIntPts.setHorizontalAlignment(SwingConstants.CENTER); lblRightIntPts.setText("00"); lblRightIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRightIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRightIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRightIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblRightIntPts.setMaximumSize(new Dimension(45, 20)); + lblRightIntPts.setMinimumSize(new Dimension(45, 20)); + lblRightIntPts.setPreferredSize(new Dimension(45, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; pnlRightArmor.add(lblRightIntPts, gridBagConstraints); jLabel40.setText("Internal"); - pnlRightArmor.add(jLabel40, new java.awt.GridBagConstraints()); + pnlRightArmor.add(jLabel40, new GridBagConstraints()); jLabel46.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; pnlRightArmor.add(jLabel46, gridBagConstraints); - spnRightArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRightArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRightArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRightArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + spnRightArmor.setMinimumSize(new Dimension(45, 20)); + spnRightArmor.setPreferredSize(new Dimension(45, 20)); + spnRightArmor.addChangeListener(this::spnRightArmorStateChanged); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; pnlRightArmor.add(spnRightArmor, gridBagConstraints); @@ -2927,34 +2690,30 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { pnlFrontArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Front")); pnlFrontArmor.setLayout(new java.awt.GridBagLayout()); - lblFrontIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblFrontIntPts.setHorizontalAlignment(SwingConstants.CENTER); lblFrontIntPts.setText("00"); lblFrontIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblFrontIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblFrontIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblFrontIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblFrontIntPts.setMaximumSize(new Dimension(45, 20)); + lblFrontIntPts.setMinimumSize(new Dimension(45, 20)); + lblFrontIntPts.setPreferredSize(new Dimension(45, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; pnlFrontArmor.add(lblFrontIntPts, gridBagConstraints); jLabel45.setText("Internal"); - pnlFrontArmor.add(jLabel45, new java.awt.GridBagConstraints()); + pnlFrontArmor.add(jLabel45, new GridBagConstraints()); jLabel47.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; pnlFrontArmor.add(jLabel47, gridBagConstraints); - spnFrontArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnFrontArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnFrontArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnFrontArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + spnFrontArmor.setMinimumSize(new Dimension(45, 20)); + spnFrontArmor.setPreferredSize(new Dimension(45, 20)); + spnFrontArmor.addChangeListener(this::spnFrontArmorStateChanged); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; pnlFrontArmor.add(spnFrontArmor, gridBagConstraints); @@ -2962,34 +2721,30 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { pnlLeftArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Left")); pnlLeftArmor.setLayout(new java.awt.GridBagLayout()); - lblLeftIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblLeftIntPts.setHorizontalAlignment(SwingConstants.CENTER); lblLeftIntPts.setText("00"); lblLeftIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblLeftIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblLeftIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblLeftIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblLeftIntPts.setMaximumSize(new Dimension(45, 20)); + lblLeftIntPts.setMinimumSize(new Dimension(45, 20)); + lblLeftIntPts.setPreferredSize(new Dimension(45, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; pnlLeftArmor.add(lblLeftIntPts, gridBagConstraints); jLabel41.setText("Internal"); - pnlLeftArmor.add(jLabel41, new java.awt.GridBagConstraints()); + pnlLeftArmor.add(jLabel41, new GridBagConstraints()); jLabel48.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; pnlLeftArmor.add(jLabel48, gridBagConstraints); - spnLeftArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnLeftArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnLeftArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnLeftArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + spnLeftArmor.setMinimumSize(new Dimension(45, 20)); + spnLeftArmor.setPreferredSize(new Dimension(45, 20)); + spnLeftArmor.addChangeListener(this::spnLeftArmorStateChanged); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; pnlLeftArmor.add(spnLeftArmor, gridBagConstraints); @@ -2997,34 +2752,30 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { pnlRearArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Rear")); pnlRearArmor.setLayout(new java.awt.GridBagLayout()); - lblRearIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblRearIntPts.setHorizontalAlignment(SwingConstants.CENTER); lblRearIntPts.setText("00"); lblRearIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRearIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRearIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRearIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblRearIntPts.setMaximumSize(new Dimension(45, 20)); + lblRearIntPts.setMinimumSize(new Dimension(45, 20)); + lblRearIntPts.setPreferredSize(new Dimension(45, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; pnlRearArmor.add(lblRearIntPts, gridBagConstraints); jLabel44.setText("Internal"); - pnlRearArmor.add(jLabel44, new java.awt.GridBagConstraints()); + pnlRearArmor.add(jLabel44, new GridBagConstraints()); jLabel49.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; pnlRearArmor.add(jLabel49, gridBagConstraints); - spnRearArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRearArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRearArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRearArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + spnRearArmor.setMinimumSize(new Dimension(45, 20)); + spnRearArmor.setPreferredSize(new Dimension(45, 20)); + spnRearArmor.addChangeListener(this::spnRearArmorStateChanged); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; pnlRearArmor.add(spnRearArmor, gridBagConstraints); @@ -3032,34 +2783,30 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { pnlTurretArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Turret")); pnlTurretArmor.setLayout(new java.awt.GridBagLayout()); - lblTurretIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblTurretIntPts.setHorizontalAlignment(SwingConstants.CENTER); lblTurretIntPts.setText("00"); lblTurretIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblTurretIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblTurretIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblTurretIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblTurretIntPts.setMaximumSize(new Dimension(45, 20)); + lblTurretIntPts.setMinimumSize(new Dimension(45, 20)); + lblTurretIntPts.setPreferredSize(new Dimension(45, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; pnlTurretArmor.add(lblTurretIntPts, gridBagConstraints); jLabel42.setText("Internal"); - pnlTurretArmor.add(jLabel42, new java.awt.GridBagConstraints()); + pnlTurretArmor.add(jLabel42, new GridBagConstraints()); jLabel50.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; pnlTurretArmor.add(jLabel50, gridBagConstraints); - spnTurretArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnTurretArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnTurretArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnTurretArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + spnTurretArmor.setMinimumSize(new Dimension(45, 20)); + spnTurretArmor.setPreferredSize(new Dimension(45, 20)); + spnTurretArmor.addChangeListener(this::spnTurretArmorStateChanged); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; pnlTurretArmor.add(spnTurretArmor, gridBagConstraints); @@ -3068,34 +2815,30 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { pnlRearTurretArmor.setEnabled(false); pnlRearTurretArmor.setLayout(new java.awt.GridBagLayout()); - lblRearTurretIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblRearTurretIntPts.setHorizontalAlignment(SwingConstants.CENTER); lblRearTurretIntPts.setText("00"); lblRearTurretIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRearTurretIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRearTurretIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRearTurretIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblRearTurretIntPts.setMaximumSize(new Dimension(45, 20)); + lblRearTurretIntPts.setMinimumSize(new Dimension(45, 20)); + lblRearTurretIntPts.setPreferredSize(new Dimension(45, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; pnlRearTurretArmor.add(lblRearTurretIntPts, gridBagConstraints); jLabel43.setText("Internal"); - pnlRearTurretArmor.add(jLabel43, new java.awt.GridBagConstraints()); + pnlRearTurretArmor.add(jLabel43, new GridBagConstraints()); jLabel51.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; pnlRearTurretArmor.add(jLabel51, gridBagConstraints); - spnRearTurretArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRearTurretArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRearTurretArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRearTurretArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + spnRearTurretArmor.setMinimumSize(new Dimension(45, 20)); + spnRearTurretArmor.setPreferredSize(new Dimension(45, 20)); + spnRearTurretArmor.addChangeListener(this::spnRearTurretArmorStateChanged); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; pnlRearTurretArmor.add(spnRearTurretArmor, gridBagConstraints); @@ -3104,34 +2847,30 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { pnlRotorArmor.setEnabled(false); pnlRotorArmor.setLayout(new java.awt.GridBagLayout()); - lblRotorIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblRotorIntPts.setHorizontalAlignment(SwingConstants.CENTER); lblRotorIntPts.setText("00"); lblRotorIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRotorIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRotorIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRotorIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblRotorIntPts.setMaximumSize(new Dimension(45, 20)); + lblRotorIntPts.setMinimumSize(new Dimension(45, 20)); + lblRotorIntPts.setPreferredSize(new Dimension(45, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; pnlRotorArmor.add(lblRotorIntPts, gridBagConstraints); jLabel92.setText("Internal"); - pnlRotorArmor.add(jLabel92, new java.awt.GridBagConstraints()); + pnlRotorArmor.add(jLabel92, new GridBagConstraints()); jLabel93.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; pnlRotorArmor.add(jLabel93, gridBagConstraints); - spnRotorArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRotorArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRotorArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRotorArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + spnRotorArmor.setMinimumSize(new Dimension(45, 20)); + spnRotorArmor.setPreferredSize(new Dimension(45, 20)); + spnRotorArmor.addChangeListener(this::spnRotorArmorStateChanged); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; pnlRotorArmor.add(spnRotorArmor, gridBagConstraints); @@ -3180,77 +2919,60 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { .addContainerGap()) ); - jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Armor Type")); + pnlArmorType.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Armor Type")); jLabel52.setText("Armor Type:"); cmbArmorType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Standard", "Industrial", "Commercial", "Ferro-Fibrous", "Light Ferro-Fibrous", "Heavy Ferro-Fibrous", "Vehicular Stealth" })); - cmbArmorType.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbArmorType.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbArmorType.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbArmorTypeActionPerformed(evt); - } - }); + cmbArmorType.setMinimumSize(new Dimension(150, 20)); + cmbArmorType.setPreferredSize(new Dimension(150, 20)); + cmbArmorType.addActionListener(this::cmbArmorTypeActionPerformed); chkBalanceLRArmor.setSelected(true); chkBalanceLRArmor.setText("Balance Left/Right Armor"); - chkBalanceFRArmor.setText("Balance Front/Rear Armor"); btnSetArmorTons.setText("Set Armor Tonnage"); - btnSetArmorTons.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnSetArmorTonsActionPerformed(evt); - } - }); + btnSetArmorTons.addActionListener(this::btnSetArmorTonsActionPerformed); btnUseRemaining.setText("Use Remaining Tonnage"); - btnUseRemaining.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUseRemainingActionPerformed(evt); - } - }); + btnUseRemaining.addActionListener(this::btnUseRemainingActionPerformed); btnMaximize.setText("Maximize Armor"); - btnMaximize.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMaximizeActionPerformed(evt); - } - }); - - javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); - jPanel7.setLayout(jPanel7Layout); - jPanel7Layout.setHorizontalGroup( - jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() - .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() + btnMaximize.addActionListener(this::btnMaximizeActionPerformed); + + javax.swing.GroupLayout pnlArmorTypeLayout = new javax.swing.GroupLayout(pnlArmorType); + pnlArmorType.setLayout(pnlArmorTypeLayout); + pnlArmorTypeLayout.setHorizontalGroup( + pnlArmorTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) .addComponent(jLabel52) .addGap(2, 2, 2) .addComponent(cmbArmorType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) .addComponent(btnSetArmorTons, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) .addComponent(btnUseRemaining, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) .addComponent(btnMaximize, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(31, 31, 31) - .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(chkBalanceLRArmor) .addComponent(chkBalanceFRArmor)))) .addGap(10, 10, 10)) ); - jPanel7Layout.setVerticalGroup( - jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() - .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() + pnlArmorTypeLayout.setVerticalGroup( + pnlArmorTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel52)) .addComponent(cmbArmorType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) @@ -3270,30 +2992,30 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jPanel8.setLayout(new java.awt.GridBagLayout()); jLabel34.setText("Tons"); - jPanel8.add(jLabel34, new java.awt.GridBagConstraints()); + jPanel8.add(jLabel34, new GridBagConstraints()); jLabel36.setText("Space"); - jPanel8.add(jLabel36, new java.awt.GridBagConstraints()); + jPanel8.add(jLabel36, new GridBagConstraints()); lblArmorTotals.setText("999 of 999 Armor Points"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); jPanel8.add(lblArmorTotals, gridBagConstraints); lblArmorCoverage.setText("100.00% Coverage"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST; + gridBagConstraints.anchor = GridBagConstraints.SOUTHEAST; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); jPanel8.add(lblArmorCoverage, gridBagConstraints); txtArmorTons.setEditable(false); txtArmorTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtArmorTons.setText("000.00"); - txtArmorTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtArmorTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtArmorTons.setMinimumSize(new Dimension(50, 20)); + txtArmorTons.setPreferredSize(new Dimension(50, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; jPanel8.add(txtArmorTons, gridBagConstraints); @@ -3301,28 +3023,28 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtArmorSpace.setEditable(false); txtArmorSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtArmorSpace.setText("00"); - txtArmorSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtArmorSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); + txtArmorSpace.setMinimumSize(new Dimension(40, 20)); + txtArmorSpace.setPreferredSize(new Dimension(40, 20)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; jPanel8.add(txtArmorSpace, gridBagConstraints); lblArmorTonsWasted.setText("0.00 Tons Wasted"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); jPanel8.add(lblArmorTonsWasted, gridBagConstraints); lblArmorLeftInLot.setText("99 Points Left In This 1/2 Ton Lot"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); jPanel8.add(lblArmorLeftInLot, gridBagConstraints); @@ -3336,7 +3058,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(pnlArmorType, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(214, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( @@ -3348,7 +3070,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pnlArmorType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(199, 199, 199)))) @@ -3356,463 +3078,104 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { tbpMainTabPane.addTab("Armor", jPanel2); - tbpWeaponChooser.setTabPlacement(javax.swing.JTabbedPane.RIGHT); - tbpWeaponChooser.setMaximumSize(new java.awt.Dimension(300, 300)); - tbpWeaponChooser.setMinimumSize(new java.awt.Dimension(300, 300)); - - jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator5.setAlignmentX(0.0F); - jSeparator5.setAlignmentY(0.0F); - - jScrollPane8.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane8.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane8.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseBallistic.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseBallistic.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseBallistic.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseBallistic.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseBallistic.setPreferredSize(null); - lstChooseBallistic.setVisibleRowCount(16); - lstChooseBallistic.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseBallisticValueChanged(evt); - } - }); - MouseListener mlBallistic = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseBallistic.addMouseListener( mlBallistic ); - lstChooseBallistic.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane8.setViewportView(lstChooseBallistic); - - jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator6.setAlignmentX(0.0F); - jSeparator6.setAlignmentY(0.0F); - - javax.swing.GroupLayout pnlBallisticLayout = new javax.swing.GroupLayout(pnlBallistic); - pnlBallistic.setLayout(pnlBallisticLayout); - pnlBallisticLayout.setHorizontalGroup( - pnlBallisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addGap(106, 106, 106) - .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addGap(6, 6, 6) - .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(6, 6, 6)) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addGap(106, 106, 106) - .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)) - ); - pnlBallisticLayout.setVerticalGroup( - pnlBallisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, 0) - .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE) - .addGap(0, 0, 0) - .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(1, 1, 1)) - ); - - tbpWeaponChooser.addTab("Ballistic", pnlBallistic); - - pnlEnergy.setLayout(new javax.swing.BoxLayout(pnlEnergy, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator7.setAlignmentX(0.0F); - jSeparator7.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator7); - - jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane9.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEnergy.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEnergy.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEnergy.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEnergy.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEnergy.setPreferredSize(null); - lstChooseEnergy.setVisibleRowCount(16); - lstChooseEnergy.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEnergyValueChanged(evt); - } - }); - MouseListener mlEnergy = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseEnergy.addMouseListener( mlEnergy ); - lstChooseEnergy.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane9.setViewportView(lstChooseEnergy); - - pnlEnergy.add(jScrollPane9); - - jSeparator8.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator8.setAlignmentX(0.0F); - jSeparator8.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator8); - - tbpWeaponChooser.addTab("Energy", pnlEnergy); - - pnlMissile.setLayout(new javax.swing.BoxLayout(pnlMissile, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator9.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator9.setAlignmentX(0.0F); - jSeparator9.setAlignmentY(0.0F); - pnlMissile.add(jSeparator9); - - jScrollPane19.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane19.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane19.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseMissile.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseMissile.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseMissile.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseMissile.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseMissile.setPreferredSize(null); - lstChooseMissile.setVisibleRowCount(16); - lstChooseMissile.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseMissileValueChanged(evt); - } - }); - MouseListener mlMissile = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseMissile.addMouseListener( mlMissile ); - lstChooseMissile.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane19.setViewportView(lstChooseMissile); - - pnlMissile.add(jScrollPane19); - - jSeparator10.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator10.setAlignmentX(0.0F); - jSeparator10.setAlignmentY(0.0F); - pnlMissile.add(jSeparator10); - - tbpWeaponChooser.addTab("Missile", pnlMissile); - - pnlPhysical.setLayout(new javax.swing.BoxLayout(pnlPhysical, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator11.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator11.setAlignmentX(0.0F); - jSeparator11.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator11); - - jScrollPane20.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane20.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane20.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChoosePhysical.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChoosePhysical.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChoosePhysical.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChoosePhysical.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChoosePhysical.setPreferredSize(null); - lstChoosePhysical.setVisibleRowCount(16); - lstChoosePhysical.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChoosePhysicalValueChanged(evt); - } - }); - MouseListener mlPhysical = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChoosePhysical.addMouseListener( mlPhysical ); - lstChoosePhysical.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane20.setViewportView(lstChoosePhysical); - - pnlPhysical.add(jScrollPane20); - - jSeparator12.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator12.setAlignmentX(0.0F); - jSeparator12.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator12); - - tbpWeaponChooser.addTab("Physical", pnlPhysical); - - pnlEquipmentChooser.setLayout(new javax.swing.BoxLayout(pnlEquipmentChooser, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator13.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator13.setAlignmentX(0.0F); - jSeparator13.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator13); - - jScrollPane21.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane21.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane21.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEquipment.setModel(new javax.swing.AbstractListModel() { + //region Equipment Tab / Weapons and Equipment Lists + AbstractListModel placeholder = new AbstractListModel() { String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEquipment.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEquipment.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEquipment.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEquipment.setPreferredSize(null); - lstChooseEquipment.setVisibleRowCount(16); - lstChooseEquipment.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEquipmentValueChanged(evt); - } - }); - MouseListener mlEquipment = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseEquipment.addMouseListener( mlEquipment ); - lstChooseEquipment.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane21.setViewportView(lstChooseEquipment); - - pnlEquipmentChooser.add(jScrollPane21); - - jSeparator14.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator14.setAlignmentX(0.0F); - jSeparator14.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator14); - - tbpWeaponChooser.addTab("Equipment", pnlEquipmentChooser); - - pnlArtillery.setLayout(new javax.swing.BoxLayout(pnlArtillery, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator18.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator18.setAlignmentX(0.0F); - jSeparator18.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator18); - - jScrollPane24.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane24.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane24.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseArtillery.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseArtillery.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseArtillery.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseArtillery.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseArtillery.setPreferredSize(null); - lstChooseArtillery.setVisibleRowCount(16); - lstChooseArtillery.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseArtilleryValueChanged(evt); - } - }); - MouseListener mlArtillery = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } }; - lstChooseArtillery.addMouseListener( mlArtillery ); - lstChooseArtillery.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane24.setViewportView(lstChooseArtillery); - - pnlArtillery.add(jScrollPane24); - - jSeparator19.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator19.setAlignmentX(0.0F); - jSeparator19.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator19); - tbpWeaponChooser.addTab("Artillery", pnlArtillery); - - pnlAmmunition.setLayout(new javax.swing.BoxLayout(pnlAmmunition, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator15.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator15.setAlignmentX(0.0F); - jSeparator15.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator15); - - jScrollPane22.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane22.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane22.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseAmmunition.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseAmmunition.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseAmmunition.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseAmmunition.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseAmmunition.setPreferredSize(null); - lstChooseAmmunition.setVisibleRowCount(16); - lstChooseAmmunition.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseAmmunitionValueChanged(evt); - } - }); - MouseListener mlAmmo = new MouseAdapter() { + MouseListener mlAddEquip = new MouseAdapter() { public void mouseClicked( MouseEvent e ) { if ( e.getClickCount() == 2 && e.getButton() == 1 ) { btnAddEquipActionPerformed( null ); } } }; - lstChooseAmmunition.addMouseListener( mlAmmo ); - lstChooseAmmunition.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane22.setViewportView(lstChooseAmmunition); - - pnlAmmunition.add(jScrollPane22); - jSeparator16.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator16.setAlignmentX(0.0F); - jSeparator16.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator16); - - tbpWeaponChooser.addTab("Ammunition", pnlAmmunition); + tbpWeaponChooser.setTabPlacement(JTabbedPane.RIGHT); + tbpWeaponChooser.setMaximumSize(new Dimension(300, 300)); + tbpWeaponChooser.setMinimumSize(new Dimension(300, 300)); + tbpWeaponChooser.addTab("Ballistic", EquipmentLocation(lstChooseBallistic, this::lstChooseBallisticValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Energy", EquipmentLocation(lstChooseEnergy, this::lstChooseEnergyValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Missile", EquipmentLocation(lstChooseMissile, this::lstChooseMissileValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Physical", EquipmentLocation(lstChoosePhysical, this::lstChoosePhysicalValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Equipment", EquipmentLocation(lstChooseEquipment, this::lstChooseEquipmentValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Artillery", EquipmentLocation(lstChooseArtillery, this::lstChooseArtilleryValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Ammunition", EquipmentLocation(lstChooseAmmunition, this::lstChooseAmmunitionValueChanged, mlAddEquip, placeholder)); pnlSpecials.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Specials")); pnlSpecials.setLayout(new java.awt.GridBagLayout()); jLabel37.setText("Missile Guidance:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints = new GridBagConstraints(); + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0); pnlSpecials.add(jLabel37, gridBagConstraints); chkUseTC.setText("Targeting Computer"); chkUseTC.setEnabled(false); - chkUseTC.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkUseTCActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkUseTC.addActionListener(this::chkUseTCActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 0); pnlSpecials.add(chkUseTC, gridBagConstraints); chkFCSAIV.setText("Use Artemis IV"); - chkFCSAIV.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFCSAIVActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkFCSAIV.addActionListener(this::chkFCSAIVActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); pnlSpecials.add(chkFCSAIV, gridBagConstraints); chkFCSAV.setText("Use Artemis V"); chkFCSAV.setEnabled(false); - chkFCSAV.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFCSAVActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkFCSAV.addActionListener(this::chkFCSAVActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); pnlSpecials.add(chkFCSAV, gridBagConstraints); chkFCSApollo.setText("Use MRM Apollo"); chkFCSApollo.setEnabled(false); - chkFCSApollo.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFCSApolloActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkFCSApollo.addActionListener(this::chkFCSApolloActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); pnlSpecials.add(chkFCSApollo, gridBagConstraints); - chkClanCASE.setText("Use CASE"); - chkClanCASE.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkClanCASEActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + chkCASE.setText("Use CASE"); + chkCASE.addActionListener(this::chkCASEActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 0); - pnlSpecials.add(chkClanCASE, gridBagConstraints); + pnlSpecials.add(chkCASE, gridBagConstraints); pnlSelected.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Selected Equipment")); - pnlSelected.setMaximumSize(new java.awt.Dimension(212, 286)); - pnlSelected.setMinimumSize(new java.awt.Dimension(212, 286)); + pnlSelected.setMaximumSize(new Dimension(212, 286)); + pnlSelected.setMinimumSize(new Dimension(212, 286)); pnlSelected.setLayout(new javax.swing.BoxLayout(pnlSelected, javax.swing.BoxLayout.LINE_AXIS)); - jScrollPane23.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane23.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrSelectedEquip.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrSelectedEquip.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); - lstSelectedEquipment.setModel( new javax.swing.DefaultListModel() - ); - lstSelectedEquipment.setMaximumSize(new java.awt.Dimension(180, 225)); - lstSelectedEquipment.setMinimumSize(new java.awt.Dimension(180, 225)); + lstSelectedEquipment.setModel( new javax.swing.DefaultListModel() ); + lstSelectedEquipment.setMaximumSize(new Dimension(180, 225)); + lstSelectedEquipment.setMinimumSize(new Dimension(180, 225)); lstSelectedEquipment.setPreferredSize(null); lstSelectedEquipment.setVisibleRowCount(16); - lstSelectedEquipment.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstSelectedEquipmentValueChanged(evt); - } - }); + lstSelectedEquipment.addListSelectionListener(this::lstSelectedEquipmentValueChanged); lstSelectedEquipment.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { lstSelectedEquipmentKeyPressed(evt); @@ -3840,289 +3203,289 @@ public void mousePressed( MouseEvent e ) { }; lstSelectedEquipment.addMouseListener( mlSelect ); lstSelectedEquipment.setCellRenderer( new saw.gui.EquipmentSelectedRenderer( this ) ); - jScrollPane23.setViewportView(lstSelectedEquipment); + scrSelectedEquip.setViewportView(lstSelectedEquipment); - pnlSelected.add(jScrollPane23); + pnlSelected.add(scrSelectedEquip); pnlEquipInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Information")); pnlEquipInfo.setLayout(new java.awt.GridBagLayout()); jLabel38.setText("Availability(AoW/SL)"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); pnlEquipInfo.add(jLabel38, gridBagConstraints); jLabel39.setText("Availability (SW)"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); pnlEquipInfo.add(jLabel39, gridBagConstraints); jLabel53.setText("Availability (CI)"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); pnlEquipInfo.add(jLabel53, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoAVSL, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoAVSW, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoAVCI, gridBagConstraints); jLabel54.setText("Introduction"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(jLabel54, gridBagConstraints); jLabel55.setText("Extinction"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(jLabel55, gridBagConstraints); jLabel56.setText("Reintroduction"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(jLabel56, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoIntro, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoExtinct, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoReintro, gridBagConstraints); jLabel57.setText("Name"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints = new GridBagConstraints(); + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 3); pnlEquipInfo.add(jLabel57, gridBagConstraints); jLabel58.setText("Type"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); pnlEquipInfo.add(jLabel58, gridBagConstraints); jLabel59.setText("Heat"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); pnlEquipInfo.add(jLabel59, gridBagConstraints); jLabel60.setText("Damage"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); pnlEquipInfo.add(jLabel60, gridBagConstraints); jLabel61.setText("Range"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); pnlEquipInfo.add(jLabel61, gridBagConstraints); lblInfoName.setText(" "); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); pnlEquipInfo.add(lblInfoName, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoType, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoHeat, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoDamage, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoRange, gridBagConstraints); jSeparator17.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0); pnlEquipInfo.add(jSeparator17, gridBagConstraints); jLabel62.setText("Ammo"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); pnlEquipInfo.add(jLabel62, gridBagConstraints); jLabel63.setText("Tonnage"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); pnlEquipInfo.add(jLabel63, gridBagConstraints); jLabel64.setText("Crits"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); pnlEquipInfo.add(jLabel64, gridBagConstraints); jLabel65.setText("Specials"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 8; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 0); pnlEquipInfo.add(jLabel65, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoAmmo, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoTonnage, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(lblInfoCrits, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 8; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); pnlEquipInfo.add(lblInfoSpecials, gridBagConstraints); jSeparator20.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0); pnlEquipInfo.add(jSeparator20, gridBagConstraints); jLabel66.setText("Cost"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(jLabel66, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); pnlEquipInfo.add(lblInfoCost, gridBagConstraints); jLabel67.setText("BV"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(jLabel67, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); pnlEquipInfo.add(lblInfoBV, gridBagConstraints); jLabel68.setText("Mounting Restrictions"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 3); pnlEquipInfo.add(jLabel68, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 8; gridBagConstraints.gridwidth = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 4, 0); pnlEquipInfo.add(lblInfoMountRestrict, gridBagConstraints); jLabel69.setText("Rules Level"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); pnlEquipInfo.add(jLabel69, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 3; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); pnlEquipInfo.add(lblInfoRulesLevel, gridBagConstraints); jLabel6.setText("Availability (DA)"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); pnlEquipInfo.add(jLabel6, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); @@ -4132,41 +3495,29 @@ public void mousePressed( MouseEvent e ) { pnlControls.setLayout(new java.awt.GridBagLayout()); btnRemoveEquip.setText("<<"); - btnRemoveEquip.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRemoveEquipActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnRemoveEquip.addActionListener(this::btnRemoveEquipActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 8); pnlControls.add(btnRemoveEquip, gridBagConstraints); btnClearEquip.setText("Clear"); - btnClearEquip.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnClearEquipActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnClearEquip.addActionListener(this::btnClearEquipActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); pnlControls.add(btnClearEquip, gridBagConstraints); btnAddEquip.setText(">>"); - btnAddEquip.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddEquipActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnAddEquip.addActionListener(this::btnAddEquipActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); pnlControls.add(btnAddEquip, gridBagConstraints); cmbNumEquips.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" })); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new java.awt.Insets(4, 8, 0, 0); @@ -4187,144 +3538,123 @@ public void mouseClicked(java.awt.event.MouseEvent evt) { }); jScrollPane1.setViewportView(cmbLocation); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0); pnlControls.add(jScrollPane1, gridBagConstraints); - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() + javax.swing.GroupLayout pnlEquipmentLayout = new javax.swing.GroupLayout(pnlEquipment); + pnlEquipment.setLayout(pnlEquipmentLayout); + pnlEquipmentLayout.setHorizontalGroup( + pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlEquipmentLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() + .addGroup(pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlEquipmentLayout.createSequentialGroup() .addComponent(tbpWeaponChooser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18) - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(pnlControls, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlSpecials, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlSelected, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(pnlEquipInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(pnlEquipInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() + pnlEquipmentLayout.setVerticalGroup( + pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlEquipmentLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addGroup(pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlEquipmentLayout.createSequentialGroup() .addComponent(pnlControls, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlSpecials, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(pnlSelected, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(tbpWeaponChooser, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlEquipInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(844, 844, 844)) + .addComponent(pnlEquipInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); - tbpMainTabPane.addTab("Equipment", jPanel3); + tbpMainTabPane.addTab("Equipment", pnlEquipment); pnlFluff.setLayout(new java.awt.GridBagLayout()); pnlImage.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Fluff Image", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11))); // NOI18N pnlImage.setLayout(new java.awt.GridBagLayout()); - lblFluffImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblFluffImage.setHorizontalAlignment(SwingConstants.CENTER); lblFluffImage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblFluffImage.setMaximumSize(new java.awt.Dimension(290, 350)); - lblFluffImage.setMinimumSize(new java.awt.Dimension(290, 350)); - lblFluffImage.setPreferredSize(new java.awt.Dimension(290, 350)); - gridBagConstraints = new java.awt.GridBagConstraints(); + lblFluffImage.setMaximumSize(new Dimension(325, 350)); + lblFluffImage.setMinimumSize(new Dimension(325, 350)); + lblFluffImage.setPreferredSize(new Dimension(325, 350)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; pnlImage.add(lblFluffImage, gridBagConstraints); btnLoadImage.setText("Load Image"); - btnLoadImage.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnLoadImageActionPerformed(evt); - } - }); + btnLoadImage.addActionListener(this::btnLoadImageActionPerformed); jPanel1.add(btnLoadImage); btnClearImage.setText("Clear Image"); - btnClearImage.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnClearImageActionPerformed(evt); - } - }); + btnClearImage.addActionListener(this::btnClearImageActionPerformed); jPanel1.add(btnClearImage); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + gridBagConstraints = new GridBagConstraints(); + gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 4); pnlImage.add(jPanel1, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; pnlFluff.add(pnlImage, gridBagConstraints); pnlExport.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Export", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11))); // NOI18N pnlExport.setLayout(new java.awt.GridBagLayout()); btnExportTXT.setText("to TXT"); - btnExportTXT.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportTXTActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + btnExportTXT.addActionListener(this::btnExportTXTActionPerformed); + gridBagConstraints = new GridBagConstraints(); + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlExport.add(btnExportTXT, gridBagConstraints); btnExportHTML.setText("to HTML"); - btnExportHTML.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportHTMLActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnExportHTML.addActionListener(this::btnExportHTMLActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4); pnlExport.add(btnExportHTML, gridBagConstraints); btnExportMTF.setText("to MegaMek"); - btnExportMTF.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportMTFActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + btnExportMTF.addActionListener(this::btnExportMTFActionPerformed); + gridBagConstraints = new GridBagConstraints(); + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlExport.add(btnExportMTF, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; + gridBagConstraints.anchor = GridBagConstraints.NORTH; pnlFluff.add(pnlExport, gridBagConstraints); - tbpFluffEditors.setTabPlacement(javax.swing.JTabbedPane.LEFT); - tbpFluffEditors.setMaximumSize(new java.awt.Dimension(420, 455)); - tbpFluffEditors.setMinimumSize(new java.awt.Dimension(420, 455)); + tbpFluffEditors.setTabPlacement(JTabbedPane.RIGHT); + tbpFluffEditors.setMaximumSize(new Dimension(420, 455)); + tbpFluffEditors.setMinimumSize(new Dimension(420, 455)); - pnlOverview.setMaximumSize(new java.awt.Dimension(427, 485)); - pnlOverview.setMinimumSize(new java.awt.Dimension(427, 485)); + pnlOverview.setMaximumSize(new Dimension(427, 485)); + pnlOverview.setMinimumSize(new Dimension(427, 485)); pnlOverview.setLayout(new javax.swing.BoxLayout(pnlOverview, javax.swing.BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Overview", pnlOverview); - pnlCapabilities.setMaximumSize(new java.awt.Dimension(427, 485)); - pnlCapabilities.setMinimumSize(new java.awt.Dimension(427, 485)); + pnlCapabilities.setMaximumSize(new Dimension(427, 485)); + pnlCapabilities.setMinimumSize(new Dimension(427, 485)); pnlCapabilities.setLayout(new javax.swing.BoxLayout(pnlCapabilities, javax.swing.BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Capabilities", pnlCapabilities); @@ -4347,108 +3677,108 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel82.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N jLabel82.setText("Manufacturer Information"); - jLabel82.setMaximumSize(new java.awt.Dimension(175, 15)); - jLabel82.setMinimumSize(new java.awt.Dimension(175, 15)); - jLabel82.setPreferredSize(new java.awt.Dimension(175, 15)); - gridBagConstraints = new java.awt.GridBagConstraints(); + jLabel82.setMaximumSize(new Dimension(175, 15)); + jLabel82.setMinimumSize(new Dimension(175, 15)); + jLabel82.setPreferredSize(new Dimension(175, 15)); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0); pnlManufacturers.add(jLabel82, gridBagConstraints); jLabel83.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel83.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel83.setHorizontalAlignment(SwingConstants.RIGHT); jLabel83.setText("Manufacturing Company:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 0); pnlManufacturers.add(jLabel83, gridBagConstraints); jLabel84.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel84.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel84.setHorizontalAlignment(SwingConstants.RIGHT); jLabel84.setText("Location:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 76; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); pnlManufacturers.add(jLabel84, gridBagConstraints); jLabel85.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel85.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel85.setHorizontalAlignment(SwingConstants.RIGHT); jLabel85.setText("Engine Manufacturer:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 17; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); pnlManufacturers.add(jLabel85, gridBagConstraints); jLabel86.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel86.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel86.setHorizontalAlignment(SwingConstants.RIGHT); jLabel86.setText("Armor Model:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 56; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); pnlManufacturers.add(jLabel86, gridBagConstraints); jLabel87.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel87.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel87.setHorizontalAlignment(SwingConstants.RIGHT); jLabel87.setText("Chassis Model:"); jLabel87.setEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 47; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); pnlManufacturers.add(jLabel87, gridBagConstraints); jLabel88.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel88.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel88.setHorizontalAlignment(SwingConstants.RIGHT); jLabel88.setText("Communications System:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); pnlManufacturers.add(jLabel88, gridBagConstraints); jLabel89.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel89.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel89.setHorizontalAlignment(SwingConstants.RIGHT); jLabel89.setText("Targeting and Tracking:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); pnlManufacturers.add(jLabel89, gridBagConstraints); txtManufacturer.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(10, 2, 0, 11); pnlManufacturers.add(txtManufacturer, gridBagConstraints); MouseListener mlManufacturer = new MouseAdapter() { @@ -4466,12 +3796,12 @@ public void mousePressed( MouseEvent e ) { txtManufacturer.addMouseListener( mlManufacturer ); txtEngineManufacturer.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); pnlManufacturers.add(txtEngineManufacturer, gridBagConstraints); MouseListener mlEngineManufacturer = new MouseAdapter() { @@ -4489,12 +3819,12 @@ public void mousePressed( MouseEvent e ) { txtEngineManufacturer.addMouseListener( mlEngineManufacturer ); txtArmorModel.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); pnlManufacturers.add(txtArmorModel, gridBagConstraints); MouseListener mlArmorModel = new MouseAdapter() { @@ -4513,12 +3843,12 @@ public void mousePressed( MouseEvent e ) { txtChassisModel.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N txtChassisModel.setEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); pnlManufacturers.add(txtChassisModel, gridBagConstraints); MouseListener mlChassisModel = new MouseAdapter() { @@ -4536,12 +3866,12 @@ public void mousePressed( MouseEvent e ) { txtChassisModel.addMouseListener( mlChassisModel ); txtCommSystem.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); pnlManufacturers.add(txtCommSystem, gridBagConstraints); MouseListener mlCommSystem = new MouseAdapter() { @@ -4559,12 +3889,12 @@ public void mousePressed( MouseEvent e ) { txtCommSystem.addMouseListener( mlCommSystem ); txtTNTSystem.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 8; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); pnlManufacturers.add(txtTNTSystem, gridBagConstraints); MouseListener mlTNTSystem = new MouseAdapter() { @@ -4583,18 +3913,18 @@ public void mousePressed( MouseEvent e ) { pnlWeaponsManufacturers.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Weapons Manufacturers", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11))); // NOI18N pnlWeaponsManufacturers.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - pnlWeaponsManufacturers.setMinimumSize(new java.awt.Dimension(315, 260)); + pnlWeaponsManufacturers.setMinimumSize(new Dimension(315, 260)); pnlWeaponsManufacturers.setLayout(new java.awt.GridBagLayout()); chkIndividualWeapons.setText("Assign manufacturers individually"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 10, 4, 0); pnlWeaponsManufacturers.add(chkIndividualWeapons, gridBagConstraints); - scpWeaponManufacturers.setPreferredSize(new java.awt.Dimension(452, 392)); + scpWeaponManufacturers.setPreferredSize(new Dimension(452, 392)); tblWeaponManufacturers.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { @@ -4617,26 +3947,26 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { }); scpWeaponManufacturers.setViewportView(tblWeaponManufacturers); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.ipadx = 280; gridBagConstraints.ipady = 180; pnlWeaponsManufacturers.add(scpWeaponManufacturers, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 9; gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(2, 10, 2, 10); pnlManufacturers.add(pnlWeaponsManufacturers, gridBagConstraints); txtManufacturerLocation.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); pnlManufacturers.add(txtManufacturerLocation, gridBagConstraints); MouseListener mlManufacturerLocation = new MouseAdapter() { @@ -4654,24 +3984,24 @@ public void mousePressed( MouseEvent e ) { txtManufacturerLocation.addMouseListener( mlManufacturerLocation ); jLabel90.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel90.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); + jLabel90.setHorizontalAlignment(SwingConstants.RIGHT); jLabel90.setText("Jump Jet Model:"); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 44; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); pnlManufacturers.add(jLabel90, gridBagConstraints); txtJJModel.setEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); pnlManufacturers.add(txtJJModel, gridBagConstraints); MouseListener mlJJModel = new MouseAdapter() { @@ -4692,9 +4022,9 @@ public void mousePressed( MouseEvent e ) { lblBattleMechQuirks.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N lblBattleMechQuirks.setText("Quirks"); - lblBattleMechQuirks.setMaximumSize(new java.awt.Dimension(175, 15)); - lblBattleMechQuirks.setMinimumSize(new java.awt.Dimension(175, 15)); - lblBattleMechQuirks.setPreferredSize(new java.awt.Dimension(175, 15)); + lblBattleMechQuirks.setMaximumSize(new Dimension(175, 15)); + lblBattleMechQuirks.setMinimumSize(new Dimension(175, 15)); + lblBattleMechQuirks.setPreferredSize(new Dimension(175, 15)); tblQuirks.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { @@ -4726,12 +4056,8 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { tblQuirks.getTableHeader().setReorderingAllowed(false); scpQuirkTable.setViewportView(tblQuirks); - btnAddQuirk.setText("Add Quirk"); - btnAddQuirk.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddQuirkActionPerformed(evt); - } - }); + btnAddQuirk.setText("Manage Quirk"); + btnAddQuirk.addActionListener(this::btnAddQuirkActionPerformed); javax.swing.GroupLayout pnlQuirksLayout = new javax.swing.GroupLayout(pnlQuirks); pnlQuirks.setLayout(pnlQuirksLayout); @@ -4760,11 +4086,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { tbpFluffEditors.addTab("Quirks", pnlQuirks); - gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; + gridBagConstraints.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 6); pnlFluff.add(tbpFluffEditors, gridBagConstraints); @@ -4823,39 +4149,39 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel79.setText("Special Abilities:"); pnlBFStats.add(jLabel79, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, -1, -1)); - lblBFMV.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFMV.setHorizontalAlignment(SwingConstants.CENTER); lblBFMV.setText("0"); pnlBFStats.add(lblBFMV, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, 30, -1)); - lblBFWt.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFWt.setHorizontalAlignment(SwingConstants.CENTER); lblBFWt.setText("1"); pnlBFStats.add(lblBFWt, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 50, 30, -1)); - lblBFOV.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFOV.setHorizontalAlignment(SwingConstants.CENTER); lblBFOV.setText("0"); pnlBFStats.add(lblBFOV, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 50, 30, -1)); - lblBFExtreme.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFExtreme.setHorizontalAlignment(SwingConstants.CENTER); lblBFExtreme.setText("0"); pnlBFStats.add(lblBFExtreme, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 50, 30, -1)); - lblBFShort.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFShort.setHorizontalAlignment(SwingConstants.CENTER); lblBFShort.setText("0"); pnlBFStats.add(lblBFShort, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 50, 30, -1)); - lblBFMedium.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFMedium.setHorizontalAlignment(SwingConstants.CENTER); lblBFMedium.setText("0"); pnlBFStats.add(lblBFMedium, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 50, 30, -1)); - lblBFLong.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFLong.setHorizontalAlignment(SwingConstants.CENTER); lblBFLong.setText("0"); pnlBFStats.add(lblBFLong, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 50, 30, -1)); - lblBFArmor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFArmor.setHorizontalAlignment(SwingConstants.CENTER); lblBFArmor.setText("0"); pnlBFStats.add(lblBFArmor, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 30, 30, -1)); - lblBFStructure.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + lblBFStructure.setHorizontalAlignment(SwingConstants.CENTER); lblBFStructure.setText("0"); pnlBFStats.add(lblBFStructure, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 60, 30, -1)); @@ -4871,148 +4197,96 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Conversion Steps")); jPanel10.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); - jTextAreaBFConversion.setColumns(20); + jTextAreaBFConversion.setColumns(60); jTextAreaBFConversion.setEditable(false); jTextAreaBFConversion.setRows(5); jScrollPane14.setViewportView(jTextAreaBFConversion); - jPanel10.add(jScrollPane14, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 660, 190)); + jPanel10.add(jScrollPane14, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 740, 190)); javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup( - jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addGroup(jPanel9Layout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pnlBFStats, javax.swing.GroupLayout.PREFERRED_SIZE, 690, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 690, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(75, Short.MAX_VALUE)) + .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) + .addComponent(pnlBFStats, javax.swing.GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE) + .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE)) + .addContainerGap()) ); jPanel9Layout.setVerticalGroup( - jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() - .addContainerGap(30, Short.MAX_VALUE) - .addComponent(pnlBFStats, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(10, 10, 10) - .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap() + .addComponent(pnlBFStats, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE) + .addContainerGap() + .addComponent(jPanel10, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE)) ); tbpMainTabPane.addTab("BattleForce", jPanel9); mnuFile.setText("File"); - mnuFile.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuFileActionPerformed(evt); - } - }); + mnuFile.addActionListener(this::mnuFileActionPerformed); - mnuNewMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuNewMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK)); mnuNewMech.setText("New"); - mnuNewMech.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuNewMechActionPerformed(evt); - } - }); + mnuNewMech.addActionListener(this::mnuNewMechActionPerformed); mnuFile.add(mnuNewMech); - mnuLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK)); mnuLoad.setText("Load"); - mnuLoad.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuLoadActionPerformed(evt); - } - }); + mnuLoad.addActionListener(this::mnuLoadActionPerformed); mnuFile.add(mnuLoad); - mnuOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK)); mnuOpen.setText("Open"); - mnuOpen.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuOpenActionPerformed(evt); - } - }); + mnuOpen.addActionListener(this::mnuOpenActionPerformed); mnuFile.add(mnuOpen); mnuImport.setText("Import..."); mnuImportHMP.setText("from Heavy Metal Pro (HMP)"); - mnuImportHMP.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuImportHMPActionPerformed(evt); - } - }); + mnuImportHMP.addActionListener(this::mnuImportHMPActionPerformed); mnuImport.add(mnuImportHMP); mnuBatchHMP.setText("Batch Import HMP Files"); - mnuBatchHMP.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuBatchHMPActionPerformed(evt); - } - }); + mnuBatchHMP.addActionListener(this::mnuBatchHMPActionPerformed); mnuImport.add(mnuBatchHMP); mnuFile.add(mnuImport); mnuFile.add(jSeparator22); - mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK)); mnuSave.setText("Save"); - mnuSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuSaveActionPerformed(evt); - } - }); + mnuSave.addActionListener(this::mnuSaveActionPerformed); mnuFile.add(mnuSave); - mnuSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); + mnuSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); mnuSaveAs.setText("Save As..."); - mnuSaveAs.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuSaveAsActionPerformed(evt); - } - }); + mnuSaveAs.addActionListener(this::mnuSaveAsActionPerformed); mnuFile.add(mnuSaveAs); mnuExport.setText("Export As..."); mnuExportHTML.setText("to HTML (Web)"); - mnuExportHTML.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportHTMLActionPerformed(evt); - } - }); + mnuExportHTML.addActionListener(this::mnuExportHTMLActionPerformed); mnuExport.add(mnuExportHTML); mnuExportMTF.setText("to MTF (MegaMek)"); - mnuExportMTF.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportMTFActionPerformed(evt); - } - }); + mnuExportMTF.addActionListener(this::mnuExportMTFActionPerformed); mnuExport.add(mnuExportMTF); mnuExportTXT.setText("to TXT (Text)"); - mnuExportTXT.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportTXTActionPerformed(evt); - } - }); + mnuExportTXT.addActionListener(this::mnuExportTXTActionPerformed); mnuExport.add(mnuExportTXT); mnuExportClipboard.setText("to Clipboard (Text)"); - mnuExportClipboard.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportClipboardActionPerformed(evt); - } - }); + mnuExportClipboard.addActionListener(this::mnuExportClipboardActionPerformed); mnuExport.add(mnuExportClipboard); mnuCreateTCGMech.setText("to TCG Format (Card)"); - mnuCreateTCGMech.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuCreateTCGMechActionPerformed(evt); - } - }); + mnuCreateTCGMech.addActionListener(this::mnuCreateTCGMechActionPerformed); mnuExport.add(mnuCreateTCGMech); mnuFile.add(mnuExport); @@ -5021,115 +4295,67 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuPrint.setText("Print"); mnuFile.add(mnuPrint); - mnuPrintPreview.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); + mnuPrintPreview.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); mnuPrintPreview.setText("Print Preview"); - mnuPrintPreview.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuPrintPreviewActionPerformed(evt); - } - }); + mnuPrintPreview.addActionListener(this::mnuPrintPreviewActionPerformed); mnuFile.add(mnuPrintPreview); mnuFile.add(jSeparator24); - mnuExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK)); mnuExit.setText("Exit"); - mnuExit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExitActionPerformed(evt); - } - }); + mnuExit.addActionListener(this::mnuExitActionPerformed); mnuFile.add(mnuExit); jMenuBar1.add(mnuFile); mnuClearFluff.setText("Tools"); - mnuSummary.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuSummary.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.ALT_MASK)); mnuSummary.setText("Show Summary"); - mnuSummary.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuSummaryActionPerformed(evt); - } - }); + mnuSummary.addActionListener(this::mnuSummaryActionPerformed); mnuClearFluff.add(mnuSummary); mnuCostBVBreakdown.setText("Cost/BV Breakdown"); - mnuCostBVBreakdown.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuCostBVBreakdownActionPerformed(evt); - } - }); + mnuCostBVBreakdown.addActionListener(this::mnuCostBVBreakdownActionPerformed); mnuClearFluff.add(mnuCostBVBreakdown); mnuTextTRO.setText("Show Text TRO Format"); - mnuTextTRO.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuTextTROActionPerformed(evt); - } - }); + mnuTextTRO.addActionListener(this::mnuTextTROActionPerformed); mnuClearFluff.add(mnuTextTRO); mnuClearFluff.add(jSeparator26); mnuBFB.setText("Load Force Balancer"); - mnuBFB.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuBFBActionPerformed(evt); - } - }); + mnuBFB.addActionListener(this::mnuBFBActionPerformed); mnuClearFluff.add(mnuBFB); mnuClearFluff.add(jSeparator27); - mnuOptions.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuOptions.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK)); mnuOptions.setText("Preferences"); - mnuOptions.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuOptionsActionPerformed(evt); - } - }); + mnuOptions.addActionListener(this::mnuOptionsActionPerformed); mnuClearFluff.add(mnuOptions); - mnuViewToolbar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuViewToolbar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK)); mnuViewToolbar.setSelected(true); mnuViewToolbar.setText("View Toolbar"); - mnuViewToolbar.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuViewToolbarActionPerformed(evt); - } - }); + mnuViewToolbar.addActionListener(this::mnuViewToolbarActionPerformed); mnuClearFluff.add(mnuViewToolbar); mnuClearUserData.setText("Clear User Data"); - mnuClearUserData.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuClearUserDataActionPerformed(evt); - } - }); + mnuClearUserData.addActionListener(this::mnuClearUserDataActionPerformed); mnuClearFluff.add(mnuClearUserData); mnuClearFluff.add(jSeparator30); mnuUnlock.setText("Unlock Chassis"); mnuUnlock.setEnabled(false); - mnuUnlock.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuUnlockActionPerformed(evt); - } - }); + mnuUnlock.addActionListener(this::mnuUnlockActionPerformed); mnuClearFluff.add(mnuUnlock); jMenuItem1.setText("Clear All Fluff"); - jMenuItem1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem1ActionPerformed(evt); - } - }); + jMenuItem1.addActionListener(this::jMenuItem1ActionPerformed); mnuClearFluff.add(jMenuItem1); mnuReloadEquipment.setText("Reload Equipment"); - mnuReloadEquipment.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuReloadEquipmentActionPerformed(evt); - } - }); + mnuReloadEquipment.addActionListener(this::mnuReloadEquipmentActionPerformed); mnuClearFluff.add(mnuReloadEquipment); jMenuBar1.add(mnuClearFluff); @@ -5137,19 +4363,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuHelp.setText("Help"); mnuCredits.setText("Credits"); - mnuCredits.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuCreditsActionPerformed(evt); - } - }); + mnuCredits.addActionListener(this::mnuCreditsActionPerformed); mnuHelp.add(mnuCredits); mnuAboutSSW.setText("About SAW"); - mnuAboutSSW.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuAboutSSWActionPerformed(evt); - } - }); + mnuAboutSSW.addActionListener(this::mnuAboutSSWActionPerformed); mnuHelp.add(mnuAboutSSW); jMenuBar1.add(mnuHelp); @@ -5159,7 +4377,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addComponent(tlbIconBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlInfoPane, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() @@ -5168,11 +4386,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addContainerGap()) ); layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, true) .addGroup(layout.createSequentialGroup() .addComponent(tlbIconBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(tbpMainTabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 498, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(tbpMainTabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 510, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE) .addComponent(pnlInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) ); @@ -5180,6 +4398,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pack(); }// //GEN-END:initComponents + private JPanel EquipmentLocation(JList list, ListSelectionListener selection, MouseListener listener, AbstractListModel display) { + JPanel panel = new JPanel(); + list.setModel(display); + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + list.addListSelectionListener(selection); + list.addMouseListener( listener ); + list.setCellRenderer( new EquipmentListRenderer( this ) ); + JScrollPane pane = new JScrollPane(); + pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + pane.setViewportView(list); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(pane); + return panel; + } + private void RefreshSummary() { // refreshes the display completely using info from the mech. txtSumEngTons.setText( "" + CurVee.GetEngineTonnage() ); @@ -5197,7 +4431,8 @@ private void RefreshSummary() { txtSumConTons.setText("" + CurVee.GetControls() ); txtSumTurTons.setText("" + CurVee.GetLoadout().GetTurret().GetTonnage() ); txtSumTurAV.setText( CurVee.GetLoadout().GetTurret().GetAvailability().GetBestCombinedCode() ); - txtTurretInfo.setText("Turret: " + CurVee.GetLoadout().GetTurret().GetTonnage() ); + txtTurretInfo.setText( "Turret: " + CurVee.GetLoadout().GetTurret().GetTonnageText() ); + txtRearTurretInfo.setText( "Rear Turret: " + CurVee.GetLoadout().GetRearTurret().GetTonnageText() ); txtSumRTuTons.setText("" + CurVee.GetLoadout().GetRearTurret().GetTonnage() ); txtSumRTuAV.setText( CurVee.GetLoadout().GetRearTurret().GetAvailability().GetBestCombinedCode() ); txtSumSpnTons.setText("" + CurVee.GetLoadout().GetSponsonTurretTonnage() ); @@ -5301,29 +4536,19 @@ private void RecalcArmorLocations() { private void SolidifyVehicle() { // sets some of the basic vehicle information normally kept in the GUI and // prepares the vehicle for saving to file - int year = 0; + int year; CurVee.setName( txtVehicleName.getText() ); CurVee.setModel( txtModel.getText() ); if( txtProdYear.getText().isEmpty() ) { - switch( cmbEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.setYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.setYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.setYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.setYear( 3132, false ); - break; + year = CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ); + if( year != 0 ) { + CurVee.SetYear( year, false ); + txtProdYear.setText( "" + year ); } - txtProdYear.setText(""+CurVee.getYear()); } else { try{ year = Integer.parseInt( txtProdYear.getText() ) ; - CurVee.setYear( year, true ); + CurVee.SetYear( year, true ); } catch( NumberFormatException n ) { Media.Messager( this, "The production year is not a number." ); tbpMainTabPane.setSelectedComponent( pnlBasicSetup ); @@ -5352,8 +4577,6 @@ private void SolidifyVehicle() { } private void BuildLocationSelector() { - int curSelection = Math.max(cmbLocation.getSelectedIndex(), 0); - ArrayList locs = new ArrayList(); locs.add("Front"); locs.add("Left"); @@ -5370,6 +4593,10 @@ private void BuildLocationSelector() { locs.add("Rear Turret"); cmbLocation.setModel(new DefaultComboBoxModel(locs.toArray())); + int curSelection = cmbLocation.getSelectedIndex(); + if ( curSelection < 0 || curSelection >= locs.size()) { + curSelection = 0; // reset to Front + } cmbLocation.setSelectedIndex(curSelection); } @@ -5428,13 +4655,13 @@ private void BuildEngineSelector() { // get the engine states and, for each that matches our criteria, add it // to the selector list ifState[] check = CurVee.GetEngine().GetStates(); - for( int i = 0; i < check.length; i++ ) { - if( CommonTools.IsAllowed( check[i].GetAvailability(), CurVee ) ) { - if ( (check[i] instanceof states.stEngineNone) ) { - if ( chkTrailer.isSelected() ) - list.add( BuildLookupName( check[i] ) ); + for (states.ifState ifState : check) { + if (CommonTools.IsAllowed(ifState.GetAvailability(), CurVee)) { + if ((ifState instanceof states.stEngineNone)) { + if (chkTrailer.isSelected()) + list.add(BuildLookupName(ifState)); } else - list.add( BuildLookupName( check[i] ) ); + list.add(BuildLookupName(ifState)); } } @@ -5467,7 +4694,9 @@ private void FixArmorSpinners() { ((JSpinner.DefaultEditor)spnJumpMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnHeatSinks.getEditor()).getTextField().addFocusListener(spinners); - //Setup Spinner focus + ((JSpinner.DefaultEditor)spnTurretTonnage.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnRearTurretTonnage.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnFrontArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnLeftArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnRightArmor.getEditor()).getTextField().addFocusListener(spinners); @@ -5561,7 +4790,6 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN // since you can only ever change the rules level when not restricted, // we're not doing it here. Pass in default values. - //CurVee.GetLoadout().FlushIllegal( locArmor.GetEra(), 0, false ); CurVee.GetLoadout().FlushIllegal(); // refresh all the combo boxes. @@ -5571,25 +4799,24 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN BuildExpEquipmentSelector(); FixMPSpinner(); FixJJSpinnerModel(); - RefreshEquipment(); // now reset the combo boxes to the closest choices we previously selected LoadSelections(); RecalcEngine(); - //RecalcIntStruc(); - //RecalcHeatSinks(); RecalcArmor(); RecalcEquipment(); } BuildTurretSelector(); // now refresh the information panes + RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); -}//GEN-LAST:event_cmbRulesLevelActionPerformed + } + // check the tonnage to see if it's legal and acts accordingly public void CheckTonnage( boolean RulesChange ) { if( CurVee.GetTonnage() < 1 ) { @@ -5614,15 +4841,20 @@ private void LoadSelections() { cmbArmorType.setSelectedItem( Selections[1] ); } - private void BuildTurretSelector() - { + private void BuildTurretSelector() { ArrayList list = new ArrayList(); if ( !CurVee.IsOmni()) cmbTurret.setEnabled(true); list.add("No Turret"); - if ( CurVee.CanUseTurret() ) list.add("Single Turret"); + if ( CurVee.CanUseTurret() ) { + if (CurVee.IsVTOL()) { + list.add("Chin Turret"); + } else{ + list.add("Single Turret"); + } + } if ( CurVee.CanUseDualTurret() ) list.add("Dual Turret"); if ( list.isEmpty() ) { @@ -5646,8 +4878,7 @@ else if (CurVee.isHasTurret1()) cmbTurret.setSelectedItem("No Turret"); } - private void BuildChassisSelector() - { + private void BuildChassisSelector() { chkFlotationHull.setSelected(false); chkLimitedAmph.setSelected(false); chkFullAmph.setSelected(false); @@ -5706,6 +4937,7 @@ private void BuildExpEquipmentSelector() { chkJetBooster, chkEscapePod, chkSponsonTurret }; + if (cmbRulesLevel.getSelectedIndex() > 1) { if (CurVee.CanUseSponson()) chkSponsonTurret.setEnabled(true); @@ -5716,7 +4948,7 @@ private void BuildExpEquipmentSelector() { } } - private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbMotiveTypeActionPerformed + private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) { if ( Load ) return; boolean wasVtol = CurVee.IsVTOL(); @@ -5771,9 +5003,11 @@ private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN if( CurVee.IsVTOL() != wasVtol ) RecalcArmorPlacement(); RecalcArmorLocations(); SetWeaponChoosers(); + RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); -}//GEN-LAST:event_cmbMotiveTypeActionPerformed + RefreshEquipment(); + } private void ShowInfoOn( abPlaceable p ) { // this fills in all the information on the Equipment panel for the given @@ -6018,11 +5252,49 @@ private void ShowInfoOn( abPlaceable p ) { lblInfoMountRestrict.setText(lblInfoMountRestrict.getText() + " MM Name " + p.MegaMekName(false)); } - private void chkSuperchargerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSuperchargerActionPerformed + private void chkJetBoosterActionPerformed(java.awt.event.ActionEvent evt) { + if( CurVee.GetLoadout().HasVTOLBooster() == chkJetBooster.isSelected() ) { + return; + } + try { + CurVee.GetLoadout().SetVTOLBooster( chkJetBooster.isSelected()); + } catch( Exception e ) { + Media.Messager( this, e.getMessage() ); + try { + CurVee.GetLoadout().SetVTOLBooster( false ); + } catch( Exception x ) { + // how the hell did we get an error removing it? + Media.Messager( this, x.getMessage() ); + } + chkJetBooster.setSelected( false ); + } + RefreshSelectedEquipment(); + RefreshSummary(); + RefreshInfoPane(); + } -}//GEN-LAST:event_chkSuperchargerActionPerformed + private void chkSuperchargerActionPerformed(java.awt.event.ActionEvent evt) { + if( CurVee.GetLoadout().HasSupercharger() == chkSupercharger.isSelected() ) { + return; + } + try { + CurVee.GetLoadout().SetSupercharger( chkSupercharger.isSelected()); + } catch( Exception e ) { + Media.Messager( this, e.getMessage() ); + try { + CurVee.GetLoadout().SetSupercharger( false ); + } catch( Exception x ) { + // how the hell did we get an error removing it? + Media.Messager( this, x.getMessage() ); + } + chkSupercharger.setSelected( false ); + } + RefreshSelectedEquipment(); + RefreshSummary(); + RefreshInfoPane(); + } - private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkUseTCActionPerformed + private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.UsingTC() == chkUseTC.isSelected() ) { return; } if( chkUseTC.isSelected() ) { try { @@ -6048,9 +5320,9 @@ private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS RefreshSelectedEquipment(); RefreshSummary(); RefreshInfoPane(); -}//GEN-LAST:event_chkUseTCActionPerformed + } - private void chkFCSAIVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFCSAIVActionPerformed + private void chkFCSAIVActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.UsingArtemisIV() == chkFCSAIV.isSelected() ) { return; } if( chkFCSAIV.isSelected() ) { try { @@ -6071,9 +5343,9 @@ private void chkFCSAIVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); -}//GEN-LAST:event_chkFCSAIVActionPerformed + } - private void chkFCSAVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFCSAVActionPerformed + private void chkFCSAVActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.UsingArtemisV() == chkFCSAV.isSelected() ) { return; } if( chkFCSAV.isSelected() ) { try { @@ -6094,9 +5366,9 @@ private void chkFCSAVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); -}//GEN-LAST:event_chkFCSAVActionPerformed + } - private void chkFCSApolloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFCSApolloActionPerformed + private void chkFCSApolloActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.UsingApollo() == chkFCSApollo.isSelected() ) { return; } if( chkFCSApollo.isSelected() ) { try { @@ -6117,12 +5389,11 @@ private void chkFCSApolloActionPerformed(java.awt.event.ActionEvent evt) {//GEN- RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); -}//GEN-LAST:event_chkFCSApolloActionPerformed + } - private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkClanCASEActionPerformed - if ( !chkClanCASE.isSelected() ) { - CurVee.GetLoadout().SetClanCASE(false); - CurVee.GetLoadout().RemoveISCase(); + private void chkCASEActionPerformed(java.awt.event.ActionEvent evt) { + if ( !chkCASE.isSelected() ) { + CurVee.GetLoadout().RemoveCase(); SetWeaponChoosers(); RefreshSummary(); RefreshInfoPane(); @@ -6132,19 +5403,16 @@ private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F try { switch ( CurVee.GetTechBase() ) { case AvailableCode.TECH_INNER_SPHERE: - CurVee.GetLoadout().SetISCASE(); + CurVee.GetLoadout().AddCase(false); break; case AvailableCode.TECH_CLAN: - CurVee.GetLoadout().SetClanCASE(true); - CurVee.GetLoadout().SetISCASE(); + CurVee.GetLoadout().AddCase(true); break; case AvailableCode.TECH_BOTH: dlgTechBaseChooser tech = new dlgTechBaseChooser( this, true ); tech.setLocationRelativeTo( this ); tech.setVisible( true ); - if ( tech.IsClan() ) - CurVee.GetLoadout().SetClanCASE(true); - CurVee.GetLoadout().SetISCASE(); + CurVee.GetLoadout().AddCase(tech.IsClan()); break; } } catch ( Exception e ) { @@ -6153,27 +5421,26 @@ private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F SetWeaponChoosers(); RefreshSummary(); RefreshInfoPane(); -}//GEN-LAST:event_chkClanCASEActionPerformed + } - private void lstSelectedEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstSelectedEquipmentValueChanged + private void lstSelectedEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstSelectedEquipment.getSelectedIndex() < 0 ) { return; } abPlaceable p = (abPlaceable) Equipment[SELECTED][lstSelectedEquipment.getSelectedIndex()]; ShowInfoOn( p ); -}//GEN-LAST:event_lstSelectedEquipmentValueChanged + } - private void lstSelectedEquipmentKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_lstSelectedEquipmentKeyPressed - if ( evt.getKeyCode() == KeyEvent.VK_DELETE ) { - btnRemoveEquipActionPerformed(new ActionEvent(evt.getSource(), evt.getID(), null)); + private void lstSelectedEquipmentKeyPressed(java.awt.event.KeyEvent evt) { + if ( evt.getKeyCode() == KeyEvent.VK_DELETE ) { + btnRemoveEquipActionPerformed(new ActionEvent(evt.getSource(), evt.getID(), null)); + } } -}//GEN-LAST:event_lstSelectedEquipmentKeyPressed - private void btnRemoveEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveEquipActionPerformed + private void btnRemoveEquipActionPerformed(java.awt.event.ActionEvent evt) { if( lstSelectedEquipment.getSelectedIndex() < 0 ) { return; } int[] selected = lstSelectedEquipment.getSelectedIndices(); if( selected.length == 0 ) { return; } // we work in reverse so we can properly manage the items in the queue for( int i = selected.length - 1; i >= 0; i-- ) { - // abPlaceable p = (abPlaceable) locArmor.GetLoadout().GetNonCore().get( lstSelectedEquipment.getSelectedIndex() ); abPlaceable p = (abPlaceable) CurVee.GetLoadout().GetNonCore().get( selected[i] ); if ( p instanceof TargetingComputer ) { CurVee.UseTC(false, CurVee.GetTechBase() == AvailableCode.TECH_CLAN); @@ -6204,9 +5471,9 @@ private void btnRemoveEquipActionPerformed(java.awt.event.ActionEvent evt) {//GE // now refresh the information panes RefreshSummary(); RefreshInfoPane(); -}//GEN-LAST:event_btnRemoveEquipActionPerformed + } - private void btnClearEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearEquipActionPerformed + private void btnClearEquipActionPerformed(java.awt.event.ActionEvent evt) { CurVee.GetLoadout().SafeClearLoadout(); // refresh the selected equipment listbox @@ -6228,9 +5495,9 @@ private void btnClearEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); -}//GEN-LAST:event_btnClearEquipActionPerformed + } - private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddEquipActionPerformed + private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) { abPlaceable a = null; int Index = 0; ArrayList v; @@ -6308,12 +5575,8 @@ private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F if( a != null ) { try { CurVee.GetLoadout().CheckExclusions( a ); - if( a instanceof Equipment ) { - if ( ! ((Equipment) a).Validate( CurVee ) ) { - if( ((Equipment) a).MaxAllowed() > 0 ) { - throw new Exception( "Only " + ((Equipment) a).MaxAllowed() + " " + a.CritName() + "(s) may be mounted on one Vehicle." ); - } - } + if( a instanceof ifEquipment ) { + ((ifEquipment) a).Validate( CurVee ); } } catch( Exception e ) { Media.Messager( e.getMessage() ); @@ -6376,18 +5639,18 @@ private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F RefreshInfoPane(); cmbNumEquips.setSelectedIndex( 0 ); } -}//GEN-LAST:event_btnAddEquipActionPerformed + } - private void btnAddToForceListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddToForceListActionPerformed + private void btnAddToForceListActionPerformed(java.awt.event.ActionEvent evt) { -}//GEN-LAST:event_btnAddToForceListActionPerformed + } - private void btnForceListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnForceListActionPerformed + private void btnForceListActionPerformed(java.awt.event.ActionEvent evt) { GetForceDialogue().setLocationRelativeTo(this); GetForceDialogue().setVisible(true); -}//GEN-LAST:event_btnForceListActionPerformed + } - private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnCruiseMPStateChanged + private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action @@ -6395,7 +5658,6 @@ private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-F javax.swing.JComponent editor = spnCruiseMP.getEditor(); javax.swing.JFormattedTextField tf = ((javax.swing.JSpinner.DefaultEditor)editor).getTextField(); - //n.setMinimum(1); // get the value from the text box, if it's valid. try { spnCruiseMP.commitEdit(); @@ -6428,19 +5690,17 @@ private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-F // spinner model and recalculate the heat sinks FixMPSpinner(); FixJJSpinnerModel(); - //CurVee.GetHeatSinks().ReCalculate(); - //CurVee.GetLoadout().UnallocateFuelTanks(); // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnCruiseMPStateChanged + } - private void spnTonnageFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_spnTonnageFocusGained + private void spnTonnageFocusGained(java.awt.event.FocusEvent evt) { - }//GEN-LAST:event_spnTonnageFocusGained + } - private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed + private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { setCursor( Hourglass ); File savevee = GetSaveFile( "saw", Prefs.get( "LastOpenCVDirectory", "" ), true, false ); @@ -6494,7 +5754,8 @@ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor( NormalCursor ); setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); CurVee.SetChanged( false ); - }//GEN-LAST:event_btnSaveActionPerformed + } + private void SaveOmniFluffInfo() { if( SetSource ) { CurVee.setSource( txtSource.getText() ); @@ -6505,23 +5766,7 @@ private void SaveOmniFluffInfo() { CurVee.SetYear( Integer.parseInt( txtProdYear.getText() ), chkYearRestrict.isSelected() ); } catch( Exception e ) { // nothing really to be done, set it to a default. - switch( cmbEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.SetYear( 3132, false ); - break; - case AvailableCode.ERA_ALL: - CurVee.SetYear( 0, false ); - break; - } + CurVee.SetYear( CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ), false ); } } } @@ -6531,7 +5776,7 @@ private void LoadOmniFluffInfo() { cmbEra.setSelectedIndex( CurVee.GetEra() ); cmbProductionEra.setSelectedIndex( CurVee.GetProductionEra() ); txtSource.setText( CurVee.getSource() ); - txtProdYear.setText( "" + CurVee.GetYear() ); + txtProdYear.setText( CurVee.YearWasSpecified() ? "" + CurVee.GetYear() : "" ); BuildTechBaseSelector(); } @@ -6668,31 +5913,50 @@ private boolean VerifyVehicle( ActionEvent evt ) { // if we have any systems that requires ECM and don't have it, let the user know if( ! CurVee.ValidateECM() ) { - Media.Messager( "This 'Mech requires an ECM system of some sort to be valid.\nPlease install an ECM system." ); - tbpMainTabPane.setSelectedComponent( jPanel3 ); + Media.Messager( "This Vehicle requires an ECM system of some sort to be valid.\nPlease install an ECM system." ); + tbpMainTabPane.setSelectedComponent( pnlEquipment ); SetSource = true; return false; } // ensure we're not overweight + ArrayList loadouts = new ArrayList<>(); if( CurVee.IsOmni() ) { - ArrayList v = CurVee.GetLoadouts(); - for( int i = 0; i < v.size(); i++ ) { - CurVee.SetCurLoadout( ((ifCVLoadout) v.get( i )).GetName() ); - if( CurVee.GetCurrentTons() > CurVee.GetTonnage() ) { - Media.Messager( this, ((ifCVLoadout) v.get( i )).GetName() + - " loadout is overweight. Reduce the weight\nto equal or below the Vehicle's tonnage." ); - //cmbOmniVariant.setSelectedItem( ((ifCVLoadout) v.get( i )).GetName() ); - //cmbOmniVariantActionPerformed( evt ); - tbpMainTabPane.setSelectedComponent( pnlBasicSetup ); - SetSource = true; - return false; - } - } + loadouts.addAll( CurVee.GetLoadouts() ); } else { + loadouts.add( null ); + } + for( ifCVLoadout loadout : loadouts ) { + String name; + JPanel panel; + if( loadout == null ) { + name = "This Vehicle"; + panel = pnlBasicSetup; + } else { + name = loadout.GetName() + " loadout"; + CurVee.SetCurLoadout( loadout.GetName() ); + panel = pnlEquipment; + } if( CurVee.GetCurrentTons() > CurVee.GetTonnage() ) { - Media.Messager( this, "This Vehicle is overweight. Reduce the weight to\nequal or below the Vehicle's tonnage." ); - tbpMainTabPane.setSelectedComponent( pnlBasicSetup ); + Media.Messager( this, name + " is overweight.\n" + + "Reduce the weight to equal or below the Vehicle's tonnage." ); + tbpMainTabPane.setSelectedComponent( panel ); + SetSource = true; + return false; + } + Turret turret = CurVee.GetLoadout().GetTurret(); + if( turret.isTonnageSet() && turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + Media.Messager( this, name + "'s turret is overweight.\n" + + "Reduce the turret's weight to equal or below its max tonnage." ); + tbpMainTabPane.setSelectedComponent( panel ); + SetSource = true; + return false; + } + turret = CurVee.GetLoadout().GetRearTurret(); + if( turret.isTonnageSet() && turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + Media.Messager( this, name + "'s rear turret is overweight.\n" + + "Reduce the rear turret's weight to equal or below its max tonnage." ); + tbpMainTabPane.setSelectedComponent( panel ); SetSource = true; return false; } @@ -6704,7 +5968,7 @@ private boolean VerifyVehicle( ActionEvent evt ) { return true; } - private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTonnageStateChanged + private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // We have to decode the selected index to set values. A bit safer, I @@ -6757,10 +6021,9 @@ private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI FixArmorSpinners(); // now refresh the information panes - //RefreshInternalPoints(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnTonnageStateChanged + } private void EnableJumpJets( boolean enable ) { // this enables or disables the jump jet spinner if needed @@ -6809,6 +6072,7 @@ private void RecalcEngine() { private void GetNewVee() { boolean Omni = CurVee.IsOmni(); + quirks = new ArrayList(); CurVee = new CombatVehicle(); spnTonnage.setModel(new SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1)); spnCruiseMP.setModel(new SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1)); @@ -6823,6 +6087,7 @@ private void GetNewVee() { cmbTechBase.setEnabled( true ); cmbTurret.setSelectedIndex(0); spnTurretTonnage.setModel(new SpinnerNumberModel(0.0, 0.0, 50.0, 0.5)); + spnRearTurretTonnage.setModel(new SpinnerNumberModel(0.0, 0.0, 50.0, 0.5)); cmbOmniVariant.setModel( new javax.swing.DefaultComboBoxModel( new String[0] ) ); @@ -6837,6 +6102,8 @@ private void GetNewVee() { chkDuneBuggy.setSelected(false); chkEnviroSealing.setSelected(false); chkTrailer.setSelected(false); + chkSupercharger.setSelected(false); + chkJetBooster.setSelected(false); if( Omni ) { UnlockGUIFromOmni(); @@ -6845,23 +6112,7 @@ private void GetNewVee() { CurVee.SetEra( cmbEra.getSelectedIndex() ); CurVee.SetProductionEra( cmbProductionEra.getSelectedIndex() ); CurVee.SetRulesLevel( cmbRulesLevel.getSelectedIndex() ); - switch( CurVee.GetEra() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.SetYear( 3130, false ); - break; - case AvailableCode.ERA_ALL: - CurVee.SetYear( 0, false ); - break; - } + CurVee.SetYear( CommonTools.GetEraDefaultYear( CurVee.GetEra() ), false ); cmbTechBase.setSelectedItem( Prefs.get( "NewVee_Techbase", "Inner Sphere" ) ); switch( cmbTechBase.getSelectedIndex() ) { @@ -6891,8 +6142,6 @@ private void GetNewVee() { BuildArmorSelector(); BuildExpEquipmentSelector(); CheckOmni(); - //cmbEngineType.setSelectedItem( saw.Constants.DEFAULT_ENGINE ); - //cmbArmorType.setSelectedItem( saw.Constants.DEFAULT_ARMOR ); FixMPSpinner(); FixJJSpinnerModel(); FixArmorSpinners(); @@ -6903,6 +6152,8 @@ private void GetNewVee() { SetWeaponChoosers(); ResetAmmo(); + tblQuirks.setModel(new tbQuirks(new ArrayList())); + Overview.StartNewDocument(); Capabilities.StartNewDocument(); History.StartNewDocument(); @@ -6934,20 +6185,18 @@ public String getColumnName( int col ) { public int getRowCount() { return CurVee.GetLoadout().GetEquipment().size(); } public int getColumnCount() { return 2; } public Object getValueAt( int row, int col ) { + if (CurVee.GetLoadout().GetEquipment().isEmpty()) { return null; } + if (CurVee.GetLoadout().GetEquipment().size() <= row) { return null; } Object o = CurVee.GetLoadout().GetEquipment().get( row ); if( col == 1 ) { - return ((abPlaceable) o).GetManufacturer(); + return CommonTools.UnknownToEmpty( ((abPlaceable) o).GetManufacturer() ); } else { return ((abPlaceable) o).CritName(); } } @Override public boolean isCellEditable( int row, int col ) { - if( col == 0 ) { - return false; - } else { - return true; - } + return col != 0; } @Override public void setValueAt( Object value, int row, int col ) { @@ -6959,23 +6208,18 @@ public void setValueAt( Object value, int row, int col ) { // fireTableCellUpdated( row, col ); //} else { ArrayList v = CurVee.GetLoadout().GetEquipment(); - for( int i = 0; i < v.size(); i++ ) { - if( FileCommon.LookupStripArc( ((abPlaceable) v.get( i )).LookupName() ).equals( FileCommon.LookupStripArc( a.LookupName() ) ) ) { - ((abPlaceable) v.get( i )).SetManufacturer( (String) value ); - } + for (Object o : v) { + if (FileCommon.LookupStripArc(((abPlaceable) o).LookupName()).equals(FileCommon.LookupStripArc(a.LookupName()))) { + ((abPlaceable) o).SetManufacturer((String) value); } + } fireTableDataChanged(); //} } } ); - tblWeaponManufacturers.getInputMap( javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_TAB, 0, false ), "selectNextRow" ); - if( cmbEra.getSelectedIndex() == AvailableCode.ERA_ALL ) { - chkYearRestrict.setEnabled( false ); - } else { - chkYearRestrict.setEnabled( true ); - } + chkYearRestrict.setEnabled(cmbEra.getSelectedIndex() != AvailableCode.ERA_ALL); CurVee.SetChanged( false ); setTitle( saw.Constants.AppDescription + " " + saw.Constants.GetVersion() ); } @@ -6989,141 +6233,36 @@ private void CheckOmni() { chkOmniVee.setSelected( false ); } - // now let's ensure that all the omni controls are enabled or disabled - // as appropriate - if( chkOmniVee.isEnabled() ) { - if( chkOmniVee.isSelected() ) { - btnLockChassis.setEnabled( true ); - } else { - btnLockChassis.setEnabled( false ); - } - } else { - btnLockChassis.setEnabled( false ); - } - } - private void RefreshEquipment() { - // refreshes the equipment selectors - //fix the CASE control - CASE Case = new CASE(); - if ( CommonTools.IsAllowed( Case.GetAvailability(), CurVee) || CurVee.GetTechBase() == AvailableCode.TECH_CLAN ) { - chkClanCASE.setEnabled(true); - } else { - chkClanCASE.setSelected(false); - chkClanCASE.setEnabled(false); - } - - // fix Artemis IV controls - ifMissileGuidance ArtCheck = new ArtemisIVFCS( null ); - if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { - chkFCSAIV.setEnabled( true ); - } else { - chkFCSAIV.setSelected( false ); - chkFCSAIV.setEnabled( false ); - } - - // fix Artemis V controls - ArtCheck = new ArtemisVFCS( null ); - if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { - chkFCSAV.setEnabled( true ); - } else { - chkFCSAV.setSelected( false ); - chkFCSAV.setEnabled( false ); - } - - // fix Artemis IV controls - ArtCheck = new ApolloFCS( null ); - if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { - chkFCSApollo.setEnabled( true ); - } else { - chkFCSApollo.setSelected( false ); - chkFCSApollo.setEnabled( false ); - } - - // fix the targeting computer display - if( CommonTools.IsAllowed( CurVee.GetTC().GetAvailability(), CurVee ) ) { - chkUseTC.setEnabled( true ); - if( CurVee.UsingTC() ) { - chkUseTC.setSelected( true ); - } else { - chkUseTC.setSelected( false ); - } - } else { - chkUseTC.setSelected( false ); - chkUseTC.setEnabled( false ); - } - - // check all multi-slot systems - if( CommonTools.IsAllowed( CurVee.GetBlueShield().GetAvailability(), CurVee ) ) { - //chkBSPFD.setEnabled( true ); - } else { - //chkBSPFD.setEnabled( false ); - //chkBSPFD.setSelected( false ); - } - if( CommonTools.IsAllowed( CurVee.GetLoadout().GetSupercharger().GetAvailability(), CurVee ) ) { - chkSupercharger.setEnabled( true ); - } else { - chkSupercharger.setEnabled( false ); - } - - // now set all the equipment if needed - if( ! chkFCSAIV.isEnabled() ) { - try { - CurVee.SetFCSArtemisIV( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - chkFCSAIV.setSelected( false ); - } else { - if( CurVee.UsingArtemisIV() ) { - chkFCSAIV.setSelected( true ); - } else { - chkFCSAIV.setSelected( false ); - } - } - if( ! chkFCSAV.isEnabled() ) { - try { - CurVee.SetFCSArtemisV( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - chkFCSAV.setSelected( false ); - } else { - if( CurVee.UsingArtemisV() ) { - chkFCSAV.setSelected( true ); - } else { - chkFCSAV.setSelected( false ); - } - } - if( ! chkFCSApollo.isEnabled() ) { - try { - CurVee.SetFCSApollo( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - chkFCSApollo.setSelected( false ); - } else { - if( CurVee.UsingApollo() ) { - chkFCSApollo.setSelected( true ); - } else { - chkFCSApollo.setSelected( false ); - } - } - if( ! chkSupercharger.isEnabled() ) { - try { - CurVee.GetLoadout().SetSupercharger( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - } else { - if( CurVee.GetLoadout().HasSupercharger() ) { - chkSupercharger.setSelected( true ); - } else { - chkSupercharger.setSelected( false ); - } - } + // now let's ensure that all the omni controls are enabled or disabled + // as appropriate + btnLockChassis.setEnabled( chkOmniVee.isEnabled() && chkOmniVee.isSelected() ); + } + + private void RefreshEquipment() { + // refreshes the equipment selectors + //fix the CASE control + CASE Case = new CASE(); + setCheckbox(chkCASE, ( CommonTools.IsAllowed( Case.GetAvailability(), CurVee) || CurVee.GetTechBase() == AvailableCode.TECH_CLAN ), CurVee.GetLoadout().HasCase()); + + // fix Artemis IV controls + ifMissileGuidance ArtCheck = new ArtemisIVFCS( null ); + setCheckbox(chkFCSAIV, ( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ), CurVee.UsingArtemisIV()); + + // fix Artemis V controls + ArtCheck = new ArtemisVFCS( null ); + setCheckbox(chkFCSAV, ( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ), CurVee.UsingArtemisV()); + + // fix ApolloFCS controls + ArtCheck = new ApolloFCS( null ); + setCheckbox(chkFCSApollo, ( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ), CurVee.UsingApollo()); + + // fix the targeting computer display + setCheckbox(chkUseTC, ( CommonTools.IsAllowed( CurVee.GetTC().GetAvailability(), CurVee ) ), CurVee.UsingTC()); + + setCheckbox(chkSupercharger, ( CommonTools.IsAllowed( CurVee.GetLoadout().GetSupercharger().GetAvailability(), CurVee ) && !CurVee.IsVTOL() ), CurVee.GetLoadout().HasSupercharger()); + setCheckbox(chkJetBooster, ( CommonTools.IsAllowed( CurVee.GetLoadout().GetVTOLBooster().GetAvailability(), CurVee ) && CurVee.IsVTOL() && !CurVee.IsOmni() ), CurVee.GetLoadout().HasVTOLBooster()); if( ! chkUseTC.isEnabled() ) { CurVee.UseTC( false, false ); } - chkClanCASE.setSelected( CurVee.GetLoadout().HasISCASE() ); if( CurVee.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { chkFractional.setEnabled( true ); @@ -7136,28 +6275,31 @@ private void RefreshEquipment() { if( CurVee.IsOmni() ) { // these items can only be loaded into the base chassis, so they // are always locked for an Omni (although they may be checked). - //chkBSPFD.setEnabled( false ); chkEnviroSealing.setEnabled( false ); chkCommandConsole.setEnabled( false ); + chkJetBooster.setEnabled(false); - // now see if we have a supercharger on the base chassis + //These items can be selected on the base or variants but if the base + //has them disable and mark as selected if( CurVee.GetBaseLoadout().HasSupercharger() ) { chkSupercharger.setEnabled( false ); + chkSupercharger.setSelected( true ); } - if( CurVee.GetBaseLoadout().HasISCASE() ) { - chkClanCASE.setEnabled(false); - } - } else { - try { - //if( ! chkBSPFD.isEnabled() ) { locArmor.SetBlueShield( false ); } - //if( ! chkCommandConsole.isEnabled() ) { locArmor.SetCommandConsole( false ); } - } catch( Exception e ) { - // we should never get this, but report it if we do - Media.Messager( this, e.getMessage() ); + if( CurVee.GetBaseLoadout().HasCase() ) { + chkCASE.setEnabled( false ); + chkCASE.setSelected( true ); } } } + private void setCheckbox(JCheckBox element, Boolean isEnabled, Boolean isSelected) { + element.setEnabled(isEnabled); + element.setSelected(false); + if (isEnabled) { + element.setSelected(isSelected); + } + } + private void SetWeaponChoosers() { // sets the weapon choosers up. first, get the user's choices. @@ -7202,7 +6344,6 @@ private void UnlockGUIFromOmni() { // an Omni. isLocked = false; - chkOmniVee.setSelected( false ); chkOmniVee.setEnabled( true ); mnuUnlock.setEnabled( false ); cmbMotiveType.setEnabled( true ); @@ -7210,6 +6351,7 @@ private void UnlockGUIFromOmni() { cmbEngineType.setEnabled( true ); cmbTurret.setEnabled( true ); spnTurretTonnage.setEnabled( true ); + spnRearTurretTonnage.setEnabled( true ); spnFrontArmor.setEnabled( true ); spnLeftArmor.setEnabled( true ); spnRightArmor.setEnabled( true ); @@ -7224,20 +6366,17 @@ private void UnlockGUIFromOmni() { chkTrailer.setEnabled( true ); //btnEfficientArmor.setEnabled( true ); //btnBalanceArmor.setEnabled( true ); - btnLockChassis.setEnabled( false ); + btnLockChassis.setEnabled( chkOmniVee.isSelected() ); chkFCSAIV.setEnabled( true ); chkFCSAV.setEnabled( true ); chkFCSApollo.setEnabled( true ); - chkClanCASE.setEnabled( true ); - chkOmniVee.setSelected( false ); - chkOmniVee.setEnabled( true ); + chkCASE.setEnabled( true ); spnCruiseMP.setEnabled( true ); chkYearRestrict.setEnabled( true ); - //chkBSPFD.setEnabled( true ); chkSupercharger.setEnabled( true ); + chkJetBooster.setEnabled(true); chkEnviroSealing.setEnabled( false ); // now enable the Omni controls - cmbOmniVariant.setSelectedItem(""); cmbOmniVariant.setEnabled( false ); btnAddVariant.setEnabled( false ); btnDeleteVariant.setEnabled( false ); @@ -7280,6 +6419,7 @@ private void RecalcArmor() { } SetPatchworkArmor(); } + private boolean AddECM() { // Adds an ECM suite if a certain system needs it if( Prefs.getBoolean( "AutoAddECM", true ) ) { @@ -7420,7 +6560,7 @@ private void RecalcEquipment() { } } - private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbEngineTypeActionPerformed + private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) { if( Load ) { return; } if( BuildLookupName( CurVee.GetEngine().GetCurrentState() ).equals( (String) cmbEngineType.getSelectedItem() ) ) { // only nuclear-powered mechs may use jump jets @@ -7438,25 +6578,11 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN return; } RecalcEngine(); - //spnCruiseMP.setValue(CurVee.getMinCruiseMP()); FixMPSpinner(); //When the engine changes we need to re-check the Heat Sinks CurVee.ResetHeatSinks(); - // only nuclear-powered mechs may use jump jets - /*if( CurVee.GetEngine().IsNuclear() ) { - /* - if( cmbJumpJetType.getSelectedItem() == null ) { - EnableJumpJets( false ); - } else { - EnableJumpJets( true ); - } - - } else { - EnableJumpJets( false ); - }*/ - // refresh the selected equipment listbox if( CurVee.GetLoadout().GetNonCore().toArray().length <= 0 ) { Equipment[SELECTED] = new Object[] { " " }; @@ -7468,9 +6594,9 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_cmbEngineTypeActionPerformed + } - private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbEraActionPerformed + private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) { if( Load ) { return; } // whenever the era is changed we basically need to reset the GUI and // most of the mech. Certain things we will transfer. @@ -7489,47 +6615,17 @@ private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: int tbsave = cmbTechBase.getSelectedIndex(); // change the year range and tech base options - switch( cmbEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - lblEraYears.setText( "2443 ~ 2800" ); - txtProdYear.setText( "" ); - CurVee.SetEra( AvailableCode.ERA_STAR_LEAGUE ); - CurVee.SetYear( 2750, false ); - if( ! CurVee.IsOmni() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_SUCCESSION: - lblEraYears.setText( "2801 ~ 3050" ); - txtProdYear.setText( "" ); - CurVee.SetEra( AvailableCode.ERA_SUCCESSION ); - CurVee.SetYear( 3025, false ); - if( ! CurVee.IsOmni() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_CLAN_INVASION: - lblEraYears.setText( "3051 ~ 3131" ); - txtProdYear.setText( "" ); - CurVee.SetEra( AvailableCode.ERA_CLAN_INVASION ); - CurVee.SetYear( 3075, false ); - if( ! CurVee.IsOmni() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_DARK_AGES: - lblEraYears.setText( "3132 on" ); - txtProdYear.setText( "" ); - CurVee.SetEra( AvailableCode.ERA_DARK_AGES ); - CurVee.SetYear( 3132, false ); - if( ! CurVee.IsOmni() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_ALL: - lblEraYears.setText( "Any" ); - txtProdYear.setText( "" ); - CurVee.SetEra( AvailableCode.ERA_ALL ); - CurVee.SetYear( 0, false ); - chkYearRestrict.setEnabled( false ); - break; + lblEraYears.setText( CommonTools.GetEraYearRange( cmbEra.getSelectedIndex() ) ); + txtProdYear.setText( "" ); + CurVee.SetEra( cmbEra.getSelectedIndex() ); + CurVee.SetYear( CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ), false ); + if( cmbEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CurVee.IsOmni() ) { chkYearRestrict.setEnabled( true ); } + } else { + chkYearRestrict.setEnabled( false ); } - CurVee.SetChanged(true); if( CurVee.IsOmni() ) { - //BuildJumpJetSelector(); RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); @@ -7555,14 +6651,13 @@ private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: // get the currently chosen selections SaveSelections(); + // since you can only ever change the era when not restricted, we're not + // doing it here. Pass in default values. + CurVee.GetLoadout().FlushIllegal(); + // refresh all the combo boxes. BuildChassisSelector(); BuildEngineSelector(); - //BuildGyroSelector(); - //BuildCockpitSelector(); - //BuildEnhancementSelector(); - //BuildHeatsinkSelector(); - //BuildJumpJetSelector(); BuildArmorSelector(); FixMPSpinner(); FixJJSpinnerModel(); @@ -7574,29 +6669,17 @@ private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: // when a new era is selected, we have to recalculate the mech RecalcEngine(); - //RecalcGyro(); - //RecalcIntStruc(); - //RecalcCockpit(); - //CurVee.GetActuators().PlaceActuators(); - //RecalcHeatSinks(); - //RecalcJumpJets(); - //RecalcEnhancements(); RecalcArmor(); RecalcEquipment(); - // since you can only ever change the era when not restricted, we're not - // doing it here. Pass in default values. - CurVee.GetLoadout().FlushIllegal(); - //CurVee.GetLoadout().FlushIllegal( cmbEra.getSelectedIndex(), 0, false ); - // now refresh the information panes RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); - }//GEN-LAST:event_cmbEraActionPerformed + } - private void chkFractionalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFractionalActionPerformed + private void chkFractionalActionPerformed(java.awt.event.ActionEvent evt) { if( chkFractional.isSelected() == CurVee.UsingFractionalAccounting() ) { return; } CurVee.SetFractionalAccounting( chkFractional.isSelected() ); if( ! CurVee.UsingFractionalAccounting() ) { @@ -7611,17 +6694,17 @@ private void chkFractionalActionPerformed(java.awt.event.ActionEvent evt) {//GEN RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); -}//GEN-LAST:event_chkFractionalActionPerformed + } - private void spnTonnageInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_spnTonnageInputMethodTextChanged + private void spnTonnageInputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnTonnageStateChanged(null); - }//GEN-LAST:event_spnTonnageInputMethodTextChanged + } - private void spnCruiseMPInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_spnCruiseMPInputMethodTextChanged + private void spnCruiseMPInputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnCruiseMPStateChanged(null); - }//GEN-LAST:event_spnCruiseMPInputMethodTextChanged + } - private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMaximizeActionPerformed + private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) { // this simply maximizes the mech's armor CVArmor a = CurVee.GetArmor(); a.Maximize(); @@ -7632,9 +6715,9 @@ private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnMaximizeActionPerformed + } - private void cmbArmorTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbArmorTypeActionPerformed + private void cmbArmorTypeActionPerformed(java.awt.event.ActionEvent evt) { if( Load ) { return; } if( BuildLookupName( CurVee.GetArmor().GetCurrentState() ).equals( (String) cmbArmorType.getSelectedItem() ) ) { return; @@ -7646,9 +6729,9 @@ private void cmbArmorTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_cmbArmorTypeActionPerformed + } - private void btnUseRemainingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUseRemainingActionPerformed + private void btnUseRemainingActionPerformed(java.awt.event.ActionEvent evt) { // see if we have a good number double freetons = CurVee.GetTonnage() - CurVee.GetCurrentTons() + CurVee.GetArmor().GetTonnage(); @@ -7671,9 +6754,9 @@ private void btnUseRemainingActionPerformed(java.awt.event.ActionEvent evt) {//G // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnUseRemainingActionPerformed + } - private void btnLoadImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadImageActionPerformed + private void btnLoadImageActionPerformed(java.awt.event.ActionEvent evt) { // Opens a file chooser for the user, then resizes the chosen image to // fit in the fluff label and adds it JFileChooser fc = new JFileChooser(); @@ -7730,15 +6813,15 @@ private void btnLoadImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // add the image to the fluff image label lblFluffImage.setIcon( newFluffImage ); CurVee.SetSSWImage( fc.getSelectedFile().getPath() ); -}//GEN-LAST:event_btnLoadImageActionPerformed + } - private void btnClearImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearImageActionPerformed + private void btnClearImageActionPerformed(java.awt.event.ActionEvent evt) { // Set the fluff image to default lblFluffImage.setIcon( null ); CurVee.SetSSWImage(""); -}//GEN-LAST:event_btnClearImageActionPerformed + } - private void btnExportTXTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportTXTActionPerformed + private void btnExportTXTActionPerformed(java.awt.event.ActionEvent evt) { // exports the mech to TXT format String CurLoadout = ""; if( CurVee.IsOmni() ) { @@ -7773,9 +6856,9 @@ private void btnExportTXTActionPerformed(java.awt.event.ActionEvent evt) {//GEN- //cmbOmniVariantActionPerformed( evt ); } setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); -}//GEN-LAST:event_btnExportTXTActionPerformed + } - private void btnExportHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportHTMLActionPerformed + private void btnExportHTMLActionPerformed(java.awt.event.ActionEvent evt) { // exports the mech to HTML format String CurLoadout = ""; if( CurVee.IsOmni() ) { @@ -7810,11 +6893,10 @@ private void btnExportHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN //cmbOmniVariantActionPerformed( evt ); } setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); -}//GEN-LAST:event_btnExportHTMLActionPerformed + } - private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportMTFActionPerformed + private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) { // exports the mech to MTF format for use in Megamek - String dir = Prefs.get( "MTFExportPath", "none" ); if( dir.equals( "none" ) ) { dir = Prefs.get( "LastOpenCVDirectory", "" ); @@ -7825,7 +6907,7 @@ private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN- } String filename = ""; - IO.MTFWriter mtfw = new IO.MTFWriter( CurVee ); + IO.MTFWriter mtfw = new IO.MTFWriter( CurVee, saw.Constants.AppDescription + " " + saw.Constants.GetVersion() ); try { filename = savemech.getCanonicalPath(); mtfw.WriteMTF( filename ); @@ -7837,35 +6919,51 @@ private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // if there were no problems, let the user know how it went Media.Messager( this, "Vehicle saved successfully to MTF:\n" + filename ); setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); -}//GEN-LAST:event_btnExportMTFActionPerformed + } - private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddQuirkActionPerformed - /* - dlgQuirks qmanage = new dlgQuirks(this, true, data, quirks); - qmanage.setLocationRelativeTo(this); - qmanage.setVisible(true); - tblQuirks.setModel(new tbQuirks(quirks)); - * - */ -}//GEN-LAST:event_btnAddQuirkActionPerformed + private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) { + ArrayList filtered = new ArrayList(); + for (Quirk item : data.GetQuirks()) { + if (item.isCombatvehicle()) { + filtered.add(item); + } + } + dlgQuirks qmanage = new dlgQuirks(this, true, CurVee, filtered, quirks); + qmanage.setLocationRelativeTo(this); qmanage.setVisible(true); + CurVee.SetQuirks(quirks); + RefreshQuirks(); + } - private void cmbTurretActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTurretActionPerformed + private void RefreshQuirks() { + tblQuirks.setModel(new tbQuirks(CurVee.GetQuirks())); + } + private void cmbTurretActionPerformed(java.awt.event.ActionEvent evt) { if( Load ) { return; } - //TODO add logic to CombatVehicle to handle the turret + String Turret = cmbTurret.getSelectedItem().toString(); - if ( Turret.equals("Single Turret")) { + if(Turret.equals("Single Turret") || Turret.equals("Chin Turret") ) { CurVee.setHasTurret1(true); - if (chkOmniVee.isSelected() && !isLocked ) - spnTurretTonnage.setEnabled(true); - } else if(Turret.equals("Dual Turret")) { + CurVee.setHasTurret2(false); + } else if( Turret.equals("Dual Turret") ) { CurVee.setHasTurret1(true); CurVee.setHasTurret2(true); - if (chkOmniVee.isSelected() && !isLocked ) - spnTurretTonnage.setEnabled(true); } else { CurVee.setHasTurret1(false); CurVee.setHasTurret2(false); - spnTurretTonnage.setEnabled(false); + } + if( CurVee.isHasTurret1() ) { + spnTurretTonnage.setEnabled( chkOmniVee.isSelected() && !isLocked ); + SetTurretTonnage( null ); + } else { + spnTurretTonnage.setEnabled( false ); + SetTurretTonnage( 0.0 ); + } + if( CurVee.isHasTurret2() ) { + spnRearTurretTonnage.setEnabled( chkOmniVee.isSelected() && !isLocked ); + SetRearTurretTonnage( null ); + } else { + spnRearTurretTonnage.setEnabled( false ); + SetRearTurretTonnage( 0.0 ); } BuildLocationSelector(); @@ -7873,9 +6971,9 @@ private void cmbTurretActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR RefreshSelectedEquipment(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_cmbTurretActionPerformed + } - private void btnSetArmorTonsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetArmorTonsActionPerformed + private void btnSetArmorTonsActionPerformed(java.awt.event.ActionEvent evt) { // we'll need a new dialogue to get the tonnage dlgArmorTonnage ArmorDialogue = new dlgArmorTonnage( this, true, CurVee ); ArmorDialogue.setLocationRelativeTo( this ); @@ -7904,9 +7002,9 @@ private void btnSetArmorTonsActionPerformed(java.awt.event.ActionEvent evt) {//G // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnSetArmorTonsActionPerformed + } - private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnHeatSinksStateChanged + private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnHeatSinks.getModel(); @@ -7941,7 +7039,7 @@ private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnHeatSinksStateChanged + } private void FixHeatSinkSpinnerModel() { // mainly provided for Omnis. @@ -7956,15 +7054,15 @@ private void FixHeatSinkSpinnerModel() { ((JSpinner.DefaultEditor)spnHeatSinks.getEditor()).getTextField().addFocusListener(spinners); } - private void spnHeatSinksFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_spnHeatSinksFocusGained - // TODO add your handling code here: - }//GEN-LAST:event_spnHeatSinksFocusGained + private void spnHeatSinksFocusGained(java.awt.event.FocusEvent evt) { + + } + + private void spnHeatSinksInputMethodTextChanged(java.awt.event.InputMethodEvent evt) { - private void spnHeatSinksInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_spnHeatSinksInputMethodTextChanged - // TODO add your handling code here: - }//GEN-LAST:event_spnHeatSinksInputMethodTextChanged + } - private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnFrontArmorStateChanged + private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnFrontArmor.getModel(); @@ -8013,9 +7111,9 @@ private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnFrontArmorStateChanged + } - private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnLeftArmorStateChanged + private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnLeftArmor.getModel(); @@ -8064,9 +7162,9 @@ private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnLeftArmorStateChanged + } - private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRightArmorStateChanged + private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnRightArmor.getModel(); @@ -8115,9 +7213,9 @@ private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRightArmorStateChanged + } - private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRearArmorStateChanged + private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnRearArmor.getModel(); @@ -8166,9 +7264,9 @@ private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRearArmorStateChanged + } - private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTurretArmorStateChanged + private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnTurretArmor.getModel(); @@ -8210,51 +7308,51 @@ private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GE // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnTurretArmorStateChanged + } - private void lstChooseAmmunitionValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseAmmunitionValueChanged + private void lstChooseAmmunitionValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstChooseAmmunition.getSelectedIndex() < 0 ) { return; } CurItem = (abPlaceable) Equipment[AMMUNITION][lstChooseAmmunition.getSelectedIndex()]; ShowInfoOn( CurItem ); - }//GEN-LAST:event_lstChooseAmmunitionValueChanged + } - private void lstChooseArtilleryValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseArtilleryValueChanged + private void lstChooseArtilleryValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstChooseArtillery.getSelectedIndex() < 0 ) { return; } CurItem = (abPlaceable) Equipment[ARTILLERY][lstChooseArtillery.getSelectedIndex()]; ShowInfoOn( CurItem ); - }//GEN-LAST:event_lstChooseArtilleryValueChanged + } - private void lstChooseEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseEquipmentValueChanged + private void lstChooseEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstChooseEquipment.getSelectedIndex() < 0 ) { return; } CurItem = (abPlaceable) Equipment[EQUIPMENT][lstChooseEquipment.getSelectedIndex()]; ShowInfoOn( CurItem ); - }//GEN-LAST:event_lstChooseEquipmentValueChanged + } - private void lstChooseMissileValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseMissileValueChanged + private void lstChooseMissileValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstChooseMissile.getSelectedIndex() < 0 ) { return; } CurItem = (abPlaceable) Equipment[MISSILE][lstChooseMissile.getSelectedIndex()]; ShowInfoOn( CurItem ); - }//GEN-LAST:event_lstChooseMissileValueChanged + } - private void lstChooseEnergyValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseEnergyValueChanged + private void lstChooseEnergyValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstChooseEnergy.getSelectedIndex() < 0 ) { return; } CurItem = (abPlaceable) Equipment[ENERGY][lstChooseEnergy.getSelectedIndex()]; ShowInfoOn( CurItem ); - }//GEN-LAST:event_lstChooseEnergyValueChanged + } - private void lstChooseBallisticValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseBallisticValueChanged + private void lstChooseBallisticValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstChooseBallistic.getSelectedIndex() < 0 ) { return; } CurItem = (abPlaceable) Equipment[BALLISTIC][lstChooseBallistic.getSelectedIndex()]; ShowInfoOn( CurItem ); -}//GEN-LAST:event_lstChooseBallisticValueChanged + } - private void lstChoosePhysicalValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChoosePhysicalValueChanged + private void lstChoosePhysicalValueChanged(javax.swing.event.ListSelectionEvent evt) { if( lstChoosePhysical.getSelectedIndex() < 0 ) { return; } CurItem = (abPlaceable) Equipment[PHYSICAL][lstChoosePhysical.getSelectedIndex()]; ShowInfoOn( CurItem ); - }//GEN-LAST:event_lstChoosePhysicalValueChanged + } - private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTechBaseActionPerformed + private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) { if( Load ) { return; } // do we really need to do this? if( CurVee.IsOmni() ) { @@ -8285,6 +7383,10 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F break; } + //Adding these here for now, since the loadout gets completely trashed, these selections need to go away. + chkSupercharger.setSelected(false); + chkJetBooster.setSelected(false); + // save the current selections. The 'Mech should have already // flushed any illegal equipment in the changeover SaveSelections(); @@ -8294,11 +7396,6 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F // refresh all the combo boxes. BuildChassisSelector(); BuildEngineSelector(); - //BuildGyroSelector(); - //BuildCockpitSelector(); - //BuildEnhancementSelector(); - //BuildHeatsinkSelector(); - //BuildJumpJetSelector(); BuildArmorSelector(); RefreshEquipment(); FixMPSpinner(); @@ -8309,18 +7406,11 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F LoadSelections(); if ( CurVee.GetTechBase() == AvailableCode.TECH_CLAN ) { - chkClanCASE.setSelected(true); - chkClanCASEActionPerformed(evt); + chkCASE.setSelected(true); + chkCASEActionPerformed(evt); } // recalculate the mech. RecalcEngine(); - //RecalcGyro(); - //RecalcIntStruc(); - //RecalcCockpit(); - //CurVee.GetActuators().PlaceActuators(); - //RecalcHeatSinks(); - //RecalcJumpJets(); - //RecalcEnhancements(); RecalcArmor(); } @@ -8329,12 +7419,13 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F chkUseTC.setSelected( false ); // now refresh the information panes + RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); - }//GEN-LAST:event_cmbTechBaseActionPerformed + } - private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRotorArmorStateChanged + private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnRotorArmor.getModel(); @@ -8376,9 +7467,9 @@ private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRotorArmorStateChanged + } - private void btnNewVeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewVeeActionPerformed + private void btnNewVeeActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION ); @@ -8386,9 +7477,9 @@ private void btnNewVeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR } GetNewVee(); Prefs.put("Currentfile", ""); - }//GEN-LAST:event_btnNewVeeActionPerformed + } - private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLockChassisActionPerformed + private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) { // currently testing right now. SaveOmniFluffInfo(); String VariantName = ""; @@ -8429,17 +7520,14 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE // make it an omni CurVee.SetOmni(VariantName); - chkOmniVee.setEnabled(false); - //FixTransferHandlers(); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); LockGUIForOmni(); RefreshOmniVariants(); RefreshOmniChoices(); - //SolidifyJJManufacturer(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnLockChassisActionPerformed + } private void RefreshOmniVariants() { ArrayList v = CurVee.GetLoadouts(); @@ -8466,46 +7554,19 @@ private void RefreshOmniChoices() { private void CheckEquipment() { // consolidating some code here. - if( CurVee.UsingArtemisIV() ) { - chkFCSAIV.setSelected( true ); - } else { - chkFCSAIV.setSelected( false ); - } - if( CurVee.UsingArtemisV() ) { - chkFCSAV.setSelected( true ); - } else { - chkFCSAV.setSelected( false ); - } - if( CurVee.UsingApollo() ) { - chkFCSApollo.setSelected( true ); - } else { - chkFCSApollo.setSelected( false ); - } - - if( CurVee.UsingTC() ) { - chkUseTC.setSelected( true ); - } else { - chkUseTC.setSelected( false ); - } - - - if( CurVee.GetLoadout().HasSupercharger() ) { - chkSupercharger.setSelected( true ); - } else { - chkSupercharger.setSelected( false ); - } - if( CurVee.GetLoadout().HasISCASE() ) { - chkClanCASE.setSelected( true ); - } else { - chkClanCASE.setSelected( false ); - } + chkFCSAIV.setSelected( CurVee.UsingArtemisIV() ); + chkFCSAV.setSelected( CurVee.UsingArtemisV() ); + chkFCSApollo.setSelected( CurVee.UsingApollo() ); + chkUseTC.setSelected( CurVee.UsingTC() ); + chkJetBooster.setSelected( CurVee.GetBaseLoadout().HasVTOLBooster() ); + chkSupercharger.setSelected( CurVee.GetBaseLoadout().HasSupercharger() ); + chkCASE.setSelected( CurVee.GetLoadout().HasCase() ); } private void LockGUIForOmni() { - // this locks most of the GUI controls. Used mainly by Omnimechs. + // this locks most of the GUI controls. Used mainly by OmniVehicles. isLocked = true; - chkOmniVee.setSelected( true ); chkOmniVee.setEnabled( false ); mnuUnlock.setEnabled( true ); spnTonnage.setEnabled( false ); @@ -8513,6 +7574,7 @@ private void LockGUIForOmni() { cmbEngineType.setEnabled( false ); cmbTurret.setEnabled( false ); spnTurretTonnage.setEnabled( false ); + spnRearTurretTonnage.setEnabled( false ); spnFrontArmor.setEnabled( false ); spnLeftArmor.setEnabled( false ); spnRightArmor.setEnabled( false ); @@ -8540,12 +7602,13 @@ private void LockGUIForOmni() { if( chkFCSApollo.isSelected() ) { chkFCSApollo.setEnabled( false ); } - if ( chkClanCASE.isSelected() ) { - chkClanCASE.setEnabled(false); + if ( chkCASE.isSelected() ) { + chkCASE.setEnabled(false); } chkFractional.setEnabled( false ); chkEnviroSealing.setEnabled( false ); + chkJetBooster.setEnabled(false); if( CurVee.GetBaseLoadout().HasSupercharger() ) { chkSupercharger.setEnabled( false ); } @@ -8557,7 +7620,7 @@ private void LockGUIForOmni() { btnRenameVariant.setEnabled( true ); } - private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddVariantActionPerformed + private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) { SaveOmniFluffInfo(); String VariantName = ""; @@ -8585,20 +7648,16 @@ private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN // fix the GUI LoadOmniFluffInfo(); - //FixTransferHandlers(); - //SetLoadoutArrays(); SetWeaponChoosers(); - //BuildJumpJetSelector(); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); RefreshOmniVariants(); RefreshOmniChoices(); - //SolidifyJJManufacturer(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnAddVariantActionPerformed + } - private void btnDeleteVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteVariantActionPerformed + private void btnDeleteVariantActionPerformed(java.awt.event.ActionEvent evt) { // see if the user actually wants to delete the variant int choice = javax.swing.JOptionPane.showConfirmDialog(this, "Are you sure you want to delete this variant?", "Delete Variant?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -8617,19 +7676,15 @@ private void btnDeleteVariantActionPerformed(java.awt.event.ActionEvent evt) {// // refresh all the displays LoadOmniFluffInfo(); RefreshOmniVariants(); - //FixTransferHandlers(); - //SetLoadoutArrays(); SetWeaponChoosers(); - //BuildJumpJetSelector(); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); RefreshOmniChoices(); - //SolidifyJJManufacturer(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnDeleteVariantActionPerformed + } - private void btnRenameVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRenameVariantActionPerformed + private void btnRenameVariantActionPerformed(java.awt.event.ActionEvent evt) { SaveOmniFluffInfo(); String VariantName = ""; @@ -8662,9 +7717,9 @@ private void btnRenameVariantActionPerformed(java.awt.event.ActionEvent evt) {// CurVee.GetLoadout().SetName(VariantName); RefreshOmniVariants(); - }//GEN-LAST:event_btnRenameVariantActionPerformed + } - private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbOmniVariantActionPerformed + private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) { SaveOmniFluffInfo(); String variant = (String) cmbOmniVariant.getSelectedItem(); boolean changed = CurVee.HasChanged(); @@ -8673,11 +7728,7 @@ private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) {//GE // now fix the GUI LoadOmniFluffInfo(); - //FixTransferHandlers(); - //SetLoadoutArrays(); SetWeaponChoosers(); - //BuildJumpJetSelector(); - //cmbJumpJetType.setSelectedItem(CurVee.GetJumpJets().LookupName()); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); RefreshOmniVariants(); @@ -8689,26 +7740,22 @@ private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) {//GE // this prevents the program from setting the changed tag if we simply // open an omnimech for browsing. CurVee.SetChanged(changed); - }//GEN-LAST:event_cmbOmniVariantActionPerformed + } - private void chkOmniVeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOmniVeeActionPerformed - if( chkOmniVee.isSelected() ) { - btnLockChassis.setEnabled( true ); - } else { - btnLockChassis.setEnabled( false ); - } + private void chkOmniVeeActionPerformed(java.awt.event.ActionEvent evt) { + btnLockChassis.setEnabled( chkOmniVee.isSelected() ); cmbTurretActionPerformed(evt); - }//GEN-LAST:event_chkOmniVeeActionPerformed + } - private void cmbProductionEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbProductionEraActionPerformed + private void cmbProductionEraActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetProductionEra(cmbProductionEra.getSelectedIndex()); - }//GEN-LAST:event_cmbProductionEraActionPerformed + } - private void mnuNewMechActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuNewMechActionPerformed + private void mnuNewMechActionPerformed(java.awt.event.ActionEvent evt) { btnNewVeeActionPerformed(evt); - }//GEN-LAST:event_mnuNewMechActionPerformed + } - private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuLoadActionPerformed + private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -8724,11 +7771,12 @@ private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST CurVee = m; LoadVehicleIntoGUI(); CurVee.SetChanged(false); - }//GEN-LAST:event_mnuLoadActionPerformed + } - private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuOpenActionPerformed + private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) { btnOpenActionPerformed(evt); - }//GEN-LAST:event_mnuOpenActionPerformed + } + public CombatVehicle LoadVehicle (){ CombatVehicle m = null; @@ -8795,8 +7843,7 @@ public String getDescription() { return m; } - private void LoadVehicleFromFile( String filename ) - { + private void LoadVehicleFromFile( String filename ) { CombatVehicle m = null; if (! filename.isEmpty() ) { try { @@ -8820,12 +7867,12 @@ public void LoadVehicleIntoGUI() { UnlockGUIFromOmni(); chkYearRestrict.setSelected( CurVee.IsYearRestricted() ); - txtProdYear.setText( "" + CurVee.GetYear() ); + txtProdYear.setText( CurVee.YearWasSpecified() ? "" + CurVee.GetYear() : "" ); cmbEra.setEnabled( true ); cmbTechBase.setEnabled( true ); txtProdYear.setEnabled( true ); chkTrailer.setSelected( CurVee.isTrailer() ); - chkClanCASE.setSelected(CurVee.GetLoadout().HasISCASE()); + switch( CurVee.GetEra() ) { case AvailableCode.ERA_STAR_LEAGUE: lblEraYears.setText( "2443 ~ 2800" ); @@ -8862,21 +7909,36 @@ public void LoadVehicleIntoGUI() { cmbMotiveType.setSelectedItem( CurVee.GetMotiveLookupName() ); spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1) ); spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), CurVee.getMinCruiseMP(), CurVee.getMaxCruiseMP(), 1) ); - if ( CurVee.isHasTurret1() ) cmbTurret.setSelectedItem("Single Turret"); - if ( CurVee.isHasTurret2() ) cmbTurret.setSelectedItem("Dual Turret"); FixArmorSpinners(); // now that we're done with the special stuff... Load = false; - cmbOmniVariant.setModel( new javax.swing.DefaultComboBoxModel( new String[0] ) ); if( CurVee.IsOmni() ) { - if ( CurVee.isHasTurret1() ) - spnTurretTonnage.setModel( new SpinnerNumberModel(CurVee.GetBaseLoadout().GetTurret().GetMaxTonnage(), 0, 99.0, 0.5) ); + chkOmniVee.setSelected( true ); LockGUIForOmni(); RefreshOmniVariants(); RefreshOmniChoices(); + } else { + cmbOmniVariant.setModel( new javax.swing.DefaultComboBoxModel( new String[0] ) ); + } + + double turretTons = 0.0; + if( CurVee.isHasTurret1() ) { + if( chkOmniVee.isSelected() ) { + spnTurretTonnage.setEnabled( !isLocked ); + turretTons = CurVee.GetLoadout().GetTurret().GetTonnage(); + } } + SetTurretTonnage( turretTons ); + double rearTurretTons = 0.0; + if( CurVee.isHasTurret2() ) { + if( chkOmniVee.isSelected() ) { + spnRearTurretTonnage.setEnabled( !isLocked ); + rearTurretTons = CurVee.GetLoadout().GetRearTurret().GetTonnage(); + } + } + SetRearTurretTonnage( rearTurretTons ); FixTonnageSpinner( CurVee.GetMinTonnage(), CurVee.GetMaxTonnage() ); @@ -8900,7 +7962,6 @@ public void LoadVehicleIntoGUI() { RefreshEquipment(); chkUseTC.setSelected( CurVee.UsingTC() ); chkEnviroSealing.setSelected( CurVee.HasEnvironmentalSealing() ); - //chkCommandConsole.setSelected( CurVee.HasCommandConsole() ); RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); @@ -8911,6 +7972,8 @@ public void LoadVehicleIntoGUI() { media.blankLogo(lblFluffImage); media.setLogo(lblFluffImage, media.DetermineMatchingImage(CurVee.GetName(), CurVee.GetModel(), CurVee.GetSSWImage())); + RefreshQuirks(); + Overview.SetText( CurVee.getOverview() ); Capabilities.SetText( CurVee.getCapabilities() ); History.SetText( CurVee.getHistory() ); @@ -8918,28 +7981,26 @@ public void LoadVehicleIntoGUI() { Variants.SetText( CurVee.getVariants() ); Notables.SetText( CurVee.getNotables() ); Additional.SetText( CurVee.GetAdditional() ); - txtManufacturer.setText( CurVee.GetCompany() ); - txtManufacturerLocation.setText( CurVee.GetLocation() ); - txtEngineManufacturer.setText( CurVee.GetEngineManufacturer() ); - txtArmorModel.setText( CurVee.GetArmorModel() ); - txtChassisModel.setText( CurVee.GetChassisModel() ); + txtManufacturer.setText( CommonTools.UnknownToEmpty( CurVee.GetCompany() ) ); + txtManufacturerLocation.setText( CommonTools.UnknownToEmpty( CurVee.GetLocation() ) ); + txtEngineManufacturer.setText( CommonTools.UnknownToEmpty( CurVee.GetEngineManufacturer() ) ); + txtArmorModel.setText( CommonTools.UnknownToEmpty( CurVee.GetArmorModel() ) ); + txtChassisModel.setText( CommonTools.UnknownToEmpty( CurVee.GetChassisModel() ) ); if( CurVee.GetJumpJets().GetNumJJ() > 0 ) { txtJJModel.setEnabled( true ); } txtSource.setText( CurVee.getSource() ); // omnimechs may have jump jets in one loadout and not another. - txtJJModel.setText( CurVee.GetJJModel() ); - txtCommSystem.setText( CurVee.GetCommSystem() ); - txtTNTSystem.setText( CurVee.GetTandTSystem() ); + txtJJModel.setText( CommonTools.UnknownToEmpty( CurVee.GetJJModel() ) ); + txtCommSystem.setText( CommonTools.UnknownToEmpty( CurVee.GetCommSystem() ) ); + txtTNTSystem.setText( CommonTools.UnknownToEmpty( CurVee.GetTandTSystem() ) ); setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); CurVee.SetChanged(false); } - - - private void mnuImportHMPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuImportHMPActionPerformed + private void mnuImportHMPActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -9018,15 +8079,15 @@ public String getDescription() { CurVee = m; LoadVehicleIntoGUI(); CurVee.SetChanged(false); - }//GEN-LAST:event_mnuImportHMPActionPerformed + } - private void mnuBatchHMPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuBatchHMPActionPerformed + private void mnuBatchHMPActionPerformed(java.awt.event.ActionEvent evt) { dlgBatchHMP batch = new dlgBatchHMP(this, true); batch.setLocationRelativeTo(this); batch.setVisible(true); - }//GEN-LAST:event_mnuBatchHMPActionPerformed + } - private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSaveActionPerformed + private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) { // Solidify the mech first. setCursor(Hourglass); @@ -9089,9 +8150,9 @@ private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor(NormalCursor); setTitle(saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel()); CurVee.SetChanged(false); - }//GEN-LAST:event_mnuSaveActionPerformed + } - private void mnuSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSaveAsActionPerformed + private void mnuSaveAsActionPerformed(java.awt.event.ActionEvent evt) { setCursor(Hourglass); File savemech = GetSaveFile("saw", Prefs.get("LastOpenCVDirectory", ""), false, false); if (savemech == null) { @@ -9148,27 +8209,27 @@ private void mnuSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR setTitle(saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel()); CurVee.SetChanged(false); setCursor(NormalCursor); - }//GEN-LAST:event_mnuSaveAsActionPerformed + } - private void mnuExportHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportHTMLActionPerformed + private void mnuExportHTMLActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportHTMLActionPerformed(evt); SetSource = true; - }//GEN-LAST:event_mnuExportHTMLActionPerformed + } - private void mnuExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportMTFActionPerformed + private void mnuExportMTFActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportMTFActionPerformed(evt); SetSource = true; - }//GEN-LAST:event_mnuExportMTFActionPerformed + } - private void mnuExportTXTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportTXTActionPerformed + private void mnuExportTXTActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportTXTActionPerformed(evt); SetSource = true; - }//GEN-LAST:event_mnuExportTXTActionPerformed + } - private void mnuExportClipboardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportClipboardActionPerformed + private void mnuExportClipboardActionPerformed(java.awt.event.ActionEvent evt) { // takes the text export and copies it to thesystem clipboard. String CurLoadout = ""; String output = ""; @@ -9195,20 +8256,20 @@ private void mnuExportClipboardActionPerformed(java.awt.event.ActionEvent evt) { } java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(export, this); - }//GEN-LAST:event_mnuExportClipboardActionPerformed + } - private void mnuCreateTCGMechActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCreateTCGMechActionPerformed + private void mnuCreateTCGMechActionPerformed(java.awt.event.ActionEvent evt) { // Create CCG stats for mech // TODO: Add handling code to check if a canon card already exists. SolidifyVehicle(); //dlgCCGMech ccgMech = new dlgCCGMech(this, true, CurVee); //ccgMech.setLocationRelativeTo(this); //ccgMech.setVisible(true); - }//GEN-LAST:event_mnuCreateTCGMechActionPerformed + } - private void mnuPrintPreviewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuPrintPreviewActionPerformed + private void mnuPrintPreviewActionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); - }//GEN-LAST:event_mnuPrintPreviewActionPerformed + } public void QuickSave() { File saveFile = GetSaveFile( "saw", Prefs.get( "LastOpenCVDirectory", "" ), true, false ); @@ -9227,7 +8288,7 @@ public void QuickSave() { } } - private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed + private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -9236,11 +8297,10 @@ private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST } } CloseProgram(); - }//GEN-LAST:event_mnuExitActionPerformed + } - private void mnuFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuFileActionPerformed -// TODO add your handling code here: - }//GEN-LAST:event_mnuFileActionPerformed + private void mnuFileActionPerformed(java.awt.event.ActionEvent evt) { + } private void CloseProgram() { try { @@ -9254,31 +8314,33 @@ private void CloseProgram() { System.exit(0); } - private void mnuSummaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSummaryActionPerformed + private void mnuSummaryActionPerformed(java.awt.event.ActionEvent evt) { SolidifyVehicle(); dlgSummaryInfo Summary = new dlgSummaryInfo(this, true, CurVee); Summary.setLocationRelativeTo(this); Summary.setVisible(true); - }//GEN-LAST:event_mnuSummaryActionPerformed + } - private void mnuCostBVBreakdownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCostBVBreakdownActionPerformed + private void mnuCostBVBreakdownActionPerformed(java.awt.event.ActionEvent evt) { SolidifyVehicle(); dlgCostBVBreakdown costbv = new dlgCostBVBreakdown(this, true, CurVee); costbv.setLocationRelativeTo(this); costbv.setVisible(true); - }//GEN-LAST:event_mnuCostBVBreakdownActionPerformed + } - private void mnuTextTROActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuTextTROActionPerformed + private void mnuTextTROActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; SolidifyVehicle(); dlgTextExport Text = new dlgTextExport(this, true, CurVee); Text.setLocationRelativeTo(this); Text.setVisible(true); - CurVee.SetCurLoadout((String) cmbOmniVariant.getSelectedItem()); + if (cmbOmniVariant.isEnabled()) { + CurVee.SetCurLoadout((String) cmbOmniVariant.getSelectedItem()); + } SetSource = true; - }//GEN-LAST:event_mnuTextTROActionPerformed + } - private void mnuBFBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuBFBActionPerformed + private void mnuBFBActionPerformed(java.awt.event.ActionEvent evt) { String[] call = {"java", "-Xmx256m", "-jar", "bfb.jar"}; try { Runtime.getRuntime().exec(call); @@ -9286,22 +8348,22 @@ private void mnuBFBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: Media.Messager("Error while trying to open BFB\n" + ex.getMessage()); System.out.println(ex.getMessage()); } - }//GEN-LAST:event_mnuBFBActionPerformed + } - private void mnuOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuOptionsActionPerformed + private void mnuOptionsActionPerformed(java.awt.event.ActionEvent evt) { dlgPrefs preferences = new dlgPrefs(this, true); preferences.setLocationRelativeTo(this); preferences.setVisible(true); ResetAmmo(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_mnuOptionsActionPerformed + } - private void mnuViewToolbarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuViewToolbarActionPerformed + private void mnuViewToolbarActionPerformed(java.awt.event.ActionEvent evt) { setViewToolbar(mnuViewToolbar.getState()); - }//GEN-LAST:event_mnuViewToolbarActionPerformed + } - private void mnuClearUserDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuClearUserDataActionPerformed + private void mnuClearUserDataActionPerformed(java.awt.event.ActionEvent evt) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "This will remove all Solaris 7 user data.\nAre you sure you want to continue?", "Clear User Data?", javax.swing.JOptionPane.YES_NO_OPTION); if (choice == 1) { @@ -9311,9 +8373,9 @@ private void mnuClearUserDataActionPerformed(java.awt.event.ActionEvent evt) {// Prefs.put("S7Password", ""); Prefs.put("S7UserID", ""); } - }//GEN-LAST:event_mnuClearUserDataActionPerformed + } - private void mnuUnlockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuUnlockActionPerformed + private void mnuUnlockActionPerformed(java.awt.event.ActionEvent evt) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "Are you sure you want to unlock the chassis?\nAll omni loadouts" + " will be deleted\nand the Vehicle will revert to its base loadout.", @@ -9327,9 +8389,9 @@ private void mnuUnlockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); LoadVehicleIntoGUI(); - }//GEN-LAST:event_mnuUnlockActionPerformed + } - private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) { Overview.StartNewDocument(); Capabilities.StartNewDocument(); History.StartNewDocument(); @@ -9345,21 +8407,21 @@ private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI txtJJModel.setText(""); txtCommSystem.setText(""); txtTNTSystem.setText(""); - }//GEN-LAST:event_jMenuItem1ActionPerformed + } - private void mnuCreditsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCreditsActionPerformed + private void mnuCreditsActionPerformed(java.awt.event.ActionEvent evt) { dlgCredits Credits = new dlgCredits(this, true); Credits.setLocationRelativeTo(this); Credits.setVisible(true); - }//GEN-LAST:event_mnuCreditsActionPerformed + } - private void mnuAboutSSWActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAboutSSWActionPerformed + private void mnuAboutSSWActionPerformed(java.awt.event.ActionEvent evt) { dlgAboutBox about = new dlgAboutBox(this, true); about.setLocationRelativeTo(this); about.setVisible(true); - }//GEN-LAST:event_mnuAboutSSWActionPerformed + } - private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintActionPerformed + private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) { SolidifyVehicle(); PagePrinter printer = SetupPrinter(); Scenario s = new Scenario(); @@ -9367,9 +8429,9 @@ private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS dlgPreview prv = new dlgPreview("Print Preview", this, printer, s, imageTracker, true); prv.setLocationRelativeTo(this); prv.setVisible(true); - }//GEN-LAST:event_btnPrintActionPerformed + } - private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenActionPerformed + private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION ); @@ -9380,24 +8442,22 @@ private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST dOpen.setSize( 1024, 600 ); dOpen.setVisible(true); - }//GEN-LAST:event_btnOpenActionPerformed + } private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed CloseProgram(); - }//GEN-LAST:event_formWindowClosed + } - private void btnOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOptionsActionPerformed + private void btnOptionsActionPerformed(java.awt.event.ActionEvent evt) { dlgPrefs preferences = new dlgPrefs( this, true ); preferences.setLocationRelativeTo( this ); preferences.setVisible( true ); - //Mechrender.Reset(); ResetAmmo(); - //RefreshInternalPoints(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnOptionsActionPerformed + } - private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkYearRestrictActionPerformed + private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) { // This locks in the mech's production year, era, and tech base. int year = 0; if( CurVee.IsYearRestricted() == chkYearRestrict.isSelected() ) { return; } @@ -9408,23 +8468,7 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G cmbTechBase.setEnabled( true ); txtProdYear.setEnabled( true ); CurVee.SetYearRestricted( false ); - switch( cmbEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.SetYear( 3132, false ); - break; - case AvailableCode.ERA_ALL: - CurVee.SetYear( 0, false ); - break; - } + CurVee.SetYear( CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ), false ); } else { // ensure we have a good year. try{ @@ -9437,47 +8481,15 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G } // ensure the year is between the era years. - switch ( cmbEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - // Star League era - if( year < 2443 || year > 2800 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_SUCCESSION: - // Succession Wars era - if( year < 2801 || year > 3050 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_CLAN_INVASION: - // Clan Invasion Era - if( year < 3051 || year > 3131 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_DARK_AGES: - // Clan Invasion Era - if( year < 3132 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_ALL: - // all era + if( cmbEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CommonTools.IsYearInEra( year, cmbEra.getSelectedIndex() ) ) { + Media.Messager( this, "The year does not fall within this era." ); + txtProdYear.setText( "" ); chkYearRestrict.setSelected( false ); - chkYearRestrict.setEnabled( false ); + } + } else { + chkYearRestrict.setSelected( false ); + chkYearRestrict.setEnabled( false ); } // we know we have a good year, lock it in. @@ -9494,11 +8506,6 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G // first, refresh all the combo boxes. BuildChassisSelector(); BuildEngineSelector(); - //BuildGyroSelector(); - //BuildCockpitSelector(); - //BuildEnhancementSelector(); - //BuildHeatsinkSelector(); - //BuildJumpJetSelector(); BuildArmorSelector(); RefreshEquipment(); CheckOmni(); @@ -9508,16 +8515,8 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G // now redo the mech based on what happened. RecalcEngine(); - //RecalcGyro(); - //RecalcIntStruc(); - //RecalcCockpit(); - //CurVee.GetActuators().PlaceActuators(); - //RecalcHeatSinks(); - //RecalcJumpJets(); - //RecalcEnhancements(); RecalcArmor(); RecalcEquipment(); - //CurVee.GetLoadout().FlushIllegal( cmbMechEra.getSelectedIndex(), year, chkYearRestrict.isSelected() ); CurVee.GetLoadout().FlushIllegal(); // finally, refresh the information panes @@ -9525,10 +8524,10 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); - }//GEN-LAST:event_chkYearRestrictActionPerformed + } - private void btnExportClipboardIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportClipboardIconActionPerformed - // takes the text export and copies it to thesystem clipboard. + private void btnExportClipboardIconActionPerformed(java.awt.event.ActionEvent evt) { + // takes the text export and copies it to thesystem clipboard. String CurLoadout = ""; String output = ""; @@ -9554,15 +8553,15 @@ private void btnExportClipboardIconActionPerformed(java.awt.event.ActionEvent ev } java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents( export, this ); - }//GEN-LAST:event_btnExportClipboardIconActionPerformed + } - private void btnChatInfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChatInfoActionPerformed + private void btnChatInfoActionPerformed(java.awt.event.ActionEvent evt) { java.awt.datatransfer.StringSelection export = new java.awt.datatransfer.StringSelection(CurVee.GetChatInfo()); java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(export, this); - }//GEN-LAST:event_btnChatInfoActionPerformed + } - private void btnExportHTMLIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportHTMLIconActionPerformed + private void btnExportHTMLIconActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; // exports the mech to HTML format String CurLoadout = ""; @@ -9599,36 +8598,77 @@ private void btnExportHTMLIconActionPerformed(java.awt.event.ActionEvent evt) {/ } setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); SetSource = true; - }//GEN-LAST:event_btnExportHTMLIconActionPerformed + } - private void btnExportTextIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportTextIconActionPerformed + private void btnExportTextIconActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportTXTActionPerformed( evt ); SetSource = true; - }//GEN-LAST:event_btnExportTextIconActionPerformed + } - private void btnExportMTFIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportMTFIconActionPerformed + private void btnExportMTFIconActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportMTFActionPerformed( evt ); SetSource = true; - }//GEN-LAST:event_btnExportMTFIconActionPerformed + } - private void spnTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTurretTonnageStateChanged - double Tons = 0; - try - { - Tons = Double.parseDouble(spnTurretTonnage.getValue().toString()); - CurVee.GetLoadout().GetTurret().SetTonnage(Tons); - } catch ( Exception e ) { + private void spnTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) { + SetTurretTonnage( null ); + RefreshSummary(); + RefreshInfoPane(); + } + + private void SetTurretTonnage( Double Tons ) { + try { + if( Tons != null ) { + // following may end up calling spnTurretTonnageStateChanged + // which in turn will call this again with null Tons, + // so it's okay although potentially redundant + spnTurretTonnage.setValue( Tons ); + } + if( CurVee.isHasTurret1() && chkOmniVee.isSelected() ) { + if( Tons == null) { + Tons = Double.parseDouble( spnTurretTonnage.getValue().toString() ); + } + CurVee.GetLoadout().GetTurret().SetTonnage( Tons ); + } else { + CurVee.GetLoadout().GetTurret().UnsetTonnage(); + } + } catch( Exception e ) { Media.Messager(e.getMessage()); return; } + } + private void spnRearTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) { + SetRearTurretTonnage( null ); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnTurretTonnageStateChanged + } + + private void SetRearTurretTonnage( Double Tons ) { + try { + if( Tons != null ) { + // following may end up calling spnRearTurretTonnageStateChanged + // which in turn will call this again with null Tons, + // so it's okay although potentially redundant + spnRearTurretTonnage.setValue( Tons ); + } + if( CurVee.isHasTurret2() && chkOmniVee.isSelected() ) { + if( Tons == null) { + Tons = Double.parseDouble( spnRearTurretTonnage.getValue().toString() ); + } + CurVee.GetLoadout().GetRearTurret().SetTonnage( Tons ); + } else { + CurVee.GetLoadout().GetRearTurret().UnsetTonnage(); + } + } catch( Exception e ) { + Media.Messager(e.getMessage()); + return; + } + } - private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkTrailerActionPerformed + private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetTrailer(chkTrailer.isSelected()); String curEngine = cmbEngineType.getSelectedItem().toString(); BuildEngineSelector(); @@ -9655,40 +8695,38 @@ private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI else cmbEngineType.setSelectedItem(curEngine); cmbEngineTypeActionPerformed(evt); - //spnCruiseMP.setValue(1); - //((SpinnerNumberModel)spnCruiseMP.getModel()).setMinimum(1); lblFlankMP.setText( "" + CurVee.getFlankMP() ); } SetWeaponChoosers(); RefreshEquipment(); RefreshInfoPane(); - }//GEN-LAST:event_chkTrailerActionPerformed + } - private void chkFlotationHullActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFlotationHullActionPerformed + private void chkFlotationHullActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetFlotationHull(chkFlotationHull.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkFlotationHullActionPerformed + } - private void chkLimitedAmphActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkLimitedAmphActionPerformed + private void chkLimitedAmphActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetLimitedAmphibious(chkLimitedAmph.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkLimitedAmphActionPerformed + } - private void chkDuneBuggyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkDuneBuggyActionPerformed + private void chkDuneBuggyActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetDuneBuggy(chkDuneBuggy.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkDuneBuggyActionPerformed + } - private void chkEnviroSealingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkEnviroSealingActionPerformed + private void chkEnviroSealingActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetEnvironmentalSealing(chkEnviroSealing.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkEnviroSealingActionPerformed + } - private void spnRearTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRearTurretArmorStateChanged + private void spnRearTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) { if( Load ) { return; } // see what changed and perform the appropriate action javax.swing.SpinnerNumberModel n = (SpinnerNumberModel) spnRearTurretArmor.getModel(); @@ -9726,29 +8764,25 @@ private void spnRearTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) { // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRearTurretArmorStateChanged + } - private void cmbLocationMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cmbLocationMouseClicked + private void cmbLocationMouseClicked(java.awt.event.MouseEvent evt) { if ( evt.getClickCount() == 2 ) btnAddEquipActionPerformed(null); - }//GEN-LAST:event_cmbLocationMouseClicked + } - private void chkSponsonTurretActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSponsonTurretActionPerformed - if (chkSponsonTurret.isSelected()) - CurVee.setHasSponsonTurret(true); - else - CurVee.setHasSponsonTurret(false); + private void chkSponsonTurretActionPerformed(java.awt.event.ActionEvent evt) { + CurVee.setHasSponsonTurret(chkSponsonTurret.isSelected()); RefreshSelectedEquipment(); BuildLocationSelector(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkSponsonTurretActionPerformed + } - private void chkEscapePodActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkEscapePodActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_chkEscapePodActionPerformed + private void chkEscapePodActionPerformed(java.awt.event.ActionEvent evt) { + } - private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuReloadEquipmentActionPerformed + private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) { try { data = new DataFactory( CurVee ); } catch( Exception e ) { @@ -9756,7 +8790,7 @@ private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) { e.printStackTrace(); } SetWeaponChoosers(); - }//GEN-LAST:event_mnuReloadEquipmentActionPerformed + } private void chkFullAmphActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetFullAmphibious(chkFullAmph.isSelected()); @@ -9846,39 +8880,17 @@ private void FixJJSpinnerModel() { spnJumpMP.setModel( new javax.swing.SpinnerNumberModel( current, min, max, 1) ); } - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnAddEquip; - private javax.swing.JButton btnAddQuirk; - private javax.swing.JButton btnAddToForceList; private javax.swing.JButton btnAddVariant; - private javax.swing.JButton btnChatInfo; - private javax.swing.JButton btnClearEquip; - private javax.swing.JButton btnClearImage; private javax.swing.JButton btnDeleteVariant; - private javax.swing.JButton btnExportClipboardIcon; - private javax.swing.JButton btnExportHTML; - private javax.swing.JButton btnExportHTMLIcon; - private javax.swing.JButton btnExportMTF; - private javax.swing.JButton btnExportMTFIcon; - private javax.swing.JButton btnExportTXT; - private javax.swing.JButton btnExportTextIcon; - private javax.swing.JButton btnForceList; - private javax.swing.JButton btnLoadImage; private javax.swing.JButton btnLockChassis; private javax.swing.JButton btnMaximize; - private javax.swing.JButton btnNewVee; - private javax.swing.JButton btnOpen; - private javax.swing.JButton btnOptions; - private javax.swing.JButton btnPrint; - private javax.swing.JButton btnRemoveEquip; private javax.swing.JButton btnRenameVariant; - private javax.swing.JButton btnSave; private javax.swing.JButton btnSetArmorTons; private javax.swing.JButton btnUseRemaining; private javax.swing.JCheckBox chkArmoredMotive; private javax.swing.JCheckBox chkBalanceFRArmor; private javax.swing.JCheckBox chkBalanceLRArmor; - private javax.swing.JCheckBox chkClanCASE; + private javax.swing.JCheckBox chkCASE; private javax.swing.JCheckBox chkCommandConsole; private javax.swing.JCheckBox chkDuneBuggy; private javax.swing.JCheckBox chkEnviroSealing; @@ -9910,150 +8922,6 @@ private void FixJJSpinnerModel() { private javax.swing.JComboBox cmbRulesLevel; private javax.swing.JComboBox cmbTechBase; private javax.swing.JComboBox cmbTurret; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel10; - private javax.swing.JLabel jLabel11; - private javax.swing.JLabel jLabel12; - private javax.swing.JLabel jLabel13; - private javax.swing.JLabel jLabel14; - private javax.swing.JLabel jLabel15; - private javax.swing.JLabel jLabel16; - private javax.swing.JLabel jLabel17; - private javax.swing.JLabel jLabel18; - private javax.swing.JLabel jLabel19; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel20; - private javax.swing.JLabel jLabel21; - private javax.swing.JLabel jLabel22; - private javax.swing.JLabel jLabel23; - private javax.swing.JLabel jLabel24; - private javax.swing.JLabel jLabel25; - private javax.swing.JLabel jLabel26; - private javax.swing.JLabel jLabel27; - private javax.swing.JLabel jLabel28; - private javax.swing.JLabel jLabel29; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel30; - private javax.swing.JLabel jLabel31; - private javax.swing.JLabel jLabel32; - private javax.swing.JLabel jLabel33; - private javax.swing.JLabel jLabel34; - private javax.swing.JLabel jLabel35; - private javax.swing.JLabel jLabel36; - private javax.swing.JLabel jLabel37; - private javax.swing.JLabel jLabel38; - private javax.swing.JLabel jLabel39; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel40; - private javax.swing.JLabel jLabel41; - private javax.swing.JLabel jLabel42; - private javax.swing.JLabel jLabel43; - private javax.swing.JLabel jLabel44; - private javax.swing.JLabel jLabel45; - private javax.swing.JLabel jLabel46; - private javax.swing.JLabel jLabel47; - private javax.swing.JLabel jLabel48; - private javax.swing.JLabel jLabel49; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel50; - private javax.swing.JLabel jLabel51; - private javax.swing.JLabel jLabel52; - private javax.swing.JLabel jLabel53; - private javax.swing.JLabel jLabel54; - private javax.swing.JLabel jLabel55; - private javax.swing.JLabel jLabel56; - private javax.swing.JLabel jLabel57; - private javax.swing.JLabel jLabel58; - private javax.swing.JLabel jLabel59; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel60; - private javax.swing.JLabel jLabel61; - private javax.swing.JLabel jLabel62; - private javax.swing.JLabel jLabel63; - private javax.swing.JLabel jLabel64; - private javax.swing.JLabel jLabel65; - private javax.swing.JLabel jLabel66; - private javax.swing.JLabel jLabel67; - private javax.swing.JLabel jLabel68; - private javax.swing.JLabel jLabel69; - private javax.swing.JLabel jLabel7; - private javax.swing.JLabel jLabel70; - private javax.swing.JLabel jLabel71; - private javax.swing.JLabel jLabel72; - private javax.swing.JLabel jLabel73; - private javax.swing.JLabel jLabel74; - private javax.swing.JLabel jLabel75; - private javax.swing.JLabel jLabel76; - private javax.swing.JLabel jLabel77; - private javax.swing.JLabel jLabel78; - private javax.swing.JLabel jLabel79; - private javax.swing.JLabel jLabel8; - private javax.swing.JLabel jLabel80; - private javax.swing.JLabel jLabel81; - private javax.swing.JLabel jLabel82; - private javax.swing.JLabel jLabel83; - private javax.swing.JLabel jLabel84; - private javax.swing.JLabel jLabel85; - private javax.swing.JLabel jLabel86; - private javax.swing.JLabel jLabel87; - private javax.swing.JLabel jLabel88; - private javax.swing.JLabel jLabel89; - private javax.swing.JLabel jLabel9; - private javax.swing.JLabel jLabel90; - private javax.swing.JLabel jLabel91; - private javax.swing.JLabel jLabel92; - private javax.swing.JLabel jLabel93; - private javax.swing.JMenuBar jMenuBar1; - private javax.swing.JMenuItem jMenuItem1; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel10; - private javax.swing.JPanel jPanel11; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private javax.swing.JPanel jPanel6; - private javax.swing.JPanel jPanel7; - private javax.swing.JPanel jPanel8; - private javax.swing.JPanel jPanel9; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JScrollPane jScrollPane14; - private javax.swing.JScrollPane jScrollPane19; - private javax.swing.JScrollPane jScrollPane20; - private javax.swing.JScrollPane jScrollPane21; - private javax.swing.JScrollPane jScrollPane22; - private javax.swing.JScrollPane jScrollPane23; - private javax.swing.JScrollPane jScrollPane24; - private javax.swing.JScrollPane jScrollPane8; - private javax.swing.JScrollPane jScrollPane9; - private javax.swing.JToolBar.Separator jSeparator1; - private javax.swing.JSeparator jSeparator10; - private javax.swing.JSeparator jSeparator11; - private javax.swing.JSeparator jSeparator12; - private javax.swing.JSeparator jSeparator13; - private javax.swing.JSeparator jSeparator14; - private javax.swing.JSeparator jSeparator15; - private javax.swing.JSeparator jSeparator16; - private javax.swing.JSeparator jSeparator17; - private javax.swing.JSeparator jSeparator18; - private javax.swing.JSeparator jSeparator19; - private javax.swing.JToolBar.Separator jSeparator2; - private javax.swing.JSeparator jSeparator20; - private javax.swing.JToolBar.Separator jSeparator21; - private javax.swing.JSeparator jSeparator22; - private javax.swing.JSeparator jSeparator23; - private javax.swing.JSeparator jSeparator24; - private javax.swing.JToolBar.Separator jSeparator25; - private javax.swing.JSeparator jSeparator26; - private javax.swing.JSeparator jSeparator27; - private javax.swing.JToolBar.Separator jSeparator3; - private javax.swing.JSeparator jSeparator30; - private javax.swing.JToolBar.Separator jSeparator4; - private javax.swing.JSeparator jSeparator5; - private javax.swing.JSeparator jSeparator6; - private javax.swing.JSeparator jSeparator7; - private javax.swing.JSeparator jSeparator8; - private javax.swing.JSeparator jSeparator9; private javax.swing.JTextArea jTextAreaBFConversion; private javax.swing.JLabel lblArmorCoverage; private javax.swing.JLabel lblArmorLeftInLot; @@ -10071,7 +8939,6 @@ private void FixJJSpinnerModel() { private javax.swing.JLabel lblBFStructure; private javax.swing.JLabel lblBFWt; private javax.swing.JLabel lblBaseEngineRating; - private javax.swing.JLabel lblBattleMechQuirks; private javax.swing.JLabel lblEraYears; private javax.swing.JLabel lblFinalEngineRating; private javax.swing.JLabel lblFlankMP; @@ -10101,12 +8968,11 @@ private void FixJJSpinnerModel() { private javax.swing.JLabel lblLeftIntPts; private javax.swing.JLabel lblMinEngineTons; private javax.swing.JLabel lblNumCrew; - private javax.swing.JLabel lblProdYear; private javax.swing.JLabel lblRearIntPts; private javax.swing.JLabel lblRearTurretIntPts; private javax.swing.JLabel lblRightIntPts; private javax.swing.JLabel lblRotorIntPts; - private javax.swing.JLabel lblSelectVariant; + private javax.swing.JLabel lblMoveSummary; private javax.swing.JLabel lblSupensionFacter; private javax.swing.JLabel lblTurretIntPts; private javax.swing.JLabel lblVeeClass; @@ -10119,80 +8985,20 @@ private void FixJJSpinnerModel() { private javax.swing.JList lstChooseMissile; private javax.swing.JList lstChoosePhysical; private javax.swing.JList lstSelectedEquipment; - private javax.swing.JMenuItem mnuAboutSSW; - private javax.swing.JMenuItem mnuBFB; - private javax.swing.JMenuItem mnuBatchHMP; - private javax.swing.JMenu mnuClearFluff; - private javax.swing.JMenuItem mnuClearUserData; - private javax.swing.JMenuItem mnuCostBVBreakdown; - private javax.swing.JMenuItem mnuCreateTCGMech; - private javax.swing.JMenuItem mnuCredits; - private javax.swing.JMenuItem mnuExit; - private javax.swing.JMenu mnuExport; - private javax.swing.JMenuItem mnuExportClipboard; - private javax.swing.JMenuItem mnuExportHTML; - private javax.swing.JMenuItem mnuExportMTF; - private javax.swing.JMenuItem mnuExportTXT; - private javax.swing.JMenu mnuFile; - private javax.swing.JMenu mnuHelp; - private javax.swing.JMenu mnuImport; - private javax.swing.JMenuItem mnuImportHMP; - private javax.swing.JMenuItem mnuLoad; - private javax.swing.JMenuItem mnuNewMech; - private javax.swing.JMenuItem mnuOpen; - private javax.swing.JMenuItem mnuOptions; - private javax.swing.JMenu mnuPrint; - private javax.swing.JMenuItem mnuPrintPreview; - private javax.swing.JMenuItem mnuReloadEquipment; - private javax.swing.JMenuItem mnuSave; - private javax.swing.JMenuItem mnuSaveAs; - private javax.swing.JMenuItem mnuSummary; - private javax.swing.JMenuItem mnuTextTRO; private javax.swing.JMenuItem mnuUnlock; private javax.swing.JCheckBoxMenuItem mnuViewToolbar; private javax.swing.JPanel pnlAdditionalFluff; - private javax.swing.JPanel pnlAmmunition; - private javax.swing.JPanel pnlArtillery; - private javax.swing.JPanel pnlBFStats; - private javax.swing.JPanel pnlBallistic; private javax.swing.JPanel pnlBasicSetup; private javax.swing.JPanel pnlCapabilities; - private javax.swing.JPanel pnlChassis; - private javax.swing.JPanel pnlChassisMods; - private javax.swing.JPanel pnlControls; private javax.swing.JPanel pnlDeployment; - private javax.swing.JPanel pnlEnergy; - private javax.swing.JPanel pnlEquipInfo; - private javax.swing.JPanel pnlEquipmentChooser; - private javax.swing.JPanel pnlExperimental; - private javax.swing.JPanel pnlExport; - private javax.swing.JPanel pnlFluff; - private javax.swing.JPanel pnlFrontArmor; + private javax.swing.JPanel pnlEquipment; private javax.swing.JPanel pnlHistory; - private javax.swing.JPanel pnlImage; - private javax.swing.JPanel pnlInfoPane; - private javax.swing.JPanel pnlInformation; - private javax.swing.JPanel pnlLeftArmor; - private javax.swing.JPanel pnlManufacturers; - private javax.swing.JPanel pnlMissile; - private javax.swing.JPanel pnlMovement; private javax.swing.JPanel pnlNotables; - private javax.swing.JPanel pnlOmniInfo; private javax.swing.JPanel pnlOverview; - private javax.swing.JPanel pnlPhysical; - private javax.swing.JPanel pnlQuirks; - private javax.swing.JPanel pnlRearArmor; private javax.swing.JPanel pnlRearTurretArmor; - private javax.swing.JPanel pnlRightArmor; private javax.swing.JPanel pnlRotorArmor; - private javax.swing.JPanel pnlSelected; - private javax.swing.JPanel pnlSpecials; - private javax.swing.JPanel pnlSummary; private javax.swing.JPanel pnlTurretArmor; private javax.swing.JPanel pnlVariants; - private javax.swing.JPanel pnlWeaponsManufacturers; - private javax.swing.JScrollPane scpQuirkTable; - private javax.swing.JScrollPane scpWeaponManufacturers; private javax.swing.JSpinner spnCruiseMP; private javax.swing.JSpinner spnFrontArmor; private javax.swing.JSpinner spnHeatSinks; @@ -10205,11 +9011,10 @@ private void FixJJSpinnerModel() { private javax.swing.JSpinner spnTonnage; private javax.swing.JSpinner spnTurretArmor; private javax.swing.JSpinner spnTurretTonnage; - private javax.swing.JTable tblQuirks; + private javax.swing.JSpinner spnRearTurretTonnage; private javax.swing.JTable tblWeaponManufacturers; - private javax.swing.JTabbedPane tbpFluffEditors; - private javax.swing.JTabbedPane tbpMainTabPane; - private javax.swing.JTabbedPane tbpWeaponChooser; + private JTabbedPane tbpMainTabPane; + private JTabbedPane tbpWeaponChooser; private javax.swing.JToolBar tlbIconBar; private javax.swing.JTextField txtArmorModel; private javax.swing.JTextField txtArmorSpace; @@ -10227,6 +9032,7 @@ private void FixJJSpinnerModel() { private javax.swing.JTextField txtManufacturerLocation; private javax.swing.JTextField txtModel; private javax.swing.JTextField txtProdYear; + private javax.swing.JTextField txtRearTurretInfo; private javax.swing.JTextField txtSource; private javax.swing.JTextField txtSumArmAV; private javax.swing.JTextField txtSumArmSpace; @@ -10241,7 +9047,6 @@ private void FixJJSpinnerModel() { private javax.swing.JTextField txtSumIntAV; private javax.swing.JTextField txtSumIntTons; private javax.swing.JTextField txtSumJJAV; - private javax.swing.JTextField txtSumJJSpace; private javax.swing.JTextField txtSumJJTons; private javax.swing.JTextField txtSumLifAV; private javax.swing.JTextField txtSumLifTons; @@ -10256,6 +9061,7 @@ private void FixJJSpinnerModel() { private javax.swing.JTextField txtTNTSystem; private javax.swing.JTextField txtTurretInfo; private javax.swing.JTextField txtVehicleName; + private javax.swing.JTable tblQuirks; // End of variables declaration//GEN-END:variables public void lostOwnership(Clipboard clipboard, Transferable contents) { diff --git a/saw/src/main/java/saw/gui/frmVeeWide.form b/saw/src/main/java/saw/gui/frmVeeWide.form index 08f46e89..2a3a28d7 100644 --- a/saw/src/main/java/saw/gui/frmVeeWide.form +++ b/saw/src/main/java/saw/gui/frmVeeWide.form @@ -413,7 +413,23 @@ - + + + + + + + + + + + + + + + + + @@ -421,7 +437,7 @@ - + @@ -445,15 +461,15 @@ - + - + - + - + @@ -1071,7 +1087,7 @@ - + @@ -1083,6 +1099,7 @@ + @@ -1143,6 +1160,8 @@ + + @@ -1210,6 +1229,7 @@ + @@ -1389,11 +1409,34 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -1420,26 +1463,22 @@ - + - - - - - - - - - - - - - - + + + + + + + + + + + - @@ -1447,23 +1486,18 @@ - - - - + - + + - + - - - - + @@ -1504,6 +1538,11 @@ + + + + + @@ -1699,6 +1738,9 @@ + + + @@ -4199,10 +4241,10 @@ - + - - + + @@ -5470,7 +5512,7 @@ - + diff --git a/saw/src/main/java/saw/gui/frmVeeWide.java b/saw/src/main/java/saw/gui/frmVeeWide.java index e7ff267e..fe69ca62 100644 --- a/saw/src/main/java/saw/gui/frmVeeWide.java +++ b/saw/src/main/java/saw/gui/frmVeeWide.java @@ -37,9 +37,11 @@ import battleforce.BattleForceStats; import common.*; import components.*; +import dialog.dlgQuirks; import dialog.frmForce; import filehandlers.*; import gui.TextPane; +import list.view.tbQuirks; import saw.filehandlers.HTMLWriter; import states.ifState; import visitors.VArmorSetPatchworkLocation; @@ -48,10 +50,11 @@ import visitors.ifVisitor; import javax.swing.*; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionListener; import javax.swing.text.JTextComponent; import java.awt.*; import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.event.*; @@ -66,8 +69,8 @@ public final class frmVeeWide extends javax.swing.JFrame implements java.awt.dat Preferences Prefs; String[] Selections = { "", "" }; public DataFactory data; - private Cursor Hourglass = new Cursor( Cursor.WAIT_CURSOR ); - private Cursor NormalCursor = new Cursor( Cursor.DEFAULT_CURSOR ); + private final Cursor Hourglass = new Cursor( Cursor.WAIT_CURSOR ); + private final Cursor NormalCursor = new Cursor( Cursor.DEFAULT_CURSOR ); boolean Load = false, isLocked = false, SetSource = true; @@ -86,10 +89,10 @@ public final class frmVeeWide extends javax.swing.JFrame implements java.awt.dat private final AvailableCode PulseModuleAC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); private final AvailableCode CaselessAmmoAC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - private ImageTracker imageTracker = new ImageTracker(); + private final ImageTracker imageTracker = new ImageTracker(); public dlgOpen dOpen = new dlgOpen(this, true); public frmForce dForce = new frmForce(this, imageTracker); - + public ArrayList quirks = new ArrayList(); TextPane Overview = new TextPane(); TextPane Capabilities = new TextPane(); TextPane Deployment = new TextPane(); @@ -100,7 +103,6 @@ public final class frmVeeWide extends javax.swing.JFrame implements java.awt.dat JPopupMenu mnuUtilities = new JPopupMenu(); JMenuItem mnuDetails = new JMenuItem( "Details" ); - JMenuItem mnuMountRear = new JMenuItem( "Mount Rear" ); JMenuItem mnuSetVariable = new JMenuItem( "Set Tonnage" ); JMenuItem mnuSetLotSize = new JMenuItem( "Set Lot Size" ); JMenuItem mnuArmorComponent = new JMenuItem( "Armor Component" ); @@ -134,25 +136,22 @@ public final class frmVeeWide extends javax.swing.JFrame implements java.awt.dat public void focusGained(FocusEvent e) { if ( e.getSource() instanceof JTextComponent ) { final JTextComponent textComponent = ((JTextComponent)e.getSource()); - SwingUtilities.invokeLater(new Runnable() { - public void run() { - textComponent.selectAll(); - } - }); + SwingUtilities.invokeLater(textComponent::selectAll); } } }; - + /** Creates new form frmMain2 */ public frmVeeWide() { CurVee = new CombatVehicle( ); initComponents(); - Prefs = Preferences.userRoot().node( Constants.SSWPrefs ); + Prefs = Preferences.userRoot().node( Constants.SAWPrefs ); ArmorTons = new VSetArmorTonnage( Prefs ); cmbMotiveTypeActionPerformed(null); spnTonnageStateChanged(null); + setTitle( saw.Constants.AppDescription + " " + saw.Constants.GetVersion() ); // added for easy checking @@ -197,7 +196,7 @@ public frmVeeWide() { System.err.println( e.getMessage() ); e.printStackTrace(); } - + Overview.SetEditorSize( 310, 380 ); Capabilities.SetEditorSize( 310, 380 ); Deployment.SetEditorSize( 310, 380 ); @@ -212,111 +211,31 @@ public frmVeeWide() { pnlAdditionalFluff.add( Additional ); pnlVariants.add( Variants ); pnlNotables.add( Notables ); - pack(); - - - mnuDetails.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - GetInfoOn(); - ShowInfoOn(CurItem); - } - }); - - mnuSetVariable.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVariableSize(); - } - }); - - mnuSetLotSize.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetAmmoLotSize(); - } - }); - - mnuAddCapacitor.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - PPCCapacitor(); - } - }); - - mnuAddInsulator.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - LaserInsulator(); - } - }); - - mnuAddPulseModule.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - PulseModule(); - } - }); - - mnuDumper.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - DumperMount(); - } - }); - - mnuCaseless.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SwitchCaseless(); - } - }); - - mnuVGLArcFore.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcFore(); - } - }); - - mnuVGLArcForeSide.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcForeSide(); - } - }); - - mnuVGLArcRear.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcRear(); - } - }); - - mnuVGLArcRearSide.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLArcRearSide(); - } - }); - - mnuVGLAmmoFrag.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoFrag(); - } - }); - - mnuVGLAmmoChaff.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoChaff(); - } - }); - mnuVGLAmmoIncen.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoIncendiary(); - } - }); - - mnuVGLAmmoSmoke.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - SetVGLAmmoSmoke(); - } - }); + quirks = CurVee.GetQuirks(); + pack(); - mnuRemoveItem.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - RemoveItemCritTab(); - } - }); + mnuDetails.addActionListener(evt -> { + GetInfoOn(); + ShowInfoOn(CurItem); + }); + + mnuSetVariable.addActionListener(e -> SetVariableSize()); + mnuSetLotSize.addActionListener(e -> SetAmmoLotSize()); + mnuAddCapacitor.addActionListener(e -> PPCCapacitor()); + mnuAddInsulator.addActionListener(e -> LaserInsulator()); + mnuAddPulseModule.addActionListener(e -> PulseModule()); + mnuDumper.addActionListener(e -> DumperMount()); + mnuCaseless.addActionListener(e -> SwitchCaseless()); + mnuVGLArcFore.addActionListener(e -> SetVGLArcFore()); + mnuVGLArcForeSide.addActionListener(e -> SetVGLArcForeSide()); + mnuVGLArcRear.addActionListener(e -> SetVGLArcRear()); + mnuVGLArcRearSide.addActionListener(e -> SetVGLArcRearSide()); + mnuVGLAmmoFrag.addActionListener(e -> SetVGLAmmoFrag()); + mnuVGLAmmoChaff.addActionListener(e -> SetVGLAmmoChaff()); + mnuVGLAmmoIncen.addActionListener(e -> SetVGLAmmoIncendiary()); + mnuVGLAmmoSmoke.addActionListener(e -> SetVGLAmmoSmoke()); + mnuRemoveItem.addActionListener(e -> RemoveItemCritTab()); mnuVGLArc.setText( "Set VGL Arc" ); mnuVGLArc.add( mnuVGLArcFore ); @@ -352,7 +271,7 @@ public void actionPerformed(ActionEvent e) { mnuCaseless.setVisible( false ); mnuVGLArc.setVisible( false ); mnuVGLAmmo.setVisible( false ); - + // set the program options cmbRulesLevel.setSelectedItem( Prefs.get( "NewCV_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewCV_Era", "Age of War/Star League" ) ); @@ -381,29 +300,17 @@ public void actionPerformed(ActionEvent e) { ((JSpinner.DefaultEditor)spnRearTurretArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnRotorArmor.getEditor()).getTextField().addFocusListener(spinners); - mnuFluffCut.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed( ActionEvent e ) { - FluffCut( mnuFluff.getInvoker() ); - } - }); + mnuFluffCut.addActionListener(e -> FluffCut( mnuFluff.getInvoker() )); - mnuFluffCopy.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - FluffCopy( mnuFluff.getInvoker() ); - } - }); + mnuFluffCopy.addActionListener(e -> FluffCopy( mnuFluff.getInvoker() )); - mnuFluffPaste.addActionListener( new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - FluffPaste( mnuFluff.getInvoker() ); - } - }); + mnuFluffPaste.addActionListener(e -> FluffPaste( mnuFluff.getInvoker() )); mnuFluff.add( mnuFluffCut ); mnuFluff.add( mnuFluffCopy ); mnuFluff.add( mnuFluffPaste ); - - + + tblWeaponManufacturers.setModel( new javax.swing.table.AbstractTableModel() { @Override public String getColumnName( int col ) { @@ -418,18 +325,14 @@ public String getColumnName( int col ) { public Object getValueAt( int row, int col ) { Object o = CurVee.GetLoadout().GetEquipment().get( row ); if( col == 1 ) { - return ((abPlaceable) o).GetManufacturer(); + return CommonTools.UnknownToEmpty( ((abPlaceable) o).GetManufacturer() ); } else { return ((abPlaceable) o).CritName(); } } @Override public boolean isCellEditable( int row, int col ) { - if( col == 0 ) { - return false; - } else { - return true; - } + return col != 0; } @Override public void setValueAt( Object value, int row, int col ) { @@ -441,16 +344,16 @@ public void setValueAt( Object value, int row, int col ) { fireTableCellUpdated( row, col ); } else { ArrayList v = CurVee.GetLoadout().GetEquipment(); - for( int i = 0; i < v.size(); i++ ) { - if( FileCommon.LookupStripArc( ((abPlaceable) v.get( i )).LookupName() ).equals( FileCommon.LookupStripArc( a.LookupName() ) ) ) { - ((abPlaceable) v.get( i )).SetManufacturer( (String) value ); + for (Object o : v) { + if (FileCommon.LookupStripArc(((abPlaceable) o).LookupName()).equals(FileCommon.LookupStripArc(a.LookupName()))) { + ((abPlaceable) o).SetManufacturer((String) value); } } fireTableDataChanged(); } } } ); - + tblWeaponManufacturers.getInputMap( javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_TAB, 0, false ), "selectNextRow" ); if( Prefs.getBoolean( "LoadLastMech", false ) ) { LoadVehicleFromFile(Prefs.get("LastOpenCVDirectory", "") + Prefs.get("LastOpenCVFile", "") ); } @@ -470,7 +373,7 @@ private void GetInfoOn() { ItemInfo.setVisible( true ); } } - + private void SetAmmoLotSize() { if( CurItem instanceof Ammunition ) { dlgAmmoLotSize ammo = new dlgAmmoLotSize( this, true, (Ammunition) CurItem ); @@ -480,7 +383,7 @@ private void SetAmmoLotSize() { RefreshSummary(); RefreshInfoPane(); } - + private void PPCCapacitor() { // if the current item can support a capacitor, adds one on if( CurItem instanceof RangedWeapon ) { @@ -490,7 +393,6 @@ private void PPCCapacitor() { CurVee.GetLoadout().Remove( p ); } else { ((RangedWeapon) CurItem).UseCapacitor( true ); - abPlaceable p = ((RangedWeapon) CurItem).GetCapacitor(); LocationIndex Loc = CurVee.GetLoadout().FindIndex( CurItem ); if( Loc.Location != -1 ) { try { @@ -500,10 +402,6 @@ private void PPCCapacitor() { // couldn't allocate the capacitor? Unallocate the PPC. try { CurVee.GetLoadout().UnallocateAll( CurItem, false ); - // remove the capacitor if it's in the queue - //if( CurVee.GetLoadout().QueueContains( p ) ) { - // CurVee.GetLoadout().GetQueue().remove( p ); - //} } catch( Exception e1 ) { // failed big. no problem Media.Messager( this, "Fatal error adding a PPC Capacitor:\n" + e.getMessage() + "\nThe Capacitor will be removed." ); @@ -513,6 +411,7 @@ private void PPCCapacitor() { } } } + RefreshSummary(); RefreshInfoPane(); RefreshSelectedEquipment(); } @@ -536,10 +435,6 @@ private void LaserInsulator() { // couldn't allocate the insulator? Unallocate the PPC. try { CurVee.GetLoadout().UnallocateAll( CurItem, false ); - // remove the insulator if it's in the queue - //if( CurVee.GetLoadout().QueueContains( p ) ) { - // CurVee.GetLoadout().GetQueue().remove( p ); - //} } catch( Exception e1 ) { // failed big. no problem Media.Messager( this, "Fatal error adding a Laser Insulator:\n" + e.getMessage() + "\nThe Insulator will be removed." ); @@ -549,10 +444,11 @@ private void LaserInsulator() { } } } + RefreshSummary(); RefreshInfoPane(); RefreshSelectedEquipment(); } - + private void PulseModule() { // if the current item can support a Pulse Module, adds one on if( CurItem instanceof RangedWeapon ) { @@ -572,10 +468,6 @@ private void PulseModule() { // couldn't allocate the insulator? Unallocate the PPC. try { CurVee.GetLoadout().UnallocateAll( CurItem, false ); - // remove the insulator if it's in the queue - //if( CurVee.GetLoadout().QueueContains( p ) ) { - // CurVee.GetLoadout().GetQueue().remove( p ); - //} } catch( Exception e1 ) { // failed big. no problem Media.Messager( this, "Fatal error adding a Laser Insulator:\n" + e.getMessage() + "\nThe Insulator will be removed." ); @@ -585,13 +477,14 @@ private void PulseModule() { } } } + RefreshSummary(); RefreshInfoPane(); RefreshSelectedEquipment(); } private void DumperMount() { if ( CurItem instanceof Equipment ) { - + } } @@ -610,29 +503,29 @@ private void SwitchCaseless() { ArrayList replace = new ArrayList(); abPlaceable p; boolean HasOrig = false; - for( int i = 0; i < check.size(); i++ ) { - p = (abPlaceable) check.get( i ); - if( p instanceof RangedWeapon ) { - if( ((RangedWeapon) p).GetAmmoIndex() == origIDX ) { + for (Object o : check) { + p = (abPlaceable) o; + if (p instanceof RangedWeapon) { + if (((RangedWeapon) p).GetAmmoIndex() == origIDX) { HasOrig = true; } } - if( p instanceof Ammunition ) { - replace.add( p ); + if (p instanceof Ammunition) { + replace.add(p); } } // replace any ammo with the new stuff if there are no other original weapons if( ! HasOrig ) { Object[] newammo = data.GetEquipment().GetAmmo( newIDX, CurVee ); - for( int i = 0; i < replace.size(); i++ ) { - p = (abPlaceable) replace.get( i ); - if( ((Ammunition) p).GetAmmoIndex() == origIDX ) { - CurVee.GetLoadout().Remove( p ); - if( newammo.length > 0 ) { - p = data.GetEquipment().GetCopy( (abPlaceable) newammo[0], CurVee); + for (Object o : replace) { + p = (abPlaceable) o; + if (((Ammunition) p).GetAmmoIndex() == origIDX) { + CurVee.GetLoadout().Remove(p); + if (newammo.length > 0) { + p = data.GetEquipment().GetCopy((abPlaceable) newammo[0], CurVee); try { - CurVee.GetLoadout().AddTo( p, LocationIndex.CV_LOC_BODY ); + CurVee.GetLoadout().AddTo(p, LocationIndex.CV_LOC_BODY); } catch (Exception ex) { Media.Messager(ex.getMessage()); } @@ -720,18 +613,18 @@ public void SetVariableSize() { } } } - - private void setViewToolbar(boolean Visible) - { + + private void setViewToolbar(boolean Visible) { tlbIconBar.setVisible(Visible); Prefs.putBoolean("ViewToolbar", Visible); //mnuViewToolbar.setState(Visible); if (Visible) { - if (this.getHeight() != 600) { this.setSize(750, 600); } + if (this.getHeight() != 600) { this.setSize(1280, 600); } } else { - if (this.getHeight() != 575) { this.setSize(750, 575); } + if (this.getHeight() != 575) { this.setSize(1280, 575); } } } + private void ConfigureUtilsMenu( java.awt.Component c ) { // configures the utilities popup menu boolean cap = LegalCapacitor( CurItem ) && CommonTools.IsAllowed( PPCCapAC, CurVee ); @@ -740,10 +633,6 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { boolean caseless = LegalCaseless( CurItem ) && CommonTools.IsAllowed( CaselessAmmoAC, CurVee ); boolean lotchange = LegalLotChange( CurItem ); boolean dumper = LegalDumper( CurItem ); - mnuAddCapacitor.setEnabled( cap ); - mnuAddInsulator.setEnabled( insul ); - mnuAddPulseModule.setEnabled(pulseModule); - mnuCaseless.setEnabled( caseless ); mnuAddCapacitor.setVisible( cap ); mnuAddInsulator.setVisible( insul ); mnuAddPulseModule.setVisible(pulseModule); @@ -789,19 +678,11 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { } } if( CurItem instanceof Equipment ) { - if( ((Equipment) CurItem).IsVariableSize() ) { - mnuSetVariable.setVisible( true ); - } else { - mnuSetVariable.setVisible( false ); - } + mnuSetVariable.setVisible(((Equipment) CurItem).IsVariableSize()); } else { mnuSetVariable.setVisible( false ); } - if( CurItem.CoreComponent() || CurItem.LocationLinked() ) { - mnuRemoveItem.setEnabled( false ); - } else { - mnuRemoveItem.setEnabled( true ); - } + mnuRemoveItem.setEnabled(!CurItem.CoreComponent() && !CurItem.LocationLinked()); } private void RemoveItemCritTab() { @@ -809,7 +690,7 @@ private void RemoveItemCritTab() { CurVee.GetLoadout().Remove( CurItem ); // refresh the selected equipment listbox - if( CurVee.GetLoadout().GetNonCore().toArray().length <= 0 ) { + if(CurVee.GetLoadout().GetNonCore().toArray().length == 0) { Equipment[SELECTED] = new Object[] { " " }; } else { Equipment[SELECTED] = CurVee.GetLoadout().GetNonCore().toArray(); @@ -856,14 +737,12 @@ public boolean LegalTurretMount( abPlaceable p ) { public boolean LegalLotChange( abPlaceable p ) { if( ! ( p instanceof Ammunition ) ) { return false; } - if( CurVee.UsingFractionalAccounting() ) { return true; } - return false; + return CurVee.UsingFractionalAccounting(); } public boolean LegalDumper( abPlaceable p ) { if ( ! ( p instanceof Equipment ) ) { return false; } - if ( ( (Equipment)p).CritName().equals("Cargo Container") ) { return true; } - return false; + return p.CritName().equals("Cargo Container"); } public void RefreshInfoPane() { @@ -876,13 +755,46 @@ public void RefreshInfoPane() { txtInfoTonnage.setForeground( Color.BLACK ); txtInfoFreeTons.setForeground( Color.BLACK ); } - + if ( CurVee.GetAvailableSlots() < 0 ) { txtInfoFreeCrits.setForeground(Color.red); } else { txtInfoFreeCrits.setForeground(Color.black); } + if( CurVee.isHasTurret1() ) { + txtTurretInfo.setVisible( true ); + Turret turret = CurVee.GetLoadout().GetTurret(); + if( turret.isTonnageSet() ) { + if( turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + txtTurretInfo.setForeground( Color.red ); + } else { + txtTurretInfo.setForeground( Color.black ); + } + } + } else { + txtTurretInfo.setVisible( false ); + } + if( CurVee.isHasTurret2() ) { + txtRearTurretInfo.setVisible( true ); + Turret turret = CurVee.GetLoadout().GetRearTurret(); + if( turret.isTonnageSet() ) { + if( turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + txtRearTurretInfo.setForeground( Color.red ); + } else { + txtRearTurretInfo.setForeground( Color.black ); + } + } + } else { + txtRearTurretInfo.setVisible( false ); + } + + // fill in the movement summary + String temp = "Max C/F: "; + temp += CurVee.GetAdjustedCruiseMP( false, true ) + "/"; + temp += CurVee.GetAdjustedFlankMP( false, true ); + lblMoveSummary.setText( temp ); + // fill in the info if( CurVee.UsingFractionalAccounting() ) { txtInfoTonnage.setText( "Tons: " + CommonTools.RoundFractionalTons( CurVee.GetCurrentTons() ) ); @@ -893,7 +805,7 @@ public void RefreshInfoPane() { } txtInfoBattleValue.setText( "BV: " + String.format( "%1$,d", CurVee.GetCurrentBV() ) ); txtInfoCost.setText( "Cost: " + String.format( "%1$,.0f", Math.floor( CurVee.GetTotalCost() + 0.5f ) ) ); - + javax.swing.table.AbstractTableModel m = (javax.swing.table.AbstractTableModel) tblWeaponManufacturers.getModel(); m.fireTableDataChanged(); } @@ -926,7 +838,7 @@ private void FluffCut( Component c ) { } java.awt.datatransfer.StringSelection export = new java.awt.datatransfer.StringSelection( cut ); java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents( export, (ClipboardOwner) this); + clipboard.setContents( export, this); } private void FluffCopy( Component c ) { @@ -953,7 +865,7 @@ private void FluffCopy( Component c ) { } java.awt.datatransfer.StringSelection export = new java.awt.datatransfer.StringSelection( copy ); java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents( export, (ClipboardOwner) this); + clipboard.setContents( export, this); } private void FluffPaste( Component c ) { @@ -961,7 +873,7 @@ private void FluffPaste( Component c ) { char space = 20; char linereturn = 13; java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); - String txtimport = null; + String txtimport; try { txtimport = (String) clipboard.getData( DataFlavor.stringFlavor ); txtimport.replace(linereturn, space); @@ -970,7 +882,6 @@ private void FluffPaste( Component c ) { e.printStackTrace(); return; } - if( txtimport == null ) { return; } if( c instanceof JEditorPane ) { JEditorPane j = (JEditorPane) c; int insert = j.getCaretPosition(); @@ -990,15 +901,15 @@ private void ResetAmmo() { ArrayList v = CurVee.GetLoadout().GetNonCore(), wep = new ArrayList(); Object a; - for( int i = 0; i < v.size(); i++ ) { - a = v.get( i ); - if( a instanceof ifWeapon ) { - if( ((ifWeapon) a).HasAmmo() ) { - wep.add( a ); + for (Object o : v) { + a = o; + if (a instanceof ifWeapon) { + if (((ifWeapon) a).HasAmmo()) { + wep.add(a); } - } else if( a instanceof Equipment ) { - if( ((Equipment) a).HasAmmo() ) { - wep.add( a ); + } else if (a instanceof Equipment) { + if (((Equipment) a).HasAmmo()) { + wep.add(a); } } } @@ -1030,312 +941,218 @@ private void ResetAmmo() { * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; + GridBagConstraints gridBagConstraints; - pnlInfoPane = new javax.swing.JPanel(); + tblQuirks = new JTable(); + JPanel pnlInfoPane = new JPanel(); txtInfoTonnage = new javax.swing.JTextField(); txtInfoFreeTons = new javax.swing.JTextField(); txtInfoFreeCrits = new javax.swing.JTextField(); txtTurretInfo = new javax.swing.JTextField(); + txtRearTurretInfo = new javax.swing.JTextField(); txtInfoBattleValue = new javax.swing.JTextField(); txtInfoCost = new javax.swing.JTextField(); tlbIconBar = new javax.swing.JToolBar(); - btnNewVee = new javax.swing.JButton(); - btnOpen = new javax.swing.JButton(); - btnSave = new javax.swing.JButton(); - jSeparator1 = new javax.swing.JToolBar.Separator(); - btnPrint = new javax.swing.JButton(); - jSeparator2 = new javax.swing.JToolBar.Separator(); - btnExportClipboardIcon = new javax.swing.JButton(); - btnExportHTMLIcon = new javax.swing.JButton(); - btnExportTextIcon = new javax.swing.JButton(); - btnExportMTFIcon = new javax.swing.JButton(); - btnChatInfo = new javax.swing.JButton(); - jSeparator3 = new javax.swing.JToolBar.Separator(); - jSeparator25 = new javax.swing.JToolBar.Separator(); - btnAddToForceList = new javax.swing.JButton(); - btnForceList = new javax.swing.JButton(); - jSeparator4 = new javax.swing.JToolBar.Separator(); - btnOptions = new javax.swing.JButton(); - jSeparator21 = new javax.swing.JToolBar.Separator(); - lblSelectVariant = new javax.swing.JLabel(); + JLabel lblSelectVariant = new JLabel("Selected Variant: "); cmbOmniVariant = new javax.swing.JComboBox(); tbpMainTabPane = new javax.swing.JTabbedPane(); pnlBasicSetup = new javax.swing.JPanel(); - jPanel5 = new javax.swing.JPanel(); - jLabel1 = new javax.swing.JLabel(); + JPanel pnlBasicInfo = new JPanel(); + JLabel jLabel1 = new JLabel("Vehicle Name:"); txtVehicleName = new javax.swing.JTextField(); - jLabel4 = new javax.swing.JLabel(); + JLabel jLabel4 = new JLabel("Model:"); txtModel = new javax.swing.JTextField(); - jLabel2 = new javax.swing.JLabel(); + JLabel jLabel2 = new JLabel("Rules Level:"); cmbRulesLevel = new javax.swing.JComboBox(); - jLabel5 = new javax.swing.JLabel(); + JLabel jLabel5 = new JLabel("Era:"); cmbEra = new javax.swing.JComboBox(); - jLabel3 = new javax.swing.JLabel(); + JLabel jLabel3 = new JLabel("Tech Base:"); cmbTechBase = new javax.swing.JComboBox(); - lblEraYears = new javax.swing.JLabel(); - chkYearRestrict = new javax.swing.JCheckBox(); - jLabel81 = new javax.swing.JLabel(); + lblEraYears = new javax.swing.JLabel("2443~2800"); + chkYearRestrict = new javax.swing.JCheckBox("Restrict Availability by Year"); + JLabel jLabel81 = new JLabel("Source:"); txtSource = new javax.swing.JTextField(); - lblProdYear = new javax.swing.JLabel(); + JLabel lblProdYear = new JLabel("Prod Year/Era:"); txtProdYear = new javax.swing.JTextField(); cmbProductionEra = new javax.swing.JComboBox(); - pnlChassis = new javax.swing.JPanel(); + JPanel pnlChassis = new JPanel(); cmbMotiveType = new javax.swing.JComboBox(); - jLabel7 = new javax.swing.JLabel(); - jLabel8 = new javax.swing.JLabel(); - chkOmniVee = new javax.swing.JCheckBox(); - chkTrailer = new javax.swing.JCheckBox(); + JLabel jLabel7 = new JLabel("Motive Type:"); + JLabel jLabel8 = new JLabel("Tonnage:"); + chkOmniVee = new javax.swing.JCheckBox("OmniVehicle"); + chkTrailer = new javax.swing.JCheckBox("Trailer"); spnTonnage = new javax.swing.JSpinner(); - jLabel9 = new javax.swing.JLabel(); + JLabel jLabel9 = new JLabel("Engine:"); cmbEngineType = new javax.swing.JComboBox(); - jLabel32 = new javax.swing.JLabel(); + JLabel jLabel32 = new JLabel("Turret:"); cmbTurret = new javax.swing.JComboBox(); - lblVeeClass = new javax.swing.JLabel(); - lblVeeLimits = new javax.swing.JLabel(); - jLabel91 = new javax.swing.JLabel(); + lblVeeClass = new javax.swing.JLabel("Assault Vee"); + lblVeeLimits = new javax.swing.JLabel("500t Max"); + JLabel jLabel91 = new JLabel("Heat Sinks:"); spnHeatSinks = new javax.swing.JSpinner(); spnTurretTonnage = new javax.swing.JSpinner(); - pnlMovement = new javax.swing.JPanel(); - jLabel10 = new javax.swing.JLabel(); + spnRearTurretTonnage = new javax.swing.JSpinner(); + JPanel pnlMovement = new JPanel(); + JLabel jLabel10 = new JLabel("Cruise MP:"); spnCruiseMP = new javax.swing.JSpinner(); - jLabel11 = new javax.swing.JLabel(); - lblFlankMP = new javax.swing.JLabel(); - jLabel13 = new javax.swing.JLabel(); + JLabel jLabel11 = new JLabel("Flank MP:"); + lblFlankMP = new javax.swing.JLabel("2"); + lblMoveSummary = new javax.swing.JLabel("Max C/F: 12/20"); + JLabel jLabel13 = new JLabel("Jump MP:"); spnJumpMP = new javax.swing.JSpinner(); - pnlChassisMods = new javax.swing.JPanel(); - chkFlotationHull = new javax.swing.JCheckBox(); - chkLimitedAmph = new javax.swing.JCheckBox(); - chkFullAmph = new javax.swing.JCheckBox(); - chkDuneBuggy = new javax.swing.JCheckBox(); - chkEnviroSealing = new javax.swing.JCheckBox(); - pnlExperimental = new javax.swing.JPanel(); - chkArmoredMotive = new javax.swing.JCheckBox(); - chkCommandConsole = new javax.swing.JCheckBox(); - chkEscapePod = new javax.swing.JCheckBox(); - chkMinesweeper = new javax.swing.JCheckBox(); - chkJetBooster = new javax.swing.JCheckBox(); - chkSupercharger = new javax.swing.JCheckBox(); - chkSponsonTurret = new javax.swing.JCheckBox(); - jPanel11 = new javax.swing.JPanel(); - chkFractional = new javax.swing.JCheckBox(); - pnlSummary = new javax.swing.JPanel(); - jLabel12 = new javax.swing.JLabel(); - jLabel14 = new javax.swing.JLabel(); - jLabel15 = new javax.swing.JLabel(); - jLabel16 = new javax.swing.JLabel(); - jLabel17 = new javax.swing.JLabel(); - txtSumIntTons = new javax.swing.JTextField(); - txtSumIntAV = new javax.swing.JTextField(); - jLabel18 = new javax.swing.JLabel(); - txtSumEngTons = new javax.swing.JTextField(); - txtSumEngAV = new javax.swing.JTextField(); - jLabel19 = new javax.swing.JLabel(); - txtSumLifTons = new javax.swing.JTextField(); - txtSumLifAV = new javax.swing.JTextField(); - txtSumEngSpace = new javax.swing.JTextField(); - jLabel20 = new javax.swing.JLabel(); - txtSumConTons = new javax.swing.JTextField(); - txtSumConAV = new javax.swing.JTextField(); - jLabel21 = new javax.swing.JLabel(); - txtSumJJTons = new javax.swing.JTextField(); - txtSumJJSpace = new javax.swing.JTextField(); - txtSumJJAV = new javax.swing.JTextField(); - jLabel22 = new javax.swing.JLabel(); - txtSumHSTons = new javax.swing.JTextField(); - txtSumHSAV = new javax.swing.JTextField(); - jLabel23 = new javax.swing.JLabel(); - txtSumArmTons = new javax.swing.JTextField(); - txtSumArmSpace = new javax.swing.JTextField(); - txtSumArmAV = new javax.swing.JTextField(); - jLabel24 = new javax.swing.JLabel(); - txtSumTurTons = new javax.swing.JTextField(); - txtSumTurAV = new javax.swing.JTextField(); - jLabel25 = new javax.swing.JLabel(); - txtSumRTuTons = new javax.swing.JTextField(); - txtSumRTuAV = new javax.swing.JTextField(); - jLabel26 = new javax.swing.JLabel(); - txtSumSpnTons = new javax.swing.JTextField(); - txtSumSpnAV = new javax.swing.JTextField(); - jLabel27 = new javax.swing.JLabel(); - txtSumPATons = new javax.swing.JTextField(); - txtSumPAAV = new javax.swing.JTextField(); - pnlInformation = new javax.swing.JPanel(); - jLabel29 = new javax.swing.JLabel(); - lblSupensionFacter = new javax.swing.JLabel(); - jLabel31 = new javax.swing.JLabel(); - lblMinEngineTons = new javax.swing.JLabel(); - jLabel33 = new javax.swing.JLabel(); - lblBaseEngineRating = new javax.swing.JLabel(); - jLabel35 = new javax.swing.JLabel(); - lblFinalEngineRating = new javax.swing.JLabel(); - jLabel28 = new javax.swing.JLabel(); - lblFreeHeatSinks = new javax.swing.JLabel(); - jLabel30 = new javax.swing.JLabel(); - lblNumCrew = new javax.swing.JLabel(); - pnlOmniInfo = new javax.swing.JPanel(); - btnLockChassis = new javax.swing.JButton(); - btnAddVariant = new javax.swing.JButton(); - btnDeleteVariant = new javax.swing.JButton(); - btnRenameVariant = new javax.swing.JButton(); - jPanel6 = new javax.swing.JPanel(); - pnlRightArmor = new javax.swing.JPanel(); - lblRightIntPts = new javax.swing.JLabel(); - jLabel40 = new javax.swing.JLabel(); - jLabel46 = new javax.swing.JLabel(); + JPanel pnlChassisMods = new JPanel(); + chkFlotationHull = new javax.swing.JCheckBox("Flotation Hull"); + chkLimitedAmph = new javax.swing.JCheckBox("Limited Amphibious"); + chkFullAmph = new javax.swing.JCheckBox("Fully Amphibious"); + chkDuneBuggy = new javax.swing.JCheckBox("Dune Buggy"); + chkEnviroSealing = new javax.swing.JCheckBox("Enviro (Vacuum) Sealing"); + JPanel pnlExperimental = new JPanel(); + chkArmoredMotive = new javax.swing.JCheckBox("Armored Motive System"); + chkCommandConsole = new javax.swing.JCheckBox("Command Console"); + chkEscapePod = new javax.swing.JCheckBox("Combat Vehicle Escape Pod"); + chkMinesweeper = new javax.swing.JCheckBox("Minesweeper"); + chkJetBooster = new javax.swing.JCheckBox("VTOL Jet Booster"); + chkSupercharger = new javax.swing.JCheckBox("Supercharger"); + chkSponsonTurret = new javax.swing.JCheckBox("Sponson Turret"); + JPanel jPanel11 = new JPanel(); + chkFractional = new javax.swing.JCheckBox("Use Fractional Accounting"); + JPanel pnlSummary = new JPanel(); + txtSumIntTons = Utils.summaryField("000.00");; + txtSumIntAV = Utils.summaryField("X/X-X-X"); + txtSumEngTons = Utils.summaryField("000.00"); + txtSumEngAV = Utils.summaryField("X/X-X-X"); + txtSumLifTons = Utils.summaryField("000.00"); + txtSumLifAV = Utils.summaryField("X/X-X-X"); + txtSumEngSpace = Utils.summaryField("00"); + txtSumConTons = Utils.summaryField("000.00"); + txtSumConAV = Utils.summaryField("X/X-X-X"); + txtSumJJTons = Utils.summaryField("000.00"); + JTextField txtSumJJSpace = Utils.summaryField("00"); + txtSumJJAV = Utils.summaryField("X/X-X-X"); + txtSumHSTons = Utils.summaryField("000.00"); + txtSumHSAV = Utils.summaryField("X/X-X-X"); + txtSumArmTons = Utils.summaryField("000.00"); + txtSumArmSpace = Utils.summaryField("00"); + txtSumArmAV = Utils.summaryField("X/X-X-X"); + txtSumTurTons = Utils.summaryField("000.00"); + txtSumTurAV = Utils.summaryField("X/X-X-X"); + txtSumRTuTons = Utils.summaryField("000.00"); + txtSumRTuAV = Utils.summaryField("X/X-X-X"); + txtSumSpnTons = Utils.summaryField("000.00"); + txtSumSpnAV = Utils.summaryField("X/X-X-X"); + txtSumPATons = Utils.summaryField("000.00"); + txtSumPAAV = Utils.summaryField("X/X-X-X"); + JPanel pnlInformation = new JPanel(); + JLabel titleSuspension = new JLabel("Suspension Factor:"); + lblSupensionFacter = new javax.swing.JLabel("000"); + JLabel titleMinEngTon = new JLabel("Minimum Engine Tonnage:"); + lblMinEngineTons = new javax.swing.JLabel("10"); + JLabel titleBaseEngRate = new JLabel("Base Engine Rating:"); + lblBaseEngineRating = new javax.swing.JLabel("000"); + JLabel titleFinalEngRate = new JLabel("Final Engine Rating:"); + lblFinalEngineRating = new javax.swing.JLabel("000"); + JLabel titleFreeHeatSinks = new JLabel("Free Heat Sinks:"); + lblFreeHeatSinks = new javax.swing.JLabel("000"); + JLabel titleCrew = new JLabel("Crew:"); + lblNumCrew = new javax.swing.JLabel("00"); + JPanel pnlOmniInfo = new JPanel(); + btnLockChassis = new javax.swing.JButton("Lock Chassis"); + btnAddVariant = new javax.swing.JButton("Add Variant"); + btnDeleteVariant = new javax.swing.JButton("Delete Variant"); + btnRenameVariant = new javax.swing.JButton("Rename Variant"); + JPanel pnlArmorLocations = new JPanel(); + JPanel pnlRightArmor = new JPanel(); + lblRightIntPts = new javax.swing.JLabel("00"); spnRightArmor = new javax.swing.JSpinner(); - pnlFrontArmor = new javax.swing.JPanel(); - lblFrontIntPts = new javax.swing.JLabel(); - jLabel45 = new javax.swing.JLabel(); - jLabel47 = new javax.swing.JLabel(); + JPanel pnlFrontArmor = new JPanel(); + lblFrontIntPts = new javax.swing.JLabel("00"); spnFrontArmor = new javax.swing.JSpinner(); - pnlLeftArmor = new javax.swing.JPanel(); - lblLeftIntPts = new javax.swing.JLabel(); - jLabel41 = new javax.swing.JLabel(); - jLabel48 = new javax.swing.JLabel(); + JPanel pnlLeftArmor = new JPanel(); + lblLeftIntPts = new javax.swing.JLabel("00"); spnLeftArmor = new javax.swing.JSpinner(); - pnlRearArmor = new javax.swing.JPanel(); - lblRearIntPts = new javax.swing.JLabel(); - jLabel44 = new javax.swing.JLabel(); - jLabel49 = new javax.swing.JLabel(); + JPanel pnlRearArmor = new JPanel(); + lblRearIntPts = new javax.swing.JLabel("00"); spnRearArmor = new javax.swing.JSpinner(); pnlTurretArmor = new javax.swing.JPanel(); - lblTurretIntPts = new javax.swing.JLabel(); - jLabel42 = new javax.swing.JLabel(); - jLabel50 = new javax.swing.JLabel(); + lblTurretIntPts = new javax.swing.JLabel("00"); spnTurretArmor = new javax.swing.JSpinner(); pnlRearTurretArmor = new javax.swing.JPanel(); - lblRearTurretIntPts = new javax.swing.JLabel(); - jLabel43 = new javax.swing.JLabel(); - jLabel51 = new javax.swing.JLabel(); + lblRearTurretIntPts = new javax.swing.JLabel("00"); spnRearTurretArmor = new javax.swing.JSpinner(); pnlRotorArmor = new javax.swing.JPanel(); - lblRotorIntPts = new javax.swing.JLabel(); - jLabel92 = new javax.swing.JLabel(); - jLabel93 = new javax.swing.JLabel(); + lblRotorIntPts = new javax.swing.JLabel("00"); spnRotorArmor = new javax.swing.JSpinner(); - jPanel7 = new javax.swing.JPanel(); - jLabel52 = new javax.swing.JLabel(); + JPanel pnlArmorType = new JPanel(); + JLabel jLabel52 = new JLabel("Armor Type:"); cmbArmorType = new javax.swing.JComboBox(); - chkBalanceLRArmor = new javax.swing.JCheckBox(); - chkBalanceFRArmor = new javax.swing.JCheckBox(); - btnSetArmorTons = new javax.swing.JButton(); - btnUseRemaining = new javax.swing.JButton(); - btnMaximize = new javax.swing.JButton(); - jPanel8 = new javax.swing.JPanel(); - jLabel34 = new javax.swing.JLabel(); - jLabel36 = new javax.swing.JLabel(); - lblArmorTotals = new javax.swing.JLabel(); - lblArmorCoverage = new javax.swing.JLabel(); - txtArmorTons = new javax.swing.JTextField(); - txtArmorSpace = new javax.swing.JTextField(); - lblArmorTonsWasted = new javax.swing.JLabel(); - lblArmorLeftInLot = new javax.swing.JLabel(); - pnlEquipment = new javax.swing.JPanel(); + chkBalanceLRArmor = new javax.swing.JCheckBox("Balance Left/Right Armor"); + chkBalanceFRArmor = new javax.swing.JCheckBox("Balance Front/Rear Armor"); + btnSetArmorTons = new javax.swing.JButton("Set Armor Tonnage"); + btnUseRemaining = new javax.swing.JButton("Use Remaining Tonnage"); + btnMaximize = new javax.swing.JButton("Maximize Armor"); + JPanel jPanel8 = new JPanel(); + JLabel jLabel34 = new JLabel("Tons"); + JLabel jLabel36 = new JLabel("Space"); + lblArmorTotals = new javax.swing.JLabel("999 of 999 Armor Points"); + lblArmorCoverage = new javax.swing.JLabel("100.00% Coverage"); + txtArmorTons = new javax.swing.JTextField("000.00"); + txtArmorSpace = new javax.swing.JTextField("00"); + lblArmorTonsWasted = new javax.swing.JLabel("0.00 Tons Wasted"); + lblArmorLeftInLot = new javax.swing.JLabel("99 Points Left In This 1/2 Ton Lot"); + pnlEquipment = new JPanel(); pnlEquipInfo = new javax.swing.JPanel(); - jLabel38 = new javax.swing.JLabel(); - jLabel39 = new javax.swing.JLabel(); - jLabel53 = new javax.swing.JLabel(); lblInfoAVSL = new javax.swing.JLabel(); lblInfoAVSW = new javax.swing.JLabel(); lblInfoAVCI = new javax.swing.JLabel(); - jLabel54 = new javax.swing.JLabel(); - jLabel55 = new javax.swing.JLabel(); - jLabel56 = new javax.swing.JLabel(); lblInfoIntro = new javax.swing.JLabel(); lblInfoExtinct = new javax.swing.JLabel(); lblInfoReintro = new javax.swing.JLabel(); - jLabel57 = new javax.swing.JLabel(); - jLabel58 = new javax.swing.JLabel(); - jLabel59 = new javax.swing.JLabel(); - jLabel60 = new javax.swing.JLabel(); - jLabel61 = new javax.swing.JLabel(); - lblInfoName = new javax.swing.JLabel(); + JLabel lblInfoName = new JLabel(); lblInfoType = new javax.swing.JLabel(); lblInfoHeat = new javax.swing.JLabel(); lblInfoDamage = new javax.swing.JLabel(); lblInfoRange = new javax.swing.JLabel(); - jSeparator17 = new javax.swing.JSeparator(); - jLabel62 = new javax.swing.JLabel(); - jLabel63 = new javax.swing.JLabel(); - jLabel64 = new javax.swing.JLabel(); - jLabel65 = new javax.swing.JLabel(); lblInfoAmmo = new javax.swing.JLabel(); lblInfoTonnage = new javax.swing.JLabel(); lblInfoCrits = new javax.swing.JLabel(); lblInfoSpecials = new javax.swing.JLabel(); - jSeparator20 = new javax.swing.JSeparator(); - jLabel66 = new javax.swing.JLabel(); lblInfoCost = new javax.swing.JLabel(); - jLabel67 = new javax.swing.JLabel(); lblInfoBV = new javax.swing.JLabel(); - jLabel68 = new javax.swing.JLabel(); + lblMMNameInfo = new javax.swing.JLabel(); lblInfoMountRestrict = new javax.swing.JLabel(); - jLabel69 = new javax.swing.JLabel(); lblInfoRulesLevel = new javax.swing.JLabel(); - jLabel6 = new javax.swing.JLabel(); lblInfoAVDA = new javax.swing.JLabel(); - pnlSpecials = new javax.swing.JPanel(); - jLabel37 = new javax.swing.JLabel(); - chkUseTC = new javax.swing.JCheckBox(); - chkFCSAIV = new javax.swing.JCheckBox(); - chkFCSAV = new javax.swing.JCheckBox(); - chkFCSApollo = new javax.swing.JCheckBox(); - chkClanCASE = new javax.swing.JCheckBox(); - pnlControls = new javax.swing.JPanel(); - btnRemoveEquip = new javax.swing.JButton(); - btnClearEquip = new javax.swing.JButton(); - btnAddEquip = new javax.swing.JButton(); - cmbNumEquips = new javax.swing.JComboBox(); - jScrollPane1 = new javax.swing.JScrollPane(); + JPanel pnlSpecials = new JPanel(); + chkUseTC = new javax.swing.JCheckBox("Targeting Computer"); + chkFCSAIV = new javax.swing.JCheckBox("Use Artemis IV"); + chkFCSAV = new javax.swing.JCheckBox("Use Artemis V"); + chkFCSApollo = new javax.swing.JCheckBox("Use MRM Apollo"); + chkCASE = new javax.swing.JCheckBox("Use CASE"); + JPanel pnlControls = new JPanel(); + JButton btnRemoveEquip = new JButton("<<"); + JButton btnClearEquip = new JButton("Clear"); + JButton btnAddEquip = new JButton(">>"); + cmbNumEquips = new javax.swing.JComboBox(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }); + JScrollPane scrLocations = new JScrollPane(); cmbLocation = new javax.swing.JList(); - pnlSelected = new javax.swing.JPanel(); - jScrollPane23 = new javax.swing.JScrollPane(); + JPanel pnlSelected = new JPanel(); + JScrollPane scrSelectedEquip = new JScrollPane(); lstSelectedEquipment = new javax.swing.JList(); tbpWeaponChooser = new javax.swing.JTabbedPane(); - pnlBallistic = new javax.swing.JPanel(); - jSeparator5 = new javax.swing.JSeparator(); - jScrollPane8 = new javax.swing.JScrollPane(); lstChooseBallistic = new javax.swing.JList(); - jSeparator6 = new javax.swing.JSeparator(); - pnlEnergy = new javax.swing.JPanel(); - jSeparator7 = new javax.swing.JSeparator(); - jScrollPane9 = new javax.swing.JScrollPane(); lstChooseEnergy = new javax.swing.JList(); - jSeparator8 = new javax.swing.JSeparator(); - pnlMissile = new javax.swing.JPanel(); - jSeparator9 = new javax.swing.JSeparator(); - jScrollPane19 = new javax.swing.JScrollPane(); lstChooseMissile = new javax.swing.JList(); - jSeparator10 = new javax.swing.JSeparator(); - pnlPhysical = new javax.swing.JPanel(); - jSeparator11 = new javax.swing.JSeparator(); - jScrollPane20 = new javax.swing.JScrollPane(); lstChoosePhysical = new javax.swing.JList(); - jSeparator12 = new javax.swing.JSeparator(); - pnlEquipmentChooser = new javax.swing.JPanel(); - jSeparator13 = new javax.swing.JSeparator(); - jScrollPane21 = new javax.swing.JScrollPane(); lstChooseEquipment = new javax.swing.JList(); - jSeparator14 = new javax.swing.JSeparator(); - pnlArtillery = new javax.swing.JPanel(); - jSeparator18 = new javax.swing.JSeparator(); - jScrollPane24 = new javax.swing.JScrollPane(); lstChooseArtillery = new javax.swing.JList(); - jSeparator19 = new javax.swing.JSeparator(); - pnlAmmunition = new javax.swing.JPanel(); - jSeparator15 = new javax.swing.JSeparator(); - jScrollPane22 = new javax.swing.JScrollPane(); lstChooseAmmunition = new javax.swing.JList(); - jSeparator16 = new javax.swing.JSeparator(); - pnlFluff = new javax.swing.JPanel(); - pnlExport = new javax.swing.JPanel(); - btnExportTXT = new javax.swing.JButton(); - btnExportHTML = new javax.swing.JButton(); - btnExportMTF = new javax.swing.JButton(); - tbpFluffEditors = new javax.swing.JTabbedPane(); + JPanel pnlFluff = new JPanel(); + JPanel pnlExport = new JPanel(); + JButton btnExportTXT = new JButton("to TXT"); + JButton btnExportHTML = new JButton("to HTML"); + JButton btnExportMTF = new JButton("to MegaMek"); + JTabbedPane tbpFluffEditors = new JTabbedPane(); pnlOverview = new javax.swing.JPanel(); pnlCapabilities = new javax.swing.JPanel(); pnlHistory = new javax.swing.JPanel(); @@ -1343,506 +1160,311 @@ private void initComponents() { pnlVariants = new javax.swing.JPanel(); pnlNotables = new javax.swing.JPanel(); pnlAdditionalFluff = new javax.swing.JPanel(); - pnlManufacturers = new javax.swing.JPanel(); - jLabel82 = new javax.swing.JLabel(); - jLabel83 = new javax.swing.JLabel(); - jLabel84 = new javax.swing.JLabel(); - jLabel85 = new javax.swing.JLabel(); - jLabel86 = new javax.swing.JLabel(); - jLabel87 = new javax.swing.JLabel(); - jLabel88 = new javax.swing.JLabel(); - jLabel89 = new javax.swing.JLabel(); + JPanel pnlManufacturers = new JPanel(); + JLabel lblManuInfo = new JLabel(); + txtLog = new javax.swing.JTextArea(); txtManufacturer = new javax.swing.JTextField(); txtEngineManufacturer = new javax.swing.JTextField(); txtArmorModel = new javax.swing.JTextField(); txtChassisModel = new javax.swing.JTextField(); txtCommSystem = new javax.swing.JTextField(); txtTNTSystem = new javax.swing.JTextField(); - pnlWeaponsManufacturers = new javax.swing.JPanel(); + JPanel pnlWeaponsManufacturers = new JPanel(); chkIndividualWeapons = new javax.swing.JCheckBox(); - scpWeaponManufacturers = new javax.swing.JScrollPane(); + JScrollPane scpWeaponManufacturers = new JScrollPane(); tblWeaponManufacturers = new javax.swing.JTable(); txtManufacturerLocation = new javax.swing.JTextField(); - jLabel90 = new javax.swing.JLabel(); txtJJModel = new javax.swing.JTextField(); - pnlQuirks = new javax.swing.JPanel(); - lblBattleMechQuirks = new javax.swing.JLabel(); - scpQuirkTable = new javax.swing.JScrollPane(); - tblQuirks = new javax.swing.JTable(); - btnAddQuirk = new javax.swing.JButton(); - pnlBFStats = new javax.swing.JPanel(); - jLabel70 = new javax.swing.JLabel(); - jLabel71 = new javax.swing.JLabel(); - jLabel72 = new javax.swing.JLabel(); - jLabel73 = new javax.swing.JLabel(); - jLabel74 = new javax.swing.JLabel(); - jLabel75 = new javax.swing.JLabel(); - jLabel76 = new javax.swing.JLabel(); - jLabel77 = new javax.swing.JLabel(); - jLabel78 = new javax.swing.JLabel(); - jLabel79 = new javax.swing.JLabel(); - lblBFMV = new javax.swing.JLabel(); - lblBFWt = new javax.swing.JLabel(); - lblBFOV = new javax.swing.JLabel(); - lblBFExtreme = new javax.swing.JLabel(); - lblBFShort = new javax.swing.JLabel(); - lblBFMedium = new javax.swing.JLabel(); - lblBFLong = new javax.swing.JLabel(); - lblBFArmor = new javax.swing.JLabel(); - lblBFStructure = new javax.swing.JLabel(); - lblBFSA = new javax.swing.JLabel(); - jLabel80 = new javax.swing.JLabel(); - lblBFPoints = new javax.swing.JLabel(); - jPanel10 = new javax.swing.JPanel(); - jScrollPane14 = new javax.swing.JScrollPane(); + JPanel pnlQuirks = new JPanel(); + JLabel lblBattleMechQuirks = new JLabel("Quirks"); + JScrollPane scpQuirkTable = new JScrollPane(); + JButton btnAddQuirk = new JButton("Manage Quirks"); + JPanel pnlBFStats = new JPanel(); + JLabel jLabel70 = new JLabel("MV"); + JLabel jLabel71 = new JLabel("S (+0)"); + JLabel jLabel72 = new JLabel("M (+2)"); + JLabel jLabel73 = new JLabel("L (+4)"); + JLabel jLabel74 = new JLabel("E (+6)"); + JLabel jLabel75 = new JLabel("Wt."); + JLabel jLabel76 = new JLabel("OV"); + JLabel jLabel77 = new JLabel("Armor:"); + JLabel jLabel78 = new JLabel("Structure:"); + JLabel jLabel79 = new JLabel("Special Abilities:"); + lblBFMV = new javax.swing.JLabel("0"); + lblBFWt = new javax.swing.JLabel("1"); + lblBFOV = new javax.swing.JLabel("0"); + lblBFExtreme = new javax.swing.JLabel("0"); + lblBFShort = new javax.swing.JLabel("0"); + lblBFMedium = new javax.swing.JLabel("0"); + lblBFLong = new javax.swing.JLabel("0"); + lblBFArmor = new javax.swing.JLabel("0"); + lblBFStructure = new javax.swing.JLabel("0"); + lblBFSA = new javax.swing.JLabel("Placeholder"); + JLabel jLabel80 = new JLabel("Points:"); + lblBFPoints = new javax.swing.JLabel("0"); + JPanel pnlConversionSteps = new JPanel(); + JScrollPane scpBFConversion = new JScrollPane(); jTextAreaBFConversion = new javax.swing.JTextArea(); - pnlImage = new javax.swing.JPanel(); + JPanel pnlImage = new JPanel(); lblFluffImage = new javax.swing.JLabel(); - jPanel1 = new javax.swing.JPanel(); - btnLoadImage = new javax.swing.JButton(); - btnClearImage = new javax.swing.JButton(); - jMenuBar1 = new javax.swing.JMenuBar(); - mnuFile = new javax.swing.JMenu(); - mnuNewMech = new javax.swing.JMenuItem(); - mnuLoad = new javax.swing.JMenuItem(); - mnuOpen = new javax.swing.JMenuItem(); - mnuImport = new javax.swing.JMenu(); - mnuImportHMP = new javax.swing.JMenuItem(); - mnuBatchHMP = new javax.swing.JMenuItem(); - jSeparator22 = new javax.swing.JSeparator(); - mnuSave = new javax.swing.JMenuItem(); - mnuSaveAs = new javax.swing.JMenuItem(); - mnuExport = new javax.swing.JMenu(); - mnuExportHTML = new javax.swing.JMenuItem(); - mnuExportMTF = new javax.swing.JMenuItem(); - mnuExportTXT = new javax.swing.JMenuItem(); - mnuExportClipboard = new javax.swing.JMenuItem(); - mnuCreateTCGMech = new javax.swing.JMenuItem(); - jSeparator23 = new javax.swing.JSeparator(); - mnuPrint = new javax.swing.JMenu(); - mnuPrintPreview = new javax.swing.JMenuItem(); - jSeparator24 = new javax.swing.JSeparator(); - mnuExit = new javax.swing.JMenuItem(); - mnuClearFluff = new javax.swing.JMenu(); - mnuSummary = new javax.swing.JMenuItem(); - mnuCostBVBreakdown = new javax.swing.JMenuItem(); - mnuTextTRO = new javax.swing.JMenuItem(); - jSeparator26 = new javax.swing.JSeparator(); - mnuBFB = new javax.swing.JMenuItem(); - jSeparator27 = new javax.swing.JSeparator(); - mnuOptions = new javax.swing.JMenuItem(); - mnuViewToolbar = new javax.swing.JCheckBoxMenuItem(); - mnuClearUserData = new javax.swing.JMenuItem(); - jSeparator30 = new javax.swing.JSeparator(); - mnuUnlock = new javax.swing.JMenuItem(); - jMenuItem1 = new javax.swing.JMenuItem(); - mnuReloadEquipment = new javax.swing.JMenuItem(); - mnuHelp = new javax.swing.JMenu(); - mnuCredits = new javax.swing.JMenuItem(); - mnuAboutSSW = new javax.swing.JMenuItem(); + JPanel pnlImageButtons = new JPanel(); + JButton btnLoadImage = new JButton("Load Image"); + JButton btnClearImage = new JButton("Clear Image"); + JMenuBar jMenuBar1 = new JMenuBar(); + JMenu mnuFile = new JMenu("File"); + JMenu mnuImport = new JMenu("Import..."); + JMenuItem mnuSaveAs = new JMenuItem("Save As..."); + JMenu mnuExport = new JMenu("Export As..."); + JMenu mnuClearFluff = new JMenu("Tools"); + mnuViewToolbar = new javax.swing.JCheckBoxMenuItem("View Toolbar"); + mnuUnlock = new javax.swing.JMenuItem("Unlock Chassis"); + JMenu mnuHelp = new JMenu("Help"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setMaximumSize(new java.awt.Dimension(1280, 600)); - setMinimumSize(new java.awt.Dimension(1280, 600)); - setResizable(false); + setMaximumSize(new Dimension(1600, 900)); + setMinimumSize(new Dimension(1280, 650)); + setResizable(true); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { formWindowClosed(evt); } }); + //region Status Bar txtInfoTonnage.setEditable(false); txtInfoTonnage.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoTonnage.setText("Tonnage: 000.00"); - txtInfoTonnage.setMaximumSize(new java.awt.Dimension(110, 20)); - txtInfoTonnage.setMinimumSize(new java.awt.Dimension(110, 20)); - txtInfoTonnage.setPreferredSize(new java.awt.Dimension(110, 20)); + txtInfoTonnage.setMaximumSize(new Dimension(110, 20)); + txtInfoTonnage.setMinimumSize(new Dimension(110, 20)); + txtInfoTonnage.setPreferredSize(new Dimension(110, 20)); pnlInfoPane.add(txtInfoTonnage); txtInfoFreeTons.setEditable(false); txtInfoFreeTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoFreeTons.setText("Free Tons: 000.00"); - txtInfoFreeTons.setMaximumSize(new java.awt.Dimension(115, 20)); - txtInfoFreeTons.setMinimumSize(new java.awt.Dimension(115, 20)); - txtInfoFreeTons.setPreferredSize(new java.awt.Dimension(115, 20)); + txtInfoFreeTons.setMaximumSize(new Dimension(115, 20)); + txtInfoFreeTons.setMinimumSize(new Dimension(115, 20)); + txtInfoFreeTons.setPreferredSize(new Dimension(115, 20)); pnlInfoPane.add(txtInfoFreeTons); txtInfoFreeCrits.setEditable(false); txtInfoFreeCrits.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoFreeCrits.setText("Space: 00"); - txtInfoFreeCrits.setMaximumSize(new java.awt.Dimension(65, 20)); - txtInfoFreeCrits.setMinimumSize(new java.awt.Dimension(65, 20)); - txtInfoFreeCrits.setPreferredSize(new java.awt.Dimension(65, 20)); + txtInfoFreeCrits.setMaximumSize(new Dimension(65, 20)); + txtInfoFreeCrits.setMinimumSize(new Dimension(65, 20)); + txtInfoFreeCrits.setPreferredSize(new Dimension(65, 20)); pnlInfoPane.add(txtInfoFreeCrits); txtTurretInfo.setEditable(false); txtTurretInfo.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtTurretInfo.setText("Turret: 000.00"); - txtTurretInfo.setMaximumSize(new java.awt.Dimension(120, 20)); - txtTurretInfo.setMinimumSize(new java.awt.Dimension(120, 20)); - txtTurretInfo.setPreferredSize(new java.awt.Dimension(100, 20)); + txtTurretInfo.setText("Turret: 00.0/00.0"); + txtTurretInfo.setMaximumSize(new Dimension(100, 20)); + txtTurretInfo.setMinimumSize(new Dimension(100, 20)); + txtTurretInfo.setPreferredSize(new Dimension(100, 20)); pnlInfoPane.add(txtTurretInfo); + txtRearTurretInfo.setEditable(false); + txtRearTurretInfo.setHorizontalAlignment(javax.swing.JTextField.CENTER); + txtRearTurretInfo.setText("Rear Turret: 00.0/00.0"); + txtRearTurretInfo.setMaximumSize(new Dimension(120, 20)); + txtRearTurretInfo.setMinimumSize(new Dimension(120, 20)); + txtRearTurretInfo.setPreferredSize(new Dimension(120, 20)); + pnlInfoPane.add(txtRearTurretInfo); + txtInfoBattleValue.setEditable(false); txtInfoBattleValue.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoBattleValue.setText("BV: 00,000"); - txtInfoBattleValue.setMaximumSize(new java.awt.Dimension(75, 20)); - txtInfoBattleValue.setMinimumSize(new java.awt.Dimension(75, 20)); - txtInfoBattleValue.setPreferredSize(new java.awt.Dimension(75, 20)); + txtInfoBattleValue.setMaximumSize(new Dimension(75, 20)); + txtInfoBattleValue.setMinimumSize(new Dimension(75, 20)); + txtInfoBattleValue.setPreferredSize(new Dimension(75, 20)); pnlInfoPane.add(txtInfoBattleValue); txtInfoCost.setEditable(false); txtInfoCost.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtInfoCost.setText("Cost: 000,000,000,000.00"); - txtInfoCost.setMaximumSize(new java.awt.Dimension(165, 20)); - txtInfoCost.setMinimumSize(new java.awt.Dimension(165, 20)); - txtInfoCost.setPreferredSize(new java.awt.Dimension(165, 20)); + txtInfoCost.setText("Cost: 000,000,000"); + txtInfoCost.setMaximumSize(new Dimension(120, 20)); + txtInfoCost.setMinimumSize(new Dimension(120, 20)); + txtInfoCost.setPreferredSize(new Dimension(120, 20)); pnlInfoPane.add(txtInfoCost); + //endregion + //region Icon Bar tlbIconBar.setFloatable(false); tlbIconBar.setRollover(true); - - btnNewVee.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document--plus.png"))); // NOI18N - btnNewVee.setFocusable(false); - btnNewVee.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnNewVee.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnNewVee.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnNewVeeActionPerformed(evt); - } - }); - tlbIconBar.add(btnNewVee); - - btnOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/folder-open-document.png"))); // NOI18N - btnOpen.setFocusable(false); - btnOpen.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnOpen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnOpen.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOpenActionPerformed(evt); - } - }); - tlbIconBar.add(btnOpen); - - btnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/disk-black.png"))); // NOI18N - btnSave.setFocusable(false); - btnSave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnSave.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnSaveActionPerformed(evt); - } - }); - tlbIconBar.add(btnSave); - tlbIconBar.add(jSeparator1); - - btnPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/printer.png"))); // NOI18N - btnPrint.setFocusable(false); - btnPrint.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnPrint.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnPrint.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnPrintActionPerformed(evt); - } - }); - tlbIconBar.add(btnPrint); - tlbIconBar.add(jSeparator2); - - btnExportClipboardIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-clipboard.png"))); // NOI18N - btnExportClipboardIcon.setToolTipText("Export Text to Clipboard"); - btnExportClipboardIcon.setFocusable(false); - btnExportClipboardIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportClipboardIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportClipboardIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportClipboardIconActionPerformed(evt); - } - }); - tlbIconBar.add(btnExportClipboardIcon); - - btnExportHTMLIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-image.png"))); // NOI18N - btnExportHTMLIcon.setToolTipText("Export HTML"); - btnExportHTMLIcon.setFocusable(false); - btnExportHTMLIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportHTMLIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportHTMLIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportHTMLIconActionPerformed(evt); - } - }); - tlbIconBar.add(btnExportHTMLIcon); - - btnExportTextIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-text.png"))); // NOI18N - btnExportTextIcon.setToolTipText("Export Text"); - btnExportTextIcon.setFocusable(false); - btnExportTextIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportTextIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportTextIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportTextIconActionPerformed(evt); - } - }); - tlbIconBar.add(btnExportTextIcon); - - btnExportMTFIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/document--arrow.png"))); // NOI18N - btnExportMTFIcon.setToolTipText("Export MTF"); - btnExportMTFIcon.setFocusable(false); - btnExportMTFIcon.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnExportMTFIcon.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnExportMTFIcon.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportMTFIconActionPerformed(evt); - } - }); - tlbIconBar.add(btnExportMTFIcon); - - btnChatInfo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/balloon.png"))); // NOI18N - btnChatInfo.setToolTipText("Copy Chat Line"); - btnChatInfo.setFocusable(false); - btnChatInfo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnChatInfo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnChatInfo.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnChatInfoActionPerformed(evt); - } - }); - tlbIconBar.add(btnChatInfo); - tlbIconBar.add(jSeparator3); - tlbIconBar.add(jSeparator25); - - btnAddToForceList.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/clipboard--plus.png"))); // NOI18N - btnAddToForceList.setToolTipText("Add to Force List"); - btnAddToForceList.setFocusable(false); - btnAddToForceList.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnAddToForceList.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnAddToForceList.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddToForceListActionPerformed(evt); - } - }); - tlbIconBar.add(btnAddToForceList); - - btnForceList.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/clipboard.png"))); // NOI18N - btnForceList.setToolTipText("Force List"); - btnForceList.setFocusable(false); - btnForceList.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnForceList.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnForceList.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnForceListActionPerformed(evt); - } - }); - tlbIconBar.add(btnForceList); - tlbIconBar.add(jSeparator4); - - btnOptions.setIcon(new javax.swing.ImageIcon(getClass().getResource("/saw/images/gear.png"))); // NOI18N - btnOptions.setFocusable(false); - btnOptions.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnOptions.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnOptions.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnOptionsActionPerformed(evt); - } - }); - tlbIconBar.add(btnOptions); - tlbIconBar.add(jSeparator21); - - lblSelectVariant.setText("Selected Variant: "); + tlbIconBar.add(Utils.imageButton("New Unit", this::btnNewVeeActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/document--plus.png")))); + tlbIconBar.add(Utils.imageButton("Open Unit", this::btnOpenActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/folder-open-document.png")))); + tlbIconBar.add(Utils.imageButton("Save Unit", this::btnSaveActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/disk-black.png")))); + tlbIconBar.add(Utils.vertSeparator()); + tlbIconBar.add(Utils.imageButton("Print", this::btnPrintActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/printer.png")))); + tlbIconBar.add(Utils.vertSeparator()); + tlbIconBar.add(Utils.imageButton("Export Text to Clipboard", this::btnExportClipboardIconActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-clipboard.png")))); + tlbIconBar.add(Utils.imageButton("Export HTML", this::btnExportHTMLIconActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-image.png")))); + tlbIconBar.add(Utils.imageButton("Export Text", this::btnExportTextIconActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/document-text.png")))); + tlbIconBar.add(Utils.imageButton("Export MTF", this::btnExportMTFIconActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/document--arrow.png")))); + tlbIconBar.add(Utils.imageButton("Copy Chat Line", this::btnChatInfoActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/balloon.png")))); + tlbIconBar.add(Utils.vertSeparator()); + tlbIconBar.add(Utils.imageButton("Add to Force List", this::btnAddToForceListActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/clipboard--plus.png")))); + tlbIconBar.add(Utils.imageButton("Force List", this::btnForceListActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/clipboard.png")))); + tlbIconBar.add(Utils.vertSeparator()); + tlbIconBar.add(Utils.imageButton("Preferences", this::btnOptionsActionPerformed, new javax.swing.ImageIcon(getClass().getResource("/saw/images/gear.png")))); + tlbIconBar.add(Utils.vertSeparator()); lblSelectVariant.setEnabled(false); tlbIconBar.add(lblSelectVariant); cmbOmniVariant.setEnabled(false); - cmbOmniVariant.setMaximumSize(new java.awt.Dimension(150, 20)); - cmbOmniVariant.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbOmniVariant.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbOmniVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbOmniVariantActionPerformed(evt); - } - }); + cmbOmniVariant.setMaximumSize(new Dimension(150, 20)); + cmbOmniVariant.setMinimumSize(new Dimension(150, 20)); + cmbOmniVariant.setPreferredSize(new Dimension(150, 20)); + cmbOmniVariant.addActionListener(this::cmbOmniVariantActionPerformed); tlbIconBar.add(cmbOmniVariant); + //endregion - jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Basic Information")); - - jLabel1.setText("Vehicle Name:"); - - txtVehicleName.setMinimumSize(new java.awt.Dimension(150, 20)); - txtVehicleName.setPreferredSize(new java.awt.Dimension(150, 20)); + //region Basic Setup Tab / Basic Information Panel + pnlBasicInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Basic Information")); - jLabel4.setText("Model:"); + txtVehicleName.setMinimumSize(new Dimension(150, 20)); + txtVehicleName.setPreferredSize(new Dimension(150, 20)); - txtModel.setMinimumSize(new java.awt.Dimension(150, 20)); - txtModel.setPreferredSize(new java.awt.Dimension(150, 20)); - - jLabel2.setText("Rules Level:"); + txtModel.setMinimumSize(new Dimension(150, 20)); + txtModel.setPreferredSize(new Dimension(150, 20)); cmbRulesLevel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Introductory", "Tournament Legal", "Advanced", "Experimental" })); cmbRulesLevel.setSelectedIndex(1); - cmbRulesLevel.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbRulesLevel.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbRulesLevel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbRulesLevelActionPerformed(evt); - } - }); - - jLabel5.setText("Era:"); + cmbRulesLevel.setMinimumSize(new Dimension(150, 20)); + cmbRulesLevel.setPreferredSize(new Dimension(150, 20)); + cmbRulesLevel.addActionListener(this::cmbRulesLevelActionPerformed); cmbEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War/Star League", "Succession Wars", "Clan Invasion", "Dark Ages", "All Eras (non-canon)" })); cmbEra.setSelectedIndex(1); - cmbEra.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbEra.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbEra.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbEraActionPerformed(evt); - } - }); - - jLabel3.setText("Tech Base:"); + cmbEra.setMinimumSize(new Dimension(150, 20)); + cmbEra.setPreferredSize(new Dimension(150, 20)); + cmbEra.addActionListener(this::cmbEraActionPerformed); cmbTechBase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Inner Sphere", "Clan", "Mixed Tech" })); - cmbTechBase.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbTechBase.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbTechBase.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbTechBaseActionPerformed(evt); - } - }); - - lblEraYears.setText("2443~2800"); + cmbTechBase.setMinimumSize(new Dimension(150, 20)); + cmbTechBase.setPreferredSize(new Dimension(150, 20)); + cmbTechBase.addActionListener(this::cmbTechBaseActionPerformed); - chkYearRestrict.setText("Restrict Availability by Year"); - chkYearRestrict.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkYearRestrictActionPerformed(evt); - } - }); + chkYearRestrict.addActionListener(this::chkYearRestrictActionPerformed); jLabel81.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel81.setText("Source:"); - txtSource.setMinimumSize(new java.awt.Dimension(150, 20)); - txtSource.setPreferredSize(new java.awt.Dimension(150, 20)); - - lblProdYear.setText("Prod Year/Era:"); + txtSource.setMinimumSize(new Dimension(150, 20)); + txtSource.setPreferredSize(new Dimension(150, 20)); txtProdYear.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtProdYear.setDisabledTextColor(new java.awt.Color(0, 0, 0)); - txtProdYear.setMaximumSize(new java.awt.Dimension(60, 20)); - txtProdYear.setMinimumSize(new java.awt.Dimension(60, 20)); - txtProdYear.setPreferredSize(new java.awt.Dimension(60, 20)); - - cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages" })); - cmbProductionEra.setMaximumSize(new java.awt.Dimension(90, 20)); - cmbProductionEra.setMinimumSize(new java.awt.Dimension(90, 20)); - cmbProductionEra.setPreferredSize(new java.awt.Dimension(90, 20)); - cmbProductionEra.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbProductionEraActionPerformed(evt); - } - }); - - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + txtProdYear.setMaximumSize(new Dimension(60, 20)); + txtProdYear.setMinimumSize(new Dimension(60, 20)); + txtProdYear.setPreferredSize(new Dimension(60, 20)); + + cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages", "ilClan" })); + cmbProductionEra.setMaximumSize(new Dimension(90, 20)); + cmbProductionEra.setMinimumSize(new Dimension(90, 20)); + cmbProductionEra.setPreferredSize(new Dimension(90, 20)); + cmbProductionEra.addActionListener(this::cmbProductionEraActionPerformed); + + GroupLayout pnlBasicInfoLayout = new GroupLayout(pnlBasicInfo); + pnlBasicInfo.setLayout(pnlBasicInfoLayout); + pnlBasicInfoLayout.setHorizontalGroup( + pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addGroup(GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(22, 22, 22) .addComponent(jLabel2) .addGap(2, 2, 2) - .addComponent(cmbRulesLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addComponent(cmbRulesLevel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(60, 60, 60) .addComponent(jLabel5) .addGap(2, 2, 2) - .addComponent(cmbEra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addComponent(cmbEra, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(27, 27, 27) .addComponent(jLabel3) .addGap(2, 2, 2) - .addComponent(cmbTechBase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addComponent(cmbTechBase, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(129, 129, 129) .addComponent(lblEraYears)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup() + .addGroup(GroupLayout.Alignment.LEADING, pnlBasicInfoLayout.createSequentialGroup() .addGap(5, 5, 5) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel81, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(txtVehicleName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jLabel81, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, GroupLayout.Alignment.TRAILING) + .addComponent(jLabel1, GroupLayout.Alignment.TRAILING)) + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtVehicleName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(GroupLayout.Alignment.TRAILING, pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, pnlBasicInfoLayout.createSequentialGroup() .addGap(2, 2, 2) - .addComponent(txtSource, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(txtModel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))) + .addComponent(txtSource, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtModel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))))) .addContainerGap(24, Short.MAX_VALUE)) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addComponent(lblProdYear) .addGap(2, 2, 2) - .addComponent(txtProdYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txtProdYear, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) - .addComponent(cmbProductionEra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(cmbProductionEra, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(chkYearRestrict)) .addContainerGap(23, Short.MAX_VALUE)) ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + pnlBasicInfoLayout.setVerticalGroup( + pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel1)) - .addComponent(txtVehicleName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(txtVehicleName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel4)) - .addComponent(txtModel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(txtModel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, 0) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(txtSource, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(txtSource, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel81))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel2)) - .addComponent(cmbRulesLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(cmbRulesLevel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel5)) - .addComponent(cmbEra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(cmbEra, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel3)) - .addComponent(cmbTechBase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(cmbTechBase, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(2, 2, 2) .addComponent(lblEraYears) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pnlBasicInfoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicInfoLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(lblProdYear)) - .addComponent(txtProdYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(cmbProductionEra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtProdYear, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(cmbProductionEra, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkYearRestrict) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); MouseListener mlProdYear = new MouseAdapter() { @@ -1858,125 +1480,88 @@ public void mousePressed( MouseEvent e ) { } }; txtProdYear.addMouseListener( mlProdYear ); + //endregion + //region Basic Setup Tab / Chassis Panel pnlChassis.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Chassis")); - pnlChassis.setNextFocusableComponent(spnCruiseMP); cmbMotiveType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Hovercraft", "Naval (Displacement)", "Naval (Hydrofoil)", "Naval (Submarine)", "Tracked", "VTOL", "Wheeled", "WiGE", "Hovercraft (Super Heavy)", "Displacement (Super Heavy)" })); - cmbMotiveType.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbMotiveType.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbMotiveType.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbMotiveTypeActionPerformed(evt); - } - }); - - jLabel7.setText("Motive Type:"); + cmbMotiveType.setMinimumSize(new Dimension(150, 20)); + cmbMotiveType.setPreferredSize(new Dimension(150, 20)); + cmbMotiveType.addActionListener(this::cmbMotiveTypeActionPerformed); - jLabel8.setText("Tonnage:"); + chkOmniVee.addActionListener(this::chkOmniVeeActionPerformed); - chkOmniVee.setText("OmniVehicle"); - chkOmniVee.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkOmniVeeActionPerformed(evt); - } - }); - - chkTrailer.setText("Trailer"); chkTrailer.setEnabled(false); - chkTrailer.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkTrailerActionPerformed(evt); - } - }); + chkTrailer.addActionListener(this::chkTrailerActionPerformed); spnTonnage.setModel(new javax.swing.SpinnerNumberModel(10, 1, null, 1)); - spnTonnage.setMinimumSize(new java.awt.Dimension(45, 20)); - spnTonnage.setPreferredSize(new java.awt.Dimension(45, 20)); - spnTonnage.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnTonnageStateChanged(evt); - } - }); + spnTonnage.setMinimumSize(new Dimension(45, 20)); + spnTonnage.setPreferredSize(new Dimension(45, 20)); + spnTonnage.addChangeListener(this::spnTonnageStateChanged); spnTonnage.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { spnTonnageFocusGained(evt); } }); spnTonnage.addInputMethodListener(new java.awt.event.InputMethodListener() { + public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { + } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnTonnageInputMethodTextChanged(evt); } - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } }); - jLabel9.setText("Engine:"); - cmbEngineType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "I.C.E.", "Fusion", "Light Fusion", "XL Fusion", "Compact Fusion" })); - cmbEngineType.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbEngineType.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbEngineType.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbEngineTypeActionPerformed(evt); - } - }); - - jLabel32.setText("Turret:"); + cmbEngineType.setMinimumSize(new Dimension(150, 20)); + cmbEngineType.setPreferredSize(new Dimension(150, 20)); + cmbEngineType.addActionListener(this::cmbEngineTypeActionPerformed); cmbTurret.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No Turret", "Single Turret", "Dual Turret", "Sponson Turrets", "Chin Turret", "Mast Turret" })); - cmbTurret.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbTurretActionPerformed(evt); - } - }); + cmbTurret.addActionListener(this::cmbTurretActionPerformed); lblVeeClass.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); - lblVeeClass.setText("Assault Vee"); - - lblVeeLimits.setText("500t Max"); - - jLabel91.setText("Heat Sinks:"); spnHeatSinks.setModel(new javax.swing.SpinnerNumberModel(10, 1, null, 1)); - spnHeatSinks.setMinimumSize(new java.awt.Dimension(45, 20)); - spnHeatSinks.setNextFocusableComponent(spnCruiseMP); - spnHeatSinks.setPreferredSize(new java.awt.Dimension(45, 20)); - spnHeatSinks.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnHeatSinksStateChanged(evt); - } - }); + spnHeatSinks.setMinimumSize(new Dimension(45, 20)); + spnHeatSinks.setPreferredSize(new Dimension(45, 20)); + spnHeatSinks.addChangeListener(this::spnHeatSinksStateChanged); spnHeatSinks.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { spnHeatSinksFocusGained(evt); } }); spnHeatSinks.addInputMethodListener(new java.awt.event.InputMethodListener() { + public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { + } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnHeatSinksInputMethodTextChanged(evt); } - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } }); spnTurretTonnage.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 50.0d, 0.5d)); spnTurretTonnage.setEnabled(false); - spnTurretTonnage.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnTurretTonnageStateChanged(evt); - } - }); + spnTurretTonnage.setMinimumSize(new java.awt.Dimension(45, 20)); + spnTurretTonnage.setPreferredSize(new java.awt.Dimension(45, 20)); + spnTurretTonnage.addChangeListener(this::spnTurretTonnageStateChanged); + + spnRearTurretTonnage.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 50.0d, 0.5d)); + spnRearTurretTonnage.setEnabled(false); + spnRearTurretTonnage.setMinimumSize(new java.awt.Dimension(45, 20)); + spnRearTurretTonnage.setPreferredSize(new java.awt.Dimension(45, 20)); + spnRearTurretTonnage.addChangeListener(this::spnRearTurretTonnageStateChanged); - javax.swing.GroupLayout pnlChassisLayout = new javax.swing.GroupLayout(pnlChassis); + JLabel lblTurretTonnage = new JLabel("Turret Tonnage: "); + + GroupLayout pnlChassisLayout = new GroupLayout(pnlChassis); pnlChassis.setLayout(pnlChassisLayout); pnlChassisLayout.setHorizontalGroup( - pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addGroup(pnlChassisLayout.createSequentialGroup() .addComponent(jLabel7) .addGap(2, 2, 2) - .addComponent(cmbMotiveType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(cmbMotiveType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(pnlChassisLayout.createSequentialGroup() .addGap(65, 65, 65) .addComponent(chkOmniVee)) @@ -1985,260 +1570,189 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) { .addComponent(chkTrailer)) .addGroup(pnlChassisLayout.createSequentialGroup() .addGap(27, 27, 27) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addGroup(pnlChassisLayout.createSequentialGroup() .addComponent(jLabel32) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cmbTurret, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(spnTurretTonnage)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cmbTurret, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)) + .addGroup(pnlChassisLayout.createSequentialGroup() + .addComponent(lblTurretTonnage) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spnTurretTonnage) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spnRearTurretTonnage)) .addGroup(pnlChassisLayout.createSequentialGroup() .addComponent(jLabel9) .addGap(2, 2, 2) - .addComponent(cmbEngineType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addComponent(cmbEngineType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))) .addGroup(pnlChassisLayout.createSequentialGroup() .addGap(17, 17, 17) .addComponent(jLabel8) .addGap(2, 2, 2) - .addComponent(spnTonnage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spnTonnage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblVeeClass) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblVeeLimits))) .addGroup(pnlChassisLayout.createSequentialGroup() .addContainerGap() .addComponent(jLabel91) .addGap(2, 2, 2) - .addComponent(spnHeatSinks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(spnHeatSinks, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) ); pnlChassisLayout.setVerticalGroup( - pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlChassisLayout.createSequentialGroup() - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlChassisLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel7)) - .addComponent(cmbMotiveType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(cmbMotiveType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(2, 2, 2) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(spnTonnage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(spnTonnage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(pnlChassisLayout.createSequentialGroup() .addGap(3, 3, 3) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jLabel8) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lblVeeClass) .addComponent(lblVeeLimits))))) .addComponent(chkOmniVee) .addGap(0, 0, 0) .addComponent(chkTrailer) .addGap(2, 2, 2) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlChassisLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel9)) - .addComponent(cmbEngineType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(cmbEngineType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel32) - .addComponent(cmbTurret, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(spnTurretTonnage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlChassisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cmbTurret, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(lblTurretTonnage) + .addComponent(spnTurretTonnage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(spnRearTurretTonnage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(pnlChassisLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlChassisLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel91)) - .addComponent(spnHeatSinks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(spnHeatSinks, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + //endregion + //region Basic Setup Tab / Movement Panel pnlMovement.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Movement")); - pnlMovement.setNextFocusableComponent(pnlChassisMods); - - jLabel10.setText("Cruise MP:"); - spnCruiseMP.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1)); - spnCruiseMP.setMinimumSize(new java.awt.Dimension(45, 20)); - spnCruiseMP.setPreferredSize(new java.awt.Dimension(45, 20)); - spnCruiseMP.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnCruiseMPStateChanged(evt); - } - }); + spnCruiseMP.setPreferredSize(new Dimension(45, 20)); + spnCruiseMP.addChangeListener(this::spnCruiseMPStateChanged); spnCruiseMP.addInputMethodListener(new java.awt.event.InputMethodListener() { + public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { + } public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnCruiseMPInputMethodTextChanged(evt); } - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } }); - jLabel11.setText("Flank MP:"); - - lblFlankMP.setText("2"); - - jLabel13.setText("Jump MP:"); - spnJumpMP.setEnabled(false); - spnJumpMP.setMinimumSize(new java.awt.Dimension(45, 20)); - spnJumpMP.setNextFocusableComponent(chkFlotationHull); - spnJumpMP.setPreferredSize(new java.awt.Dimension(45, 20)); + spnJumpMP.setPreferredSize(new Dimension(45, 20)); - javax.swing.GroupLayout pnlMovementLayout = new javax.swing.GroupLayout(pnlMovement); + GroupLayout pnlMovementLayout = new GroupLayout(pnlMovement); pnlMovement.setLayout(pnlMovementLayout); pnlMovementLayout.setHorizontalGroup( - pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlMovementLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlMovementLayout.createSequentialGroup() - .addGap(29, 29, 29) - .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(29) + .addGroup(pnlMovementLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlMovementLayout.createSequentialGroup() .addComponent(jLabel10) - .addGap(2, 2, 2) - .addComponent(spnCruiseMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(5) + .addComponent(spnCruiseMP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(pnlMovementLayout.createSequentialGroup() - .addGap(5, 5, 5) - .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addComponent(jLabel11) - .addGap(18, 18, 18) - .addComponent(lblFlankMP)) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addComponent(jLabel13) - .addGap(2, 2, 2) - .addComponent(spnJumpMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))) - .addContainerGap(129, Short.MAX_VALUE)) + .addComponent(jLabel11) + .addGap(18) + .addComponent(lblFlankMP) + .addGap(20) + .addComponent(lblMoveSummary)) + .addGroup(pnlMovementLayout.createSequentialGroup() + .addComponent(jLabel13) + .addGap(10) + .addComponent(spnJumpMP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))) ); pnlMovementLayout.setVerticalGroup( - pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlMovementLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlMovementLayout.createSequentialGroup() - .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addGap(3, 3, 3) - .addComponent(jLabel10)) - .addComponent(spnCruiseMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(2, 2, 2) - .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(pnlMovementLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jLabel10) + .addComponent(spnCruiseMP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGap(5) + .addGroup(pnlMovementLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel11) - .addComponent(lblFlankMP)) - .addGap(2, 2, 2) - .addGroup(pnlMovementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlMovementLayout.createSequentialGroup() - .addGap(3, 3, 3) - .addComponent(jLabel13)) - .addComponent(spnJumpMP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(lblFlankMP) + .addComponent(lblMoveSummary)) + .addGap(8) + .addGroup(pnlMovementLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(jLabel13) + .addComponent(spnJumpMP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + //endregion + //region Basic Setup Tab / Chassis Modifications Panel pnlChassisMods.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Chassis Modifications")); pnlChassisMods.setLayout(new java.awt.GridBagLayout()); - chkFlotationHull.setText("Flotation Hull"); chkFlotationHull.setEnabled(false); - chkFlotationHull.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFlotationHullActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlChassisMods.add(chkFlotationHull, gridBagConstraints); - - chkLimitedAmph.setText("Limited Amphibious"); + chkFlotationHull.addActionListener(this::chkFlotationHullActionPerformed); chkLimitedAmph.setEnabled(false); - chkLimitedAmph.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkLimitedAmphActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlChassisMods.add(chkLimitedAmph, gridBagConstraints); - - chkFullAmph.setText("Fully Amphibious"); + chkLimitedAmph.addActionListener(this::chkLimitedAmphActionPerformed); chkFullAmph.setEnabled(false); - chkFullAmph.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFullAmphActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlChassisMods.add(chkFullAmph, gridBagConstraints); - - chkDuneBuggy.setText("Dune Buggy"); + chkFullAmph.addActionListener(this::chkFullAmphActionPerformed); chkDuneBuggy.setEnabled(false); - chkDuneBuggy.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkDuneBuggyActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlChassisMods.add(chkDuneBuggy, gridBagConstraints); - - chkEnviroSealing.setText("Enviro (Vacuum) Sealing"); + chkDuneBuggy.addActionListener(this::chkDuneBuggyActionPerformed); chkEnviroSealing.setEnabled(false); - chkEnviroSealing.setNextFocusableComponent(chkArmoredMotive); - chkEnviroSealing.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkEnviroSealingActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlChassisMods.add(chkEnviroSealing, gridBagConstraints); + chkEnviroSealing.addActionListener(this::chkEnviroSealingActionPerformed); + pnlChassisMods.add(chkFlotationHull, Utils.gridBag(0, 0)); + pnlChassisMods.add(chkLimitedAmph, Utils.gridBag(0, 1)); + pnlChassisMods.add(chkFullAmph, Utils.gridBag(0, 2)); + pnlChassisMods.add(chkDuneBuggy, Utils.gridBag(0, 3)); + pnlChassisMods.add(chkEnviroSealing, Utils.gridBag(0, 4)); + //endregion + + //region Basic Setup Tab / Experimental Equipment Panel pnlExperimental.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Experimental Equipment")); - chkArmoredMotive.setText("Armored Motive System"); chkArmoredMotive.setEnabled(false); - - chkCommandConsole.setText("Command Console"); - chkCommandConsole.setEnabled(false); + chkArmoredMotive.addActionListener(this::chkArmoredMotiveActionPerformed); chkEscapePod.setText("Combat Vehicle Escape Pod"); chkEscapePod.setEnabled(false); - chkEscapePod.setNextFocusableComponent(chkFractional); + + chkCommandConsole.setText("Command Console"); + chkCommandConsole.setEnabled(false); chkMinesweeper.setText("Minesweeper"); chkMinesweeper.setEnabled(false); - - chkJetBooster.setText("VTOL Jet Booster"); chkJetBooster.setEnabled(false); - - chkSupercharger.setText("Supercharger"); + chkJetBooster.addActionListener(this::chkJetBoosterActionPerformed); chkSupercharger.setEnabled(false); - chkSupercharger.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkSuperchargerActionPerformed(evt); - } - }); - - chkSponsonTurret.setText("Sponson Turret"); + chkSupercharger.addActionListener(this::chkSuperchargerActionPerformed); chkSponsonTurret.setEnabled(false); - chkSponsonTurret.setNextFocusableComponent(chkFractional); - chkSponsonTurret.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkSponsonTurretActionPerformed(evt); - } - }); + chkSponsonTurret.addActionListener(this::chkSponsonTurretActionPerformed); - javax.swing.GroupLayout pnlExperimentalLayout = new javax.swing.GroupLayout(pnlExperimental); + GroupLayout pnlExperimentalLayout = new GroupLayout(pnlExperimental); pnlExperimental.setLayout(pnlExperimentalLayout); pnlExperimentalLayout.setHorizontalGroup( - pnlExperimentalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlExperimentalLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlExperimentalLayout.createSequentialGroup() - .addGroup(pnlExperimentalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlExperimentalLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(chkArmoredMotive) .addComponent(chkSupercharger) .addComponent(chkJetBooster) @@ -2246,954 +1760,267 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(chkCommandConsole) .addComponent(chkEscapePod) .addComponent(chkSponsonTurret)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pnlExperimentalLayout.setVerticalGroup( - pnlExperimentalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlExperimentalLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlExperimentalLayout.createSequentialGroup() .addComponent(chkArmoredMotive) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkSupercharger) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkCommandConsole) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkMinesweeper) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(chkJetBooster) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkEscapePod) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkSponsonTurret) .addContainerGap()) ); + //endregion + //region Basic Setup Tab / Construction Options Panel jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Construction Options")); jPanel11.setLayout(new java.awt.GridBagLayout()); - chkFractional.setText("Use Fractional Accounting"); chkFractional.setEnabled(false); - chkFractional.setNextFocusableComponent(txtVehicleName); - chkFractional.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFractionalActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - jPanel11.add(chkFractional, gridBagConstraints); + chkFractional.addActionListener(this::chkFractionalActionPerformed); + jPanel11.add(chkFractional, Utils.gridBag(0, 0)); + //endregion + //region Basic Setup Tab / Summary Panel pnlSummary.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Summary")); pnlSummary.setLayout(new java.awt.GridBagLayout()); - jLabel12.setText("Item"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel12, gridBagConstraints); - - jLabel14.setText("Tonnage"); - pnlSummary.add(jLabel14, new java.awt.GridBagConstraints()); - - jLabel15.setText("Space"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); - pnlSummary.add(jLabel15, gridBagConstraints); - - jLabel16.setText("Availability"); - pnlSummary.add(jLabel16, new java.awt.GridBagConstraints()); - - jLabel17.setText("Internal Structure:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel17, gridBagConstraints); - - txtSumIntTons.setEditable(false); - txtSumIntTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumIntTons.setText("000.00"); - txtSumIntTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumIntTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumIntTons, gridBagConstraints); - - txtSumIntAV.setEditable(false); - txtSumIntAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumIntAV.setText("X/X-X-X"); - txtSumIntAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumIntAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumIntAV, gridBagConstraints); - - jLabel18.setText("Engine:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel18, gridBagConstraints); - - txtSumEngTons.setEditable(false); - txtSumEngTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumEngTons.setText("000.00"); - txtSumEngTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumEngTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumEngTons, gridBagConstraints); - - txtSumEngAV.setEditable(false); - txtSumEngAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumEngAV.setText("X/X-X-X"); - txtSumEngAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumEngAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumEngAV, gridBagConstraints); - - jLabel19.setText("Lift/Dive/Rotor:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel19, gridBagConstraints); - - txtSumLifTons.setEditable(false); - txtSumLifTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumLifTons.setText("000.00"); - txtSumLifTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumLifTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumLifTons, gridBagConstraints); - - txtSumLifAV.setEditable(false); - txtSumLifAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumLifAV.setText("X/X-X-X"); - txtSumLifAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumLifAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumLifAV, gridBagConstraints); - - txtSumEngSpace.setEditable(false); - txtSumEngSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumEngSpace.setText("00"); - txtSumEngSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtSumEngSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 2; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); - pnlSummary.add(txtSumEngSpace, gridBagConstraints); - - jLabel20.setText("Controls:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel20, gridBagConstraints); - - txtSumConTons.setEditable(false); - txtSumConTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumConTons.setText("000.00"); - txtSumConTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumConTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumConTons, gridBagConstraints); - - txtSumConAV.setEditable(false); - txtSumConAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumConAV.setText("X/X-X-X"); - txtSumConAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumConAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumConAV, gridBagConstraints); - - jLabel21.setText("Jump Jets:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel21, gridBagConstraints); - - txtSumJJTons.setEditable(false); - txtSumJJTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumJJTons.setText("000.00"); - txtSumJJTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumJJTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumJJTons, gridBagConstraints); - - txtSumJJSpace.setEditable(false); - txtSumJJSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumJJSpace.setText("00"); - txtSumJJSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtSumJJSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 5; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); - pnlSummary.add(txtSumJJSpace, gridBagConstraints); - - txtSumJJAV.setEditable(false); - txtSumJJAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumJJAV.setText("X/X-X-X"); - txtSumJJAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumJJAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumJJAV, gridBagConstraints); - - jLabel22.setText("Heat Sinks:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel22, gridBagConstraints); - - txtSumHSTons.setEditable(false); - txtSumHSTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumHSTons.setText("000.00"); - txtSumHSTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumHSTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumHSTons, gridBagConstraints); - - txtSumHSAV.setEditable(false); - txtSumHSAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumHSAV.setText("X/X-X-X"); - txtSumHSAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumHSAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumHSAV, gridBagConstraints); - - jLabel23.setText("Armor:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel23, gridBagConstraints); - - txtSumArmTons.setEditable(false); - txtSumArmTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumArmTons.setText("000.00"); - txtSumArmTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumArmTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumArmTons, gridBagConstraints); - - txtSumArmSpace.setEditable(false); - txtSumArmSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumArmSpace.setText("00"); - txtSumArmSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtSumArmSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 7; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2); - pnlSummary.add(txtSumArmSpace, gridBagConstraints); - - txtSumArmAV.setEditable(false); - txtSumArmAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumArmAV.setText("X/X-X-X"); - txtSumArmAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumArmAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumArmAV, gridBagConstraints); - - jLabel24.setText("Turret:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 8; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel24, gridBagConstraints); - - txtSumTurTons.setEditable(false); - txtSumTurTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumTurTons.setText("000.00"); - txtSumTurTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumTurTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 8; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumTurTons, gridBagConstraints); - - txtSumTurAV.setEditable(false); - txtSumTurAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumTurAV.setText("X/X-X-X"); - txtSumTurAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumTurAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 8; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumTurAV, gridBagConstraints); - - jLabel25.setText("Rear Turret:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 9; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel25, gridBagConstraints); - - txtSumRTuTons.setEditable(false); - txtSumRTuTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumRTuTons.setText("000.00"); - txtSumRTuTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumRTuTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 9; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumRTuTons, gridBagConstraints); - - txtSumRTuAV.setEditable(false); - txtSumRTuAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumRTuAV.setText("X/X-X-X"); - txtSumRTuAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumRTuAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 9; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumRTuAV, gridBagConstraints); - - jLabel26.setText("Sponsons:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 10; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel26, gridBagConstraints); - - txtSumSpnTons.setEditable(false); - txtSumSpnTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumSpnTons.setText("000.00"); - txtSumSpnTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumSpnTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 10; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumSpnTons, gridBagConstraints); - - txtSumSpnAV.setEditable(false); - txtSumSpnAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumSpnAV.setText("X/X-X-X"); - txtSumSpnAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumSpnAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 10; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumSpnAV, gridBagConstraints); - - jLabel27.setText("Power Amplifiers:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 11; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2); - pnlSummary.add(jLabel27, gridBagConstraints); - - txtSumPATons.setEditable(false); - txtSumPATons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumPATons.setText("000.00"); - txtSumPATons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtSumPATons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 11; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - pnlSummary.add(txtSumPATons, gridBagConstraints); - - txtSumPAAV.setEditable(false); - txtSumPAAV.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtSumPAAV.setText("X/X-X-X"); - txtSumPAAV.setMinimumSize(new java.awt.Dimension(65, 20)); - txtSumPAAV.setPreferredSize(new java.awt.Dimension(65, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 11; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - pnlSummary.add(txtSumPAAV, gridBagConstraints); - + pnlSummary.add(Utils.alignedLabel("Item", SwingConstants.CENTER), Utils.gridBag(0, 0)); + pnlSummary.add(Utils.alignedLabel("Tonnage", SwingConstants.CENTER), Utils.gridBag(1, 0)); + pnlSummary.add(Utils.alignedLabel("Space", SwingConstants.CENTER), Utils.gridBag(2, 0)); + pnlSummary.add(Utils.alignedLabel("Availability", SwingConstants.CENTER), Utils.gridBag(3, 0)); + pnlSummary.add(Utils.alignedLabel("Internal Structure:", SwingConstants.RIGHT), Utils.gridBag(0, 1)); + pnlSummary.add(txtSumIntTons, Utils.gridBag(1, 1)); + pnlSummary.add(txtSumIntAV, Utils.gridBag(3, 1)); + pnlSummary.add(Utils.alignedLabel("Engine:", SwingConstants.RIGHT), Utils.gridBag(0, 2)); + pnlSummary.add(txtSumEngTons, Utils.gridBag(1, 2)); + pnlSummary.add(txtSumEngAV, Utils.gridBag(3, 2)); + pnlSummary.add(Utils.alignedLabel("Lift/Dive/Rotor:", SwingConstants.RIGHT), Utils.gridBag(0, 3)); + pnlSummary.add(txtSumLifTons, Utils.gridBag(1, 3)); + pnlSummary.add(txtSumLifAV, Utils.gridBag(3, 3)); + pnlSummary.add(txtSumEngSpace, Utils.gridBag(2, 2, new Insets(0, 2, 0, 2))); + pnlSummary.add(Utils.alignedLabel("Controls:", SwingConstants.RIGHT), Utils.gridBag(0, 4)); + pnlSummary.add(txtSumConTons, Utils.gridBag(1, 4)); + pnlSummary.add(txtSumConAV, Utils.gridBag(3, 4)); + pnlSummary.add(Utils.alignedLabel("Jump Jets:", SwingConstants.RIGHT), Utils.gridBag(0, 5)); + pnlSummary.add(txtSumJJTons, Utils.gridBag(1, 5)); + pnlSummary.add(txtSumJJSpace, Utils.gridBag(2, 5, new Insets(0, 2, 0, 2))); + pnlSummary.add(txtSumJJAV, Utils.gridBag(3, 5)); + pnlSummary.add(Utils.alignedLabel("Heat Sinks:", SwingConstants.RIGHT), Utils.gridBag(0, 6)); + pnlSummary.add(txtSumHSTons, Utils.gridBag(1, 6)); + pnlSummary.add(txtSumHSAV, Utils.gridBag(3, 6)); + pnlSummary.add(Utils.alignedLabel("Armor:", SwingConstants.RIGHT), Utils.gridBag(0, 7)); + pnlSummary.add(txtSumArmTons, Utils.gridBag(1, 7)); + pnlSummary.add(txtSumArmSpace, Utils.gridBag(2, 7, new Insets(0, 2, 0, 2))); + pnlSummary.add(txtSumArmAV, Utils.gridBag(3, 7)); + pnlSummary.add(Utils.alignedLabel("Turret:", SwingConstants.RIGHT), Utils.gridBag(0, 8)); + pnlSummary.add(txtSumTurTons, Utils.gridBag(1, 8)); + pnlSummary.add(txtSumTurAV, Utils.gridBag(3, 8)); + pnlSummary.add(Utils.alignedLabel("Rear Turret:", SwingConstants.RIGHT), Utils.gridBag(0, 9)); + pnlSummary.add(txtSumRTuTons, Utils.gridBag(1, 9)); + pnlSummary.add(txtSumRTuAV, Utils.gridBag(3, 9)); + pnlSummary.add(Utils.alignedLabel("Sponsons:", SwingConstants.RIGHT), Utils.gridBag(0, 10)); + pnlSummary.add(txtSumSpnTons, Utils.gridBag(1, 10)); + pnlSummary.add(txtSumSpnAV, Utils.gridBag(3, 10)); + pnlSummary.add(Utils.alignedLabel("Power Amplifiers:", SwingConstants.RIGHT), Utils.gridBag(0, 11)); + pnlSummary.add(txtSumPATons, Utils.gridBag(1, 11)); + pnlSummary.add(txtSumPAAV, Utils.gridBag(3, 11)); + //endregion + + //region Basic Setup Tab / Information Panel pnlInformation.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Information")); - jLabel29.setText("Suspension Factor:"); - - lblSupensionFacter.setText("000"); - - jLabel31.setText("Minimum Engine Tonnage:"); - - lblMinEngineTons.setText("10"); - - jLabel33.setText("Base Engine Rating:"); - - lblBaseEngineRating.setText("000"); - - jLabel35.setText("Final Engine Rating:"); - - lblFinalEngineRating.setText("000"); - - jLabel28.setText("Free Heat Sinks:"); - - lblFreeHeatSinks.setText("000"); - - jLabel30.setText("Crew:"); - - lblNumCrew.setText("00"); - - javax.swing.GroupLayout pnlInformationLayout = new javax.swing.GroupLayout(pnlInformation); + GroupLayout pnlInformationLayout = new GroupLayout(pnlInformation); pnlInformation.setLayout(pnlInformationLayout); pnlInformationLayout.setHorizontalGroup( - pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlInformationLayout.createSequentialGroup() .addContainerGap() - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlInformationLayout.createSequentialGroup() .addGap(95, 95, 95) - .addComponent(jLabel30) + .addComponent(titleCrew) .addGap(4, 4, 4) .addComponent(lblNumCrew)) .addGroup(pnlInformationLayout.createSequentialGroup() .addGap(32, 32, 32) - .addComponent(jLabel29) + .addComponent(titleSuspension) .addGap(4, 4, 4) .addComponent(lblSupensionFacter)) .addGroup(pnlInformationLayout.createSequentialGroup() - .addComponent(jLabel31) + .addComponent(titleMinEngTon) .addGap(4, 4, 4) .addComponent(lblMinEngineTons)) .addGroup(pnlInformationLayout.createSequentialGroup() .addGap(28, 28, 28) - .addComponent(jLabel33) + .addComponent(titleBaseEngRate) .addGap(4, 4, 4) .addComponent(lblBaseEngineRating)) .addGroup(pnlInformationLayout.createSequentialGroup() .addGap(29, 29, 29) - .addComponent(jLabel35) + .addComponent(titleFinalEngRate) .addGap(4, 4, 4) .addComponent(lblFinalEngineRating)) .addGroup(pnlInformationLayout.createSequentialGroup() .addGap(45, 45, 45) - .addComponent(jLabel28) + .addComponent(titleFreeHeatSinks) .addGap(4, 4, 4) .addComponent(lblFreeHeatSinks))) .addContainerGap(95, Short.MAX_VALUE)) ); pnlInformationLayout.setVerticalGroup( - pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlInformationLayout.createSequentialGroup() - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel30) + .addGroup(pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleCrew) .addComponent(lblNumCrew)) .addGap(2, 2, 2) - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel29) + .addGroup(pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleSuspension) .addComponent(lblSupensionFacter)) .addGap(2, 2, 2) - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel31) + .addGroup(pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleMinEngTon) .addComponent(lblMinEngineTons)) .addGap(2, 2, 2) - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel33) + .addGroup(pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleBaseEngRate) .addComponent(lblBaseEngineRating)) .addGap(2, 2, 2) - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel35) + .addGroup(pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleFinalEngRate) .addComponent(lblFinalEngineRating)) .addGap(2, 2, 2) - .addGroup(pnlInformationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel28) + .addGroup(pnlInformationLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleFreeHeatSinks) .addComponent(lblFreeHeatSinks))) ); + //endregion + //region Basic Setup Tab / Omni Configuration Panel pnlOmniInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Omni Configuration")); pnlOmniInfo.setLayout(new java.awt.GridBagLayout()); - - btnLockChassis.setText("Lock Chassis"); - btnLockChassis.setEnabled(false); - btnLockChassis.setMaximumSize(new java.awt.Dimension(200, 23)); - btnLockChassis.setMinimumSize(new java.awt.Dimension(105, 23)); - btnLockChassis.setPreferredSize(new java.awt.Dimension(120, 23)); - btnLockChassis.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnLockChassisActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - pnlOmniInfo.add(btnLockChassis, gridBagConstraints); - - btnAddVariant.setText("Add Variant"); - btnAddVariant.setEnabled(false); - btnAddVariant.setMaximumSize(new java.awt.Dimension(200, 23)); - btnAddVariant.setMinimumSize(new java.awt.Dimension(80, 23)); - btnAddVariant.setPreferredSize(new java.awt.Dimension(120, 23)); - btnAddVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddVariantActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - pnlOmniInfo.add(btnAddVariant, gridBagConstraints); - - btnDeleteVariant.setText("Delete Variant"); - btnDeleteVariant.setEnabled(false); - btnDeleteVariant.setMaximumSize(new java.awt.Dimension(200, 23)); - btnDeleteVariant.setMinimumSize(new java.awt.Dimension(80, 23)); - btnDeleteVariant.setPreferredSize(new java.awt.Dimension(120, 23)); - btnDeleteVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnDeleteVariantActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - pnlOmniInfo.add(btnDeleteVariant, gridBagConstraints); - - btnRenameVariant.setText("Rename Variant"); - btnRenameVariant.setEnabled(false); - btnRenameVariant.setMinimumSize(new java.awt.Dimension(80, 23)); - btnRenameVariant.setPreferredSize(new java.awt.Dimension(120, 23)); - btnRenameVariant.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRenameVariantActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - pnlOmniInfo.add(btnRenameVariant, gridBagConstraints); - - jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Armor Locations")); - - pnlRightArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Right")); - pnlRightArmor.setLayout(new java.awt.GridBagLayout()); - - lblRightIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblRightIntPts.setText("00"); - lblRightIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRightIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRightIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRightIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - pnlRightArmor.add(lblRightIntPts, gridBagConstraints); - - jLabel40.setText("Internal"); - pnlRightArmor.add(jLabel40, new java.awt.GridBagConstraints()); - - jLabel46.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - pnlRightArmor.add(jLabel46, gridBagConstraints); - - spnRightArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRightArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRightArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRightArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - pnlRightArmor.add(spnRightArmor, gridBagConstraints); - - pnlFrontArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Front")); - pnlFrontArmor.setLayout(new java.awt.GridBagLayout()); - - lblFrontIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblFrontIntPts.setText("00"); - lblFrontIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblFrontIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblFrontIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblFrontIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - pnlFrontArmor.add(lblFrontIntPts, gridBagConstraints); - - jLabel45.setText("Internal"); - pnlFrontArmor.add(jLabel45, new java.awt.GridBagConstraints()); - - jLabel47.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - pnlFrontArmor.add(jLabel47, gridBagConstraints); - - spnFrontArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnFrontArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnFrontArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnFrontArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - pnlFrontArmor.add(spnFrontArmor, gridBagConstraints); - - pnlLeftArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Left")); - pnlLeftArmor.setLayout(new java.awt.GridBagLayout()); - - lblLeftIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblLeftIntPts.setText("00"); - lblLeftIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblLeftIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblLeftIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblLeftIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - pnlLeftArmor.add(lblLeftIntPts, gridBagConstraints); - - jLabel41.setText("Internal"); - pnlLeftArmor.add(jLabel41, new java.awt.GridBagConstraints()); - - jLabel48.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - pnlLeftArmor.add(jLabel48, gridBagConstraints); - - spnLeftArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnLeftArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnLeftArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnLeftArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - pnlLeftArmor.add(spnLeftArmor, gridBagConstraints); - - pnlRearArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Rear")); - pnlRearArmor.setLayout(new java.awt.GridBagLayout()); - - lblRearIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblRearIntPts.setText("00"); - lblRearIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRearIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRearIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRearIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - pnlRearArmor.add(lblRearIntPts, gridBagConstraints); - - jLabel44.setText("Internal"); - pnlRearArmor.add(jLabel44, new java.awt.GridBagConstraints()); - - jLabel49.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - pnlRearArmor.add(jLabel49, gridBagConstraints); - - spnRearArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRearArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRearArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRearArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - pnlRearArmor.add(spnRearArmor, gridBagConstraints); - - pnlTurretArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Turret")); - pnlTurretArmor.setLayout(new java.awt.GridBagLayout()); - - lblTurretIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblTurretIntPts.setText("00"); - lblTurretIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblTurretIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblTurretIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblTurretIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - pnlTurretArmor.add(lblTurretIntPts, gridBagConstraints); - - jLabel42.setText("Internal"); - pnlTurretArmor.add(jLabel42, new java.awt.GridBagConstraints()); - - jLabel50.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - pnlTurretArmor.add(jLabel50, gridBagConstraints); - - spnTurretArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnTurretArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnTurretArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnTurretArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - pnlTurretArmor.add(spnTurretArmor, gridBagConstraints); - - pnlRearTurretArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "R Turret")); - pnlRearTurretArmor.setEnabled(false); - pnlRearTurretArmor.setLayout(new java.awt.GridBagLayout()); - - lblRearTurretIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblRearTurretIntPts.setText("00"); - lblRearTurretIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRearTurretIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRearTurretIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRearTurretIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - pnlRearTurretArmor.add(lblRearTurretIntPts, gridBagConstraints); - - jLabel43.setText("Internal"); - pnlRearTurretArmor.add(jLabel43, new java.awt.GridBagConstraints()); - - jLabel51.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - pnlRearTurretArmor.add(jLabel51, gridBagConstraints); - - spnRearTurretArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRearTurretArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRearTurretArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRearTurretArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - pnlRearTurretArmor.add(spnRearTurretArmor, gridBagConstraints); - - pnlRotorArmor.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Rotor")); - pnlRotorArmor.setEnabled(false); - pnlRotorArmor.setLayout(new java.awt.GridBagLayout()); - - lblRotorIntPts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblRotorIntPts.setText("00"); - lblRotorIntPts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblRotorIntPts.setMaximumSize(new java.awt.Dimension(45, 20)); - lblRotorIntPts.setMinimumSize(new java.awt.Dimension(45, 20)); - lblRotorIntPts.setPreferredSize(new java.awt.Dimension(45, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - pnlRotorArmor.add(lblRotorIntPts, gridBagConstraints); - - jLabel92.setText("Internal"); - pnlRotorArmor.add(jLabel92, new java.awt.GridBagConstraints()); - - jLabel93.setText("Armor"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - pnlRotorArmor.add(jLabel93, gridBagConstraints); - - spnRotorArmor.setMinimumSize(new java.awt.Dimension(45, 20)); - spnRotorArmor.setPreferredSize(new java.awt.Dimension(45, 20)); - spnRotorArmor.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnRotorArmorStateChanged(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - pnlRotorArmor.add(spnRotorArmor, gridBagConstraints); - - javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); - jPanel6.setLayout(jPanel6Layout); + pnlOmniInfo.add(OmniButton(btnLockChassis, this::btnLockChassisActionPerformed), Utils.gridBag(0, 0)); + pnlOmniInfo.add(OmniButton(btnAddVariant, this::btnAddVariantActionPerformed), Utils.gridBag(0, 1)); + pnlOmniInfo.add(OmniButton(btnDeleteVariant, this::btnDeleteVariantActionPerformed), Utils.gridBag(1, 0)); + pnlOmniInfo.add(OmniButton(btnRenameVariant, this::btnRenameVariantActionPerformed), Utils.gridBag(1, 1)); + //endregion + + //region Basic Setup Tab / Armor Locations Panel + pnlArmorLocations.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Armor Locations")); + pnlRightArmor = ArmorLocation("Right", lblRightIntPts, spnRightArmor, this::spnRightArmorStateChanged); + pnlFrontArmor = ArmorLocation("Front", lblFrontIntPts, spnFrontArmor, this::spnFrontArmorStateChanged); + pnlLeftArmor = ArmorLocation("Left", lblLeftIntPts, spnLeftArmor, this::spnLeftArmorStateChanged); + pnlRearArmor = ArmorLocation("Rear", lblRearIntPts, spnRearArmor, this::spnRearArmorStateChanged); + pnlTurretArmor = ArmorLocation("Turret", lblTurretIntPts, spnTurretArmor, this::spnTurretArmorStateChanged); + pnlRearTurretArmor = ArmorLocation("R Turret", lblRearTurretIntPts, spnRearTurretArmor, this::spnRearTurretArmorStateChanged); + pnlRotorArmor = ArmorLocation("Rotor", lblRotorIntPts, spnRotorArmor, this::spnRotorArmorStateChanged); + + GroupLayout jPanel6Layout = new GroupLayout(pnlArmorLocations); + pnlArmorLocations.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addContainerGap() - .addComponent(pnlLeftArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(pnlFrontArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(pnlRearTurretArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(pnlRearArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(pnlTurretArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(pnlRotorArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlRightArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pnlLeftArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(pnlFrontArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlRearTurretArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlRearArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlTurretArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlRotorArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlRightArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(30, Short.MAX_VALUE)) ); jPanel6Layout.setVerticalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() + .addGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addGap(100, 100, 100) - .addComponent(pnlLeftArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(pnlLeftArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel6Layout.createSequentialGroup() - .addComponent(pnlFrontArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(pnlFrontArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) - .addComponent(pnlTurretArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(pnlTurretArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel6Layout.createSequentialGroup() - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pnlRightArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(pnlRotorArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pnlRightArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlRotorArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(pnlRearTurretArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 11, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlRearTurretArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(pnlRearArmor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pnlRearArmor, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); + //endregion - jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Armor Type")); - - jLabel52.setText("Armor Type:"); + //region Basic Setup Tab / Armor Type Panel + pnlArmorType.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Armor Type")); cmbArmorType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Standard", "Industrial", "Commercial", "Ferro-Fibrous", "Light Ferro-Fibrous", "Heavy Ferro-Fibrous", "Vehicular Stealth" })); - cmbArmorType.setMinimumSize(new java.awt.Dimension(150, 20)); - cmbArmorType.setPreferredSize(new java.awt.Dimension(150, 20)); - cmbArmorType.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cmbArmorTypeActionPerformed(evt); - } - }); - + cmbArmorType.setMinimumSize(new Dimension(150, 20)); + cmbArmorType.setPreferredSize(new Dimension(150, 20)); + cmbArmorType.addActionListener(this::cmbArmorTypeActionPerformed); chkBalanceLRArmor.setSelected(true); - chkBalanceLRArmor.setText("Balance Left/Right Armor"); - - chkBalanceFRArmor.setText("Balance Front/Rear Armor"); - - btnSetArmorTons.setText("Set Armor Tonnage"); - btnSetArmorTons.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnSetArmorTonsActionPerformed(evt); - } - }); - - btnUseRemaining.setText("Use Remaining Tonnage"); - btnUseRemaining.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnUseRemainingActionPerformed(evt); - } - }); - - btnMaximize.setText("Maximize Armor"); - btnMaximize.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMaximizeActionPerformed(evt); - } - }); - - javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); - jPanel7.setLayout(jPanel7Layout); - jPanel7Layout.setHorizontalGroup( - jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() - .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() + btnSetArmorTons.addActionListener(this::btnSetArmorTonsActionPerformed); + btnUseRemaining.addActionListener(this::btnUseRemainingActionPerformed); + btnMaximize.addActionListener(this::btnMaximizeActionPerformed); + + GroupLayout pnlArmorTypeLayout = new GroupLayout(pnlArmorType); + pnlArmorType.setLayout(pnlArmorTypeLayout); + pnlArmorTypeLayout.setHorizontalGroup( + pnlArmorTypeLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) .addComponent(jLabel52) .addGap(2, 2, 2) - .addComponent(cmbArmorType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addComponent(cmbArmorType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) - .addComponent(btnSetArmorTons, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addComponent(btnSetArmorTons, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) - .addComponent(btnUseRemaining, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addComponent(btnUseRemaining, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(1, 1, 1) - .addComponent(btnMaximize, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel7Layout.createSequentialGroup() + .addComponent(btnMaximize, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(31, 31, 31) - .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(chkBalanceLRArmor) .addComponent(chkBalanceFRArmor)))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - jPanel7Layout.setVerticalGroup( - jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() - .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel7Layout.createSequentialGroup() + pnlArmorTypeLayout.setVerticalGroup( + pnlArmorTypeLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() + .addGroup(pnlArmorTypeLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlArmorTypeLayout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(jLabel52)) - .addComponent(cmbArmorType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cmbArmorType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkBalanceLRArmor) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkBalanceFRArmor) .addGap(0, 0, 0) .addComponent(btnSetArmorTons) @@ -3202,532 +2029,178 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGap(0, 0, 0) .addComponent(btnMaximize)) ); + //endregion + //region Basic Setup Tab / Armor Information Panel jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Armor Information")); jPanel8.setLayout(new java.awt.GridBagLayout()); + jLabel34.setHorizontalAlignment(SwingConstants.CENTER); + jPanel8.add(jLabel34, Utils.gridBag(0, 0)); + jLabel36.setHorizontalAlignment(SwingConstants.CENTER); + jPanel8.add(jLabel36, Utils.gridBag(1, 0)); - jLabel34.setText("Tons"); - jPanel8.add(jLabel34, new java.awt.GridBagConstraints()); - - jLabel36.setText("Space"); - jPanel8.add(jLabel36, new java.awt.GridBagConstraints()); - - lblArmorTotals.setText("999 of 999 Armor Points"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); - jPanel8.add(lblArmorTotals, gridBagConstraints); - - lblArmorCoverage.setText("100.00% Coverage"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST; - gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); - jPanel8.add(lblArmorCoverage, gridBagConstraints); + lblArmorTotals.setHorizontalAlignment(SwingConstants.RIGHT); + jPanel8.add(lblArmorTotals, Utils.gridBag(2, 0)); + lblArmorCoverage.setHorizontalAlignment(SwingConstants.RIGHT); + jPanel8.add(lblArmorCoverage, Utils.gridBag(2, 1)); txtArmorTons.setEditable(false); txtArmorTons.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtArmorTons.setText("000.00"); - txtArmorTons.setMinimumSize(new java.awt.Dimension(50, 20)); - txtArmorTons.setPreferredSize(new java.awt.Dimension(50, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - jPanel8.add(txtArmorTons, gridBagConstraints); + txtArmorTons.setPreferredSize(new Dimension(50, 20)); + jPanel8.add(txtArmorTons, Utils.gridBag(0, 1)); txtArmorSpace.setEditable(false); - txtArmorSpace.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtArmorSpace.setText("00"); - txtArmorSpace.setMinimumSize(new java.awt.Dimension(40, 20)); - txtArmorSpace.setPreferredSize(new java.awt.Dimension(40, 20)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - jPanel8.add(txtArmorSpace, gridBagConstraints); - - lblArmorTonsWasted.setText("0.00 Tons Wasted"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); - jPanel8.add(lblArmorTonsWasted, gridBagConstraints); - - lblArmorLeftInLot.setText("99 Points Left In This 1/2 Ton Lot"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.gridwidth = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); - jPanel8.add(lblArmorLeftInLot, gridBagConstraints); - - javax.swing.GroupLayout pnlBasicSetupLayout = new javax.swing.GroupLayout(pnlBasicSetup); + txtArmorSpace.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + txtArmorSpace.setPreferredSize(new Dimension(40, 20)); + jPanel8.add(txtArmorSpace, Utils.gridBag(1, 1, new Insets(0, 2, 0, 0))); + lblArmorTonsWasted.setHorizontalAlignment(SwingConstants.RIGHT); + jPanel8.add(lblArmorTonsWasted, Utils.gridBag(0, 2, 3, GridBagConstraints.EAST, new Insets(4, 0, 0, 0))); + lblArmorLeftInLot.setHorizontalAlignment(SwingConstants.RIGHT); + jPanel8.add(lblArmorLeftInLot, Utils.gridBag(0, 3, 3, GridBagConstraints.EAST, new Insets(4, 0, 0, 0))); + //endregion + + //region Basic Setup Tab / Layout + GroupLayout pnlBasicSetupLayout = new GroupLayout(pnlBasicSetup); pnlBasicSetup.setLayout(pnlBasicSetupLayout); pnlBasicSetupLayout.setHorizontalGroup( - pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlBasicSetupLayout.createSequentialGroup() - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(pnlChassisMods, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlMovement, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(pnlExperimental, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlChassis, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) + .addComponent(pnlChassisMods, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnlMovement, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnlBasicInfo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) + .addComponent(pnlExperimental, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel11, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnlChassis, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(pnlSummary, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlOmniInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlInformation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) + .addComponent(pnlSummary, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnlOmniInfo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnlInformation, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlArmorLocations, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) + .addComponent(pnlArmorType, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pnlBasicSetupLayout.setVerticalGroup( - pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlBasicSetupLayout.createSequentialGroup() - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlBasicSetupLayout.createSequentialGroup() - .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(pnlArmorType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(pnlBasicSetupLayout.createSequentialGroup() - .addComponent(pnlChassis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlExperimental, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pnlBasicSetupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(pnlChassis, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlExperimental, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel11, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(pnlBasicSetupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addGroup(pnlBasicSetupLayout.createSequentialGroup() - .addComponent(pnlOmniInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlSummary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlInformation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnlBasicSetupLayout.createSequentialGroup() - .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlMovement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(2, 2, 2) - .addComponent(pnlChassisMods, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(pnlOmniInfo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlSummary, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlInformation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(GroupLayout.Alignment.LEADING, pnlBasicSetupLayout.createSequentialGroup() + .addComponent(pnlBasicInfo, GroupLayout.PREFERRED_SIZE, 221, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlMovement, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlChassisMods, GroupLayout.PREFERRED_SIZE, 142, GroupLayout.PREFERRED_SIZE)) + .addComponent(pnlArmorLocations, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); tbpMainTabPane.addTab("Basic Setup and Armor", pnlBasicSetup); + //endregion + //region Equipment Tab / Highlighted Equipment Information pnlEquipInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Information")); pnlEquipInfo.setLayout(new java.awt.GridBagLayout()); - - jLabel38.setText("Availability(AoW/SL)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); - pnlEquipInfo.add(jLabel38, gridBagConstraints); - - jLabel39.setText("Availability (SW)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); - pnlEquipInfo.add(jLabel39, gridBagConstraints); - - jLabel53.setText("Availability (CI)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); - pnlEquipInfo.add(jLabel53, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoAVSL, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoAVSW, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoAVCI, gridBagConstraints); - - jLabel54.setText("Introduction"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 3; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(jLabel54, gridBagConstraints); - - jLabel55.setText("Extinction"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 4; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(jLabel55, gridBagConstraints); - - jLabel56.setText("Reintroduction"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 5; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(jLabel56, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 4; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoIntro, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 4; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoExtinct, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 4; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoReintro, gridBagConstraints); - - jLabel57.setText("Name"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 3); - pnlEquipInfo.add(jLabel57, gridBagConstraints); - - jLabel58.setText("Type"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); - pnlEquipInfo.add(jLabel58, gridBagConstraints); - - jLabel59.setText("Heat"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); - pnlEquipInfo.add(jLabel59, gridBagConstraints); - - jLabel60.setText("Damage"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); - pnlEquipInfo.add(jLabel60, gridBagConstraints); - - jLabel61.setText("Range"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); - pnlEquipInfo.add(jLabel61, gridBagConstraints); - - lblInfoName.setText(" "); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); - pnlEquipInfo.add(lblInfoName, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoType, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoHeat, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoDamage, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 4; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoRange, gridBagConstraints); - - jSeparator17.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0); - pnlEquipInfo.add(jSeparator17, gridBagConstraints); - - jLabel62.setText("Ammo"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 5; - gridBagConstraints.gridy = 0; - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); - pnlEquipInfo.add(jLabel62, gridBagConstraints); - - jLabel63.setText("Tonnage"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 6; - gridBagConstraints.gridy = 0; - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); - pnlEquipInfo.add(jLabel63, gridBagConstraints); - - jLabel64.setText("Crits"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 7; - gridBagConstraints.gridy = 0; - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 3); - pnlEquipInfo.add(jLabel64, gridBagConstraints); - - jLabel65.setText("Specials"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 8; - gridBagConstraints.gridy = 0; - gridBagConstraints.insets = new java.awt.Insets(4, 3, 0, 0); - pnlEquipInfo.add(jLabel65, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 5; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoAmmo, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 6; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoTonnage, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 7; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoCrits, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 8; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); - pnlEquipInfo.add(lblInfoSpecials, gridBagConstraints); - - jSeparator20.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 7; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0); - pnlEquipInfo.add(jSeparator20, gridBagConstraints); - - jLabel66.setText("Cost"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 5; - gridBagConstraints.gridy = 4; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(jLabel66, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 7; - gridBagConstraints.gridy = 4; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); - pnlEquipInfo.add(lblInfoCost, gridBagConstraints); - - jLabel67.setText("BV"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 5; - gridBagConstraints.gridy = 5; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(jLabel67, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 7; - gridBagConstraints.gridy = 5; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); - pnlEquipInfo.add(lblInfoBV, gridBagConstraints); - - jLabel68.setText("Mounting Restrictions"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 8; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 3); - pnlEquipInfo.add(jLabel68, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 8; - gridBagConstraints.gridwidth = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 4, 0); - pnlEquipInfo.add(lblInfoMountRestrict, gridBagConstraints); - - jLabel69.setText("Rules Level"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 5; - gridBagConstraints.gridy = 3; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(jLabel69, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 7; - gridBagConstraints.gridy = 3; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 0); - pnlEquipInfo.add(lblInfoRulesLevel, gridBagConstraints); - - jLabel6.setText("Availability (DA)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); - pnlEquipInfo.add(jLabel6, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3); - pnlEquipInfo.add(lblInfoAVDA, gridBagConstraints); + pnlEquipInfo.add(new JLabel("Avail. (AoW/SL)"), Utils.gridBag(0, 3, new Insets(0, 0, 0, 3))); + pnlEquipInfo.add(new JLabel("Avail. (SW)"), Utils.gridBag(0, 4, new Insets(0, 0, 0, 3))); + pnlEquipInfo.add(new JLabel("Avail. (CI)"), Utils.gridBag(0, 5, new Insets(0, 0, 0, 3))); + pnlEquipInfo.add(lblInfoAVSL, Utils.gridBag(1, 3, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoAVSW, Utils.gridBag(1, 4, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoAVCI, Utils.gridBag(1, 5, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Introduction"), Utils.gridBag(2, 3, 2, GridBagConstraints.EAST, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Extinction"), Utils.gridBag(2, 4, 2, GridBagConstraints.EAST, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Reintroduction"), Utils.gridBag(2, 5, 2, GridBagConstraints.EAST, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoIntro, Utils.gridBag(4, 3, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoExtinct, Utils.gridBag(4, 4, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoReintro, Utils.gridBag(4, 5, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(new JLabel(" "), Utils.gridBag(0, 0, new Insets(4, 0, 0, 3))); + pnlEquipInfo.add(new JLabel("Type"), Utils.gridBag(1, 0, new Insets(4, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Heat"), Utils.gridBag(2, 0, new Insets(4, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Damage"), Utils.gridBag(3, 0, new Insets(4, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Range"), Utils.gridBag(4, 0, new Insets(4, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Ammo"), Utils.gridBag(5, 0, new Insets(4, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Tonnage"), Utils.gridBag(6, 0, new Insets(4, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Crits"), Utils.gridBag(7, 0, new Insets(4, 3, 0, 3))); + pnlEquipInfo.add(new JLabel("Specials"), Utils.gridBag(8, 0, new Insets(4, 3, 0, 0))); + pnlEquipInfo.add(lblInfoType, Utils.gridBag(1, 1, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoHeat, Utils.gridBag(2, 1, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoDamage, Utils.gridBag(3, 1, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoRange, Utils.gridBag(4, 1, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(Utils.etchedSeparator(), Utils.gridBag(0, 2, GridBagConstraints.REMAINDER, GridBagConstraints.WEST, new Insets(4, 0, 4, 0))); + pnlEquipInfo.add(lblInfoAmmo, Utils.gridBag(5, 1, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoTonnage, Utils.gridBag(6, 1, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoCrits, Utils.gridBag(7, 1, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoSpecials, Utils.gridBag(8, 1, new Insets(0, 3, 0, 0))); + pnlEquipInfo.add(Utils.etchedSeparator(), Utils.gridBag(0, 7, GridBagConstraints.REMAINDER, GridBagConstraints.WEST, new Insets(4, 0, 4, 0))); + pnlEquipInfo.add(new JLabel("Cost"), Utils.gridBag(5, 4, 2, GridBagConstraints.EAST, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoCost, Utils.gridBag(7, 4, 2, GridBagConstraints.WEST, new Insets(0, 3, 0, 0))); + pnlEquipInfo.add(new JLabel("BV"), Utils.gridBag(5, 5, 2, GridBagConstraints.WEST, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoBV, Utils.gridBag(7, 5, 2, GridBagConstraints.WEST, new Insets(0, 3, 0, 0))); + pnlEquipInfo.add(new JLabel("Mounting Restrictions"), Utils.gridBag(0, 8, 2, GridBagConstraints.WEST, new Insets(0, 0, 4, 3))); + pnlEquipInfo.add(lblInfoMountRestrict, Utils.gridBag(2, 8, 7, GridBagConstraints.WEST, new Insets(0, 3, 4, 0))); + pnlEquipInfo.add(new JLabel("MM Name"), Utils.gridBag(0, 9, 2, GridBagConstraints.WEST, new Insets(0, 0, 4, 3))); + pnlEquipInfo.add(lblMMNameInfo, Utils.gridBag(2, 9, 7, GridBagConstraints.WEST, new Insets(0, 3, 4, 0))); + pnlEquipInfo.add(new JLabel("Rules Level"), Utils.gridBag(5, 3, 2, GridBagConstraints.EAST, new Insets(0, 3, 0, 3))); + pnlEquipInfo.add(lblInfoRulesLevel, Utils.gridBag(7, 3, 2, GridBagConstraints.WEST, new Insets(0, 3, 0, 0))); + pnlEquipInfo.add(new JLabel("Avail. (DA)"), Utils.gridBag(0, 6, new Insets(0, 0, 0, 3))); + pnlEquipInfo.add(lblInfoAVDA, Utils.gridBag(1, 6, new Insets(0, 3, 0, 3))); + //endregion + + //region Equipment Tab / Specials Panel + chkFCSAIV.addActionListener(this::chkFCSAIVActionPerformed); + chkFCSAV.setEnabled(false); + chkFCSAV.addActionListener(this::chkFCSAVActionPerformed); + chkFCSApollo.setEnabled(false); + chkFCSApollo.addActionListener(this::chkFCSApolloActionPerformed); + chkUseTC.setEnabled(false); + chkUseTC.addActionListener(this::chkUseTCActionPerformed); + chkCASE.addActionListener(this::chkCASEActionPerformed); pnlSpecials.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Specials")); pnlSpecials.setLayout(new java.awt.GridBagLayout()); - - jLabel37.setText("Missile Guidance:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0); - pnlSpecials.add(jLabel37, gridBagConstraints); - - chkUseTC.setText("Targeting Computer"); - chkUseTC.setEnabled(false); - chkUseTC.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkUseTCActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 0); - pnlSpecials.add(chkUseTC, gridBagConstraints); - - chkFCSAIV.setText("Use Artemis IV"); - chkFCSAIV.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFCSAIVActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); - pnlSpecials.add(chkFCSAIV, gridBagConstraints); - - chkFCSAV.setText("Use Artemis V"); - chkFCSAV.setEnabled(false); - chkFCSAV.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFCSAVActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); - pnlSpecials.add(chkFCSAV, gridBagConstraints); - - chkFCSApollo.setText("Use MRM Apollo"); - chkFCSApollo.setEnabled(false); - chkFCSApollo.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkFCSApolloActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); - pnlSpecials.add(chkFCSApollo, gridBagConstraints); - - chkClanCASE.setText("Use CASE"); - chkClanCASE.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - chkClanCASEActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 0); - pnlSpecials.add(chkClanCASE, gridBagConstraints); + pnlSpecials.add(new JLabel("Missile Guidance:"), Utils.gridBag(0, 0)); + pnlSpecials.add(chkFCSAIV, Utils.gridBag(0, 1)); + pnlSpecials.add(chkFCSAV, Utils.gridBag(0, 2)); + pnlSpecials.add(chkFCSApollo, Utils.gridBag(0, 3)); + pnlSpecials.add(chkUseTC, Utils.gridBag(0, 4)); + pnlSpecials.add(chkCASE, Utils.gridBag(0, 5)); + //endregion + + //region Equipment Tab / Controls Panel + btnRemoveEquip.addActionListener(this::btnRemoveEquipActionPerformed); + btnClearEquip.addActionListener(this::btnClearEquipActionPerformed); + btnAddEquip.addActionListener(this::btnAddEquipActionPerformed); pnlControls.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Controls")); pnlControls.setLayout(new java.awt.GridBagLayout()); - - btnRemoveEquip.setText("<<"); - btnRemoveEquip.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnRemoveEquipActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 8); - pnlControls.add(btnRemoveEquip, gridBagConstraints); - - btnClearEquip.setText("Clear"); - btnClearEquip.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnClearEquipActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); - pnlControls.add(btnClearEquip, gridBagConstraints); - - btnAddEquip.setText(">>"); - btnAddEquip.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddEquipActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 0; - gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); - pnlControls.add(btnAddEquip, gridBagConstraints); - - cmbNumEquips.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" })); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(4, 8, 0, 0); - pnlControls.add(cmbNumEquips, gridBagConstraints); + pnlControls.setPreferredSize(new Dimension(135, 200)); + pnlControls.add(btnRemoveEquip, Utils.gridBag(0, 0)); + pnlControls.add(btnClearEquip, Utils.gridBag(0, 1)); + pnlControls.add(btnAddEquip, Utils.gridBag(1, 0)); + pnlControls.add(cmbNumEquips, Utils.gridBag(1, 1)); cmbLocation.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Front", "Left", "Right", "Rear", "Body", "Turret", "Rear Turret" }; @@ -3736,41 +2209,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); cmbLocation.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); cmbLocation.setSelectedIndex(0); - cmbLocation.setVisibleRowCount(4); + cmbLocation.setVisibleRowCount(8); cmbLocation.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { cmbLocationMouseClicked(evt); } }); - jScrollPane1.setViewportView(cmbLocation); + scrLocations.setViewportView(cmbLocation); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.gridwidth = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0); - pnlControls.add(jScrollPane1, gridBagConstraints); + pnlControls.add(scrLocations, Utils.gridBag(0, 2, 2, 1)); pnlSelected.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Selected Equipment")); - pnlSelected.setMaximumSize(new java.awt.Dimension(212, 286)); - pnlSelected.setMinimumSize(new java.awt.Dimension(212, 286)); - pnlSelected.setLayout(new javax.swing.BoxLayout(pnlSelected, javax.swing.BoxLayout.LINE_AXIS)); - - jScrollPane23.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane23.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - - lstSelectedEquipment.setModel( new javax.swing.DefaultListModel() - ); - lstSelectedEquipment.setMaximumSize(new java.awt.Dimension(180, 225)); - lstSelectedEquipment.setMinimumSize(new java.awt.Dimension(180, 225)); - lstSelectedEquipment.setPreferredSize(null); - lstSelectedEquipment.setVisibleRowCount(16); - lstSelectedEquipment.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstSelectedEquipmentValueChanged(evt); - } - }); + pnlSelected.setMaximumSize(new Dimension(250, 1000)); + pnlSelected.setMinimumSize(new Dimension(150, 250)); + pnlSelected.setLayout(new BoxLayout(pnlSelected, BoxLayout.LINE_AXIS)); + //endregion + + //region Equipment Tab / Selected Equipment Panel + lstSelectedEquipment.setModel( new javax.swing.DefaultListModel()); + lstSelectedEquipment.addListSelectionListener(this::lstSelectedEquipmentValueChanged); lstSelectedEquipment.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { lstSelectedEquipmentKeyPressed(evt); @@ -3798,577 +2255,122 @@ public void mousePressed( MouseEvent e ) { }; lstSelectedEquipment.addMouseListener( mlSelect ); lstSelectedEquipment.setCellRenderer( new saw.gui.EquipmentSelectedRenderer( this ) ); - jScrollPane23.setViewportView(lstSelectedEquipment); - - pnlSelected.add(jScrollPane23); - - tbpWeaponChooser.setTabPlacement(javax.swing.JTabbedPane.RIGHT); - tbpWeaponChooser.setMaximumSize(new java.awt.Dimension(300, 300)); - tbpWeaponChooser.setMinimumSize(new java.awt.Dimension(300, 300)); - - jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator5.setAlignmentX(0.0F); - jSeparator5.setAlignmentY(0.0F); - - jScrollPane8.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane8.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane8.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseBallistic.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseBallistic.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseBallistic.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseBallistic.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseBallistic.setPreferredSize(null); - lstChooseBallistic.setVisibleRowCount(16); - lstChooseBallistic.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseBallisticValueChanged(evt); - } - }); - MouseListener mlBallistic = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseBallistic.addMouseListener( mlBallistic ); - lstChooseBallistic.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane8.setViewportView(lstChooseBallistic); - - jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator6.setAlignmentX(0.0F); - jSeparator6.setAlignmentY(0.0F); - - javax.swing.GroupLayout pnlBallisticLayout = new javax.swing.GroupLayout(pnlBallistic); - pnlBallistic.setLayout(pnlBallisticLayout); - pnlBallisticLayout.setHorizontalGroup( - pnlBallisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addGap(106, 106, 106) - .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addGap(6, 6, 6) - .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(6, 6, 6)) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addGap(106, 106, 106) - .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)) - ); - pnlBallisticLayout.setVerticalGroup( - pnlBallisticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlBallisticLayout.createSequentialGroup() - .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, 0) - .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE) - .addGap(0, 0, 0) - .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(1, 1, 1)) - ); - - tbpWeaponChooser.addTab("Ballistic", pnlBallistic); - - pnlEnergy.setLayout(new javax.swing.BoxLayout(pnlEnergy, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator7.setAlignmentX(0.0F); - jSeparator7.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator7); - - jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane9.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEnergy.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEnergy.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEnergy.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEnergy.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEnergy.setPreferredSize(null); - lstChooseEnergy.setVisibleRowCount(16); - lstChooseEnergy.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEnergyValueChanged(evt); - } - }); - MouseListener mlEnergy = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseEnergy.addMouseListener( mlEnergy ); - lstChooseEnergy.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane9.setViewportView(lstChooseEnergy); - - pnlEnergy.add(jScrollPane9); - - jSeparator8.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator8.setAlignmentX(0.0F); - jSeparator8.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator8); - - tbpWeaponChooser.addTab("Energy", pnlEnergy); - - pnlMissile.setLayout(new javax.swing.BoxLayout(pnlMissile, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator9.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator9.setAlignmentX(0.0F); - jSeparator9.setAlignmentY(0.0F); - pnlMissile.add(jSeparator9); - - jScrollPane19.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane19.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane19.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseMissile.setModel(new javax.swing.AbstractListModel() { + scrSelectedEquip.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrSelectedEquip.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + scrSelectedEquip.setViewportView(lstSelectedEquipment); + pnlSelected.add(scrSelectedEquip); + //endregion + + //region Equipment Tab / Weapons and Equipment Lists + AbstractListModel placeholder = new AbstractListModel() { String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseMissile.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseMissile.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseMissile.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseMissile.setPreferredSize(null); - lstChooseMissile.setVisibleRowCount(16); - lstChooseMissile.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseMissileValueChanged(evt); - } - }); - MouseListener mlMissile = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } }; - lstChooseMissile.addMouseListener( mlMissile ); - lstChooseMissile.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane19.setViewportView(lstChooseMissile); - - pnlMissile.add(jScrollPane19); - - jSeparator10.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator10.setAlignmentX(0.0F); - jSeparator10.setAlignmentY(0.0F); - pnlMissile.add(jSeparator10); - - tbpWeaponChooser.addTab("Missile", pnlMissile); - - pnlPhysical.setLayout(new javax.swing.BoxLayout(pnlPhysical, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator11.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator11.setAlignmentX(0.0F); - jSeparator11.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator11); - jScrollPane20.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane20.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane20.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChoosePhysical.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChoosePhysical.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChoosePhysical.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChoosePhysical.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChoosePhysical.setPreferredSize(null); - lstChoosePhysical.setVisibleRowCount(16); - lstChoosePhysical.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChoosePhysicalValueChanged(evt); - } - }); - MouseListener mlPhysical = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChoosePhysical.addMouseListener( mlPhysical ); - lstChoosePhysical.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane20.setViewportView(lstChoosePhysical); - - pnlPhysical.add(jScrollPane20); - - jSeparator12.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator12.setAlignmentX(0.0F); - jSeparator12.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator12); - - tbpWeaponChooser.addTab("Physical", pnlPhysical); - - pnlEquipmentChooser.setLayout(new javax.swing.BoxLayout(pnlEquipmentChooser, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator13.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator13.setAlignmentX(0.0F); - jSeparator13.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator13); - - jScrollPane21.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane21.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane21.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEquipment.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEquipment.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEquipment.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEquipment.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEquipment.setPreferredSize(null); - lstChooseEquipment.setVisibleRowCount(16); - lstChooseEquipment.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEquipmentValueChanged(evt); - } - }); - MouseListener mlEquipment = new MouseAdapter() { + MouseListener mlAddEquip = new MouseAdapter() { public void mouseClicked( MouseEvent e ) { if ( e.getClickCount() == 2 && e.getButton() == 1 ) { btnAddEquipActionPerformed( null ); } } }; - lstChooseEquipment.addMouseListener( mlEquipment ); - lstChooseEquipment.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane21.setViewportView(lstChooseEquipment); - - pnlEquipmentChooser.add(jScrollPane21); - - jSeparator14.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator14.setAlignmentX(0.0F); - jSeparator14.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator14); - tbpWeaponChooser.addTab("Equipment", pnlEquipmentChooser); - - pnlArtillery.setLayout(new javax.swing.BoxLayout(pnlArtillery, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator18.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator18.setAlignmentX(0.0F); - jSeparator18.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator18); - - jScrollPane24.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane24.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane24.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseArtillery.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseArtillery.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseArtillery.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseArtillery.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseArtillery.setPreferredSize(null); - lstChooseArtillery.setVisibleRowCount(16); - lstChooseArtillery.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseArtilleryValueChanged(evt); - } - }); - MouseListener mlArtillery = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseArtillery.addMouseListener( mlArtillery ); - lstChooseArtillery.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane24.setViewportView(lstChooseArtillery); - - pnlArtillery.add(jScrollPane24); - - jSeparator19.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator19.setAlignmentX(0.0F); - jSeparator19.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator19); - - tbpWeaponChooser.addTab("Artillery", pnlArtillery); - - pnlAmmunition.setLayout(new javax.swing.BoxLayout(pnlAmmunition, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator15.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator15.setAlignmentX(0.0F); - jSeparator15.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator15); - - jScrollPane22.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane22.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane22.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseAmmunition.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseAmmunition.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseAmmunition.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseAmmunition.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseAmmunition.setPreferredSize(null); - lstChooseAmmunition.setVisibleRowCount(16); - lstChooseAmmunition.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseAmmunitionValueChanged(evt); - } - }); - MouseListener mlAmmo = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseAmmunition.addMouseListener( mlAmmo ); - lstChooseAmmunition.setCellRenderer( new saw.gui.EquipmentListRenderer( this ) ); - jScrollPane22.setViewportView(lstChooseAmmunition); - - pnlAmmunition.add(jScrollPane22); - - jSeparator16.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator16.setAlignmentX(0.0F); - jSeparator16.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator16); - - tbpWeaponChooser.addTab("Ammunition", pnlAmmunition); - - javax.swing.GroupLayout pnlEquipmentLayout = new javax.swing.GroupLayout(pnlEquipment); + tbpWeaponChooser.setTabPlacement(javax.swing.JTabbedPane.RIGHT); + tbpWeaponChooser.setMinimumSize(new Dimension(150, 250)); + tbpWeaponChooser.setMaximumSize(new Dimension(350, 1000)); + tbpWeaponChooser.addTab("Ballistic", EquipmentLocation(lstChooseBallistic, this::lstChooseBallisticValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Energy", EquipmentLocation(lstChooseEnergy, this::lstChooseEnergyValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Missile", EquipmentLocation(lstChooseMissile, this::lstChooseMissileValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Physical", EquipmentLocation(lstChoosePhysical, this::lstChoosePhysicalValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Equipment", EquipmentLocation(lstChooseEquipment, this::lstChooseEquipmentValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Artillery", EquipmentLocation(lstChooseArtillery, this::lstChooseArtilleryValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Ammunition", EquipmentLocation(lstChooseAmmunition, this::lstChooseAmmunitionValueChanged, mlAddEquip, placeholder)); + + //region Log Output + JPanel pnlLog = new JPanel(); + pnlLog.setLayout(new BoxLayout(pnlLog, BoxLayout.Y_AXIS)); + //pnlLog.add(txtLog); //Uncomment this when you want to see entries in the Log + //endregion + + GroupLayout pnlEquipmentLayout = new GroupLayout(pnlEquipment); pnlEquipment.setLayout(pnlEquipmentLayout); pnlEquipmentLayout.setHorizontalGroup( - pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlEquipmentLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) .addGroup(pnlEquipmentLayout.createSequentialGroup() - .addContainerGap() - .addComponent(tbpWeaponChooser, javax.swing.GroupLayout.PREFERRED_SIZE, 294, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(pnlControls, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlSpecials, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlSelected, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlEquipInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 544, Short.MAX_VALUE) - .addContainerGap()) + .addComponent(tbpWeaponChooser, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE) + .addGroup(pnlEquipmentLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) + .addComponent(pnlControls, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlSpecials, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) + .addComponent(pnlSelected, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE) + .addGroup(pnlEquipmentLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addComponent(pnlEquipInfo, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlLog, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE))) ); pnlEquipmentLayout.setVerticalGroup( - pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlEquipmentLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlEquipmentLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pnlEquipmentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(pnlSelected, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(tbpWeaponChooser, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(pnlEquipmentLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addComponent(pnlSelected, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tbpWeaponChooser, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pnlEquipmentLayout.createSequentialGroup() - .addComponent(pnlControls, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlSpecials, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(139, Short.MAX_VALUE)) + .addComponent(pnlControls, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlSpecials, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addGroup(pnlEquipmentLayout.createSequentialGroup() - .addComponent(pnlEquipInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(pnlEquipInfo, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlLog, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE)) ); tbpMainTabPane.addTab("Equipment", pnlEquipment); + //endregion - pnlExport.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Export", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11))); // NOI18N + //region Battleforce Tab / Export Panel (hidden) + pnlExport.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Export", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", Font.PLAIN, 11))); // NOI18N pnlExport.setLayout(new java.awt.GridBagLayout()); - btnExportTXT.setText("to TXT"); - btnExportTXT.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportTXTActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + btnExportTXT.addActionListener(this::btnExportTXTActionPerformed); + gridBagConstraints = new GridBagConstraints(); + gridBagConstraints.anchor = GridBagConstraints.WEST; pnlExport.add(btnExportTXT, gridBagConstraints); - btnExportHTML.setText("to HTML"); - btnExportHTML.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportHTMLActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); + btnExportHTML.addActionListener(this::btnExportHTMLActionPerformed); + gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4); pnlExport.add(btnExportHTML, gridBagConstraints); - btnExportMTF.setText("to MegaMek"); - btnExportMTF.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnExportMTFActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; + btnExportMTF.addActionListener(this::btnExportMTFActionPerformed); + gridBagConstraints = new GridBagConstraints(); + gridBagConstraints.anchor = GridBagConstraints.EAST; pnlExport.add(btnExportMTF, gridBagConstraints); + //endregion - tbpFluffEditors.setTabPlacement(javax.swing.JTabbedPane.LEFT); - tbpFluffEditors.setMaximumSize(new java.awt.Dimension(420, 455)); - tbpFluffEditors.setMinimumSize(new java.awt.Dimension(420, 455)); + //region Fluff Tab / Fluff Editors + tbpFluffEditors.setTabPlacement(JTabbedPane.RIGHT); + tbpFluffEditors.setPreferredSize(new Dimension(400, 455)); - pnlOverview.setMaximumSize(new java.awt.Dimension(427, 485)); - pnlOverview.setMinimumSize(new java.awt.Dimension(427, 485)); - pnlOverview.setLayout(new javax.swing.BoxLayout(pnlOverview, javax.swing.BoxLayout.Y_AXIS)); + pnlOverview.setLayout(new BoxLayout(pnlOverview, BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Overview", pnlOverview); - pnlCapabilities.setMaximumSize(new java.awt.Dimension(427, 485)); - pnlCapabilities.setMinimumSize(new java.awt.Dimension(427, 485)); - pnlCapabilities.setLayout(new javax.swing.BoxLayout(pnlCapabilities, javax.swing.BoxLayout.Y_AXIS)); + pnlCapabilities.setLayout(new BoxLayout(pnlCapabilities, BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Capabilities", pnlCapabilities); - pnlHistory.setLayout(new javax.swing.BoxLayout(pnlHistory, javax.swing.BoxLayout.Y_AXIS)); + pnlHistory.setLayout(new BoxLayout(pnlHistory, BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Battle History", pnlHistory); - pnlDeployment.setLayout(new javax.swing.BoxLayout(pnlDeployment, javax.swing.BoxLayout.Y_AXIS)); + pnlDeployment.setLayout(new BoxLayout(pnlDeployment, BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Deployment", pnlDeployment); - pnlVariants.setLayout(new javax.swing.BoxLayout(pnlVariants, javax.swing.BoxLayout.Y_AXIS)); + pnlVariants.setLayout(new BoxLayout(pnlVariants, BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Variants", pnlVariants); - pnlNotables.setLayout(new javax.swing.BoxLayout(pnlNotables, javax.swing.BoxLayout.Y_AXIS)); + pnlNotables.setLayout(new BoxLayout(pnlNotables, BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Notables", pnlNotables); - pnlAdditionalFluff.setLayout(new javax.swing.BoxLayout(pnlAdditionalFluff, javax.swing.BoxLayout.Y_AXIS)); + pnlAdditionalFluff.setLayout(new BoxLayout(pnlAdditionalFluff, BoxLayout.Y_AXIS)); tbpFluffEditors.addTab("Additional", pnlAdditionalFluff); - pnlManufacturers.setLayout(new java.awt.GridBagLayout()); - - jLabel82.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - jLabel82.setText("Manufacturer Information"); - jLabel82.setMaximumSize(new java.awt.Dimension(175, 15)); - jLabel82.setMinimumSize(new java.awt.Dimension(175, 15)); - jLabel82.setPreferredSize(new java.awt.Dimension(175, 15)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0); - pnlManufacturers.add(jLabel82, gridBagConstraints); - - jLabel83.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel83.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel83.setText("Manufacturing Company:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 0); - pnlManufacturers.add(jLabel83, gridBagConstraints); - - jLabel84.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel84.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel84.setText("Location:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 76; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); - pnlManufacturers.add(jLabel84, gridBagConstraints); - - jLabel85.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel85.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel85.setText("Engine Manufacturer:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 17; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); - pnlManufacturers.add(jLabel85, gridBagConstraints); - - jLabel86.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel86.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel86.setText("Armor Model:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 56; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); - pnlManufacturers.add(jLabel86, gridBagConstraints); - - jLabel87.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel87.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel87.setText("Chassis Model:"); - jLabel87.setEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 47; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); - pnlManufacturers.add(jLabel87, gridBagConstraints); - - jLabel88.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel88.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel88.setText("Communications System:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 7; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); - pnlManufacturers.add(jLabel88, gridBagConstraints); - - jLabel89.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel89.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel89.setText("Targeting and Tracking:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 8; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 7; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); - pnlManufacturers.add(jLabel89, gridBagConstraints); - - txtManufacturer.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(10, 2, 0, 11); - pnlManufacturers.add(txtManufacturer, gridBagConstraints); - MouseListener mlManufacturer = new MouseAdapter() { + MouseListener showFluff = new MouseAdapter() { public void mouseReleased( MouseEvent e ) { if( e.isPopupTrigger() ) { mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); @@ -4380,152 +2382,44 @@ public void mousePressed( MouseEvent e ) { } } }; - txtManufacturer.addMouseListener( mlManufacturer ); - - txtEngineManufacturer.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); - pnlManufacturers.add(txtEngineManufacturer, gridBagConstraints); - MouseListener mlEngineManufacturer = new MouseAdapter() { - public void mouseReleased( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - public void mousePressed( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - }; - txtEngineManufacturer.addMouseListener( mlEngineManufacturer ); - - txtArmorModel.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); - pnlManufacturers.add(txtArmorModel, gridBagConstraints); - MouseListener mlArmorModel = new MouseAdapter() { - public void mouseReleased( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - public void mousePressed( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - }; - txtArmorModel.addMouseListener( mlArmorModel ); - - txtChassisModel.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - txtChassisModel.setEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); - pnlManufacturers.add(txtChassisModel, gridBagConstraints); - MouseListener mlChassisModel = new MouseAdapter() { - public void mouseReleased( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - public void mousePressed( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - }; - txtChassisModel.addMouseListener( mlChassisModel ); - - txtCommSystem.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 7; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); - pnlManufacturers.add(txtCommSystem, gridBagConstraints); - MouseListener mlCommSystem = new MouseAdapter() { - public void mouseReleased( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - public void mousePressed( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - }; - txtCommSystem.addMouseListener( mlCommSystem ); - - txtTNTSystem.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 8; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); - pnlManufacturers.add(txtTNTSystem, gridBagConstraints); - MouseListener mlTNTSystem = new MouseAdapter() { - public void mouseReleased( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - public void mousePressed( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - }; - txtTNTSystem.addMouseListener( mlTNTSystem ); - - pnlWeaponsManufacturers.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Weapons Manufacturers", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11))); // NOI18N - pnlWeaponsManufacturers.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - pnlWeaponsManufacturers.setMinimumSize(new java.awt.Dimension(315, 260)); - pnlWeaponsManufacturers.setLayout(new java.awt.GridBagLayout()); + //endregion + + //region Fluff Tab / Manufacturers + lblManuInfo.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); // NOI18N + lblManuInfo.setText("Manufacturer Information"); + + pnlManufacturers.setLayout(new BoxLayout(pnlManufacturers, BoxLayout.Y_AXIS)); + pnlManufacturers.setPreferredSize(new Dimension(400, 100)); + pnlManufacturers.add(lblManuInfo); + pnlManufacturers.add(DataEntry("Manufacturing Company:", txtManufacturer, showFluff)); + pnlManufacturers.add(DataEntry("Location:", txtManufacturerLocation, showFluff)); + pnlManufacturers.add(DataEntry("Chassis Model:", txtChassisModel, showFluff)); + pnlManufacturers.add(DataEntry("Engine Manufacturer:", txtEngineManufacturer, showFluff)); + pnlManufacturers.add(DataEntry("Armor Model:", txtArmorModel, showFluff)); + pnlManufacturers.add(DataEntry("Communications System:", txtCommSystem, showFluff)); + pnlManufacturers.add(DataEntry("Targeting and Tracking:", txtTNTSystem, showFluff)); + + pnlWeaponsManufacturers.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Weapons Manufacturers", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", Font.PLAIN, 11))); // NOI18N + pnlWeaponsManufacturers.setFont(new java.awt.Font("Arial", Font.PLAIN, 11)); // NOI18N + pnlWeaponsManufacturers.setMinimumSize(new Dimension(200, 200)); + pnlWeaponsManufacturers.setLayout(new BoxLayout(pnlWeaponsManufacturers, BoxLayout.Y_AXIS)); chkIndividualWeapons.setText("Assign manufacturers individually"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(4, 10, 4, 0); - pnlWeaponsManufacturers.add(chkIndividualWeapons, gridBagConstraints); - - scpWeaponManufacturers.setPreferredSize(new java.awt.Dimension(452, 392)); + pnlWeaponsManufacturers.add(chkIndividualWeapons); tblWeaponManufacturers.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - {null, null}, - {null, null}, - {null, null}, - {null, null} - }, - new String [] { - "Weapon", "Manufacturer" - } + new Object [][] { + {null, null}, + {null, null}, + {null, null}, + {null, null} + }, + new String [] { + "Weapon", "Manufacturer" + } ) { boolean[] canEdit = new boolean [] { - false, true + false, true }; public boolean isCellEditable(int rowIndex, int columnIndex) { @@ -4533,606 +2427,319 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { } }); scpWeaponManufacturers.setViewportView(tblWeaponManufacturers); + pnlWeaponsManufacturers.add(scpWeaponManufacturers); + pnlManufacturers.add(pnlWeaponsManufacturers); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.ipadx = 280; - gridBagConstraints.ipady = 180; - pnlWeaponsManufacturers.add(scpWeaponManufacturers, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 9; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(2, 10, 2, 10); - pnlManufacturers.add(pnlWeaponsManufacturers, gridBagConstraints); - - txtManufacturerLocation.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); - pnlManufacturers.add(txtManufacturerLocation, gridBagConstraints); - MouseListener mlManufacturerLocation = new MouseAdapter() { - public void mouseReleased( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - public void mousePressed( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - }; - txtManufacturerLocation.addMouseListener( mlManufacturerLocation ); - - jLabel90.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N - jLabel90.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); - jLabel90.setText("Jump Jet Model:"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 44; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); - pnlManufacturers.add(jLabel90, gridBagConstraints); - - txtJJModel.setEnabled(false); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.ipadx = 184; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 11); - pnlManufacturers.add(txtJJModel, gridBagConstraints); - MouseListener mlJJModel = new MouseAdapter() { - public void mouseReleased( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - public void mousePressed( MouseEvent e ) { - if( e.isPopupTrigger() ) { - mnuFluff.show( e.getComponent(), e.getX(), e.getY() ); - } - } - }; - txtJJModel.addMouseListener( mlJJModel ); - - tbpFluffEditors.addTab("Manufacturers", pnlManufacturers); - - lblBattleMechQuirks.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - lblBattleMechQuirks.setText("Quirks"); - lblBattleMechQuirks.setMaximumSize(new java.awt.Dimension(175, 15)); - lblBattleMechQuirks.setMinimumSize(new java.awt.Dimension(175, 15)); - lblBattleMechQuirks.setPreferredSize(new java.awt.Dimension(175, 15)); - - tblQuirks.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - {null, null}, - {null, null}, - {null, null}, - {null, null} - }, - new String [] { - "Quirk", "Cost" - } - ) { - Class[] types = new Class [] { - java.lang.String.class, java.lang.Integer.class - }; - boolean[] canEdit = new boolean [] { - false, false - }; + //tbpFluffEditors.addTab("Manufacturers", pnlManufacturers); + //endregion - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } + //region Fluff Tab / Quirks Editor + lblBattleMechQuirks.setFont(new java.awt.Font("Arial", Font.BOLD, 12)); // NOI18N - public boolean isCellEditable(int rowIndex, int columnIndex) { - return canEdit [columnIndex]; - } - }); + tblQuirks.setModel(new tbQuirks(new ArrayList())); tblQuirks.setColumnSelectionAllowed(true); tblQuirks.getTableHeader().setReorderingAllowed(false); scpQuirkTable.setViewportView(tblQuirks); - btnAddQuirk.setText("Add Quirk"); - btnAddQuirk.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnAddQuirkActionPerformed(evt); - } - }); + btnAddQuirk.addActionListener(this::btnAddQuirkActionPerformed); - javax.swing.GroupLayout pnlQuirksLayout = new javax.swing.GroupLayout(pnlQuirks); + GroupLayout pnlQuirksLayout = new GroupLayout(pnlQuirks); pnlQuirks.setLayout(pnlQuirksLayout); pnlQuirksLayout.setHorizontalGroup( - pnlQuirksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(lblBattleMechQuirks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + pnlQuirksLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(lblBattleMechQuirks, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(pnlQuirksLayout.createSequentialGroup() .addContainerGap() - .addGroup(pnlQuirksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlQuirksLayout.createSequentialGroup() + .addGroup(pnlQuirksLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, pnlQuirksLayout.createSequentialGroup() .addGap(0, 313, Short.MAX_VALUE) .addComponent(btnAddQuirk)) - .addComponent(scpQuirkTable, javax.swing.GroupLayout.DEFAULT_SIZE, 392, Short.MAX_VALUE)) + .addComponent(scpQuirkTable, GroupLayout.DEFAULT_SIZE, 392, Short.MAX_VALUE)) .addContainerGap()) ); pnlQuirksLayout.setVerticalGroup( - pnlQuirksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + pnlQuirksLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnlQuirksLayout.createSequentialGroup() .addComponent(lblBattleMechQuirks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnAddQuirk) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(scpQuirkTable, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnAddQuirk) .addContainerGap()) ); tbpFluffEditors.addTab("Quirks", pnlQuirks); + //endregion + + //region Fluff Tab / Fluff Image + pnlImage.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Fluff Image", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", Font.PLAIN, 11))); // NOI18N + pnlImage.setPreferredSize(new Dimension(350, 450)); + pnlImageButtons.setLayout(new java.awt.GridBagLayout()); + + lblFluffImage.setPreferredSize(new Dimension(300, 350)); + + btnLoadImage.addActionListener(this::btnLoadImageActionPerformed); + pnlImageButtons.add(btnLoadImage, new GridBagConstraints()); + + btnClearImage.addActionListener(this::btnClearImageActionPerformed); + pnlImageButtons.add(btnClearImage, Utils.gridBag(1, 0)); + + GroupLayout pnlImageLayout = new GroupLayout(pnlImage); + pnlImage.setLayout(pnlImageLayout); + pnlImageLayout.setHorizontalGroup( + pnlImageLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pnlImageButtons, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(lblFluffImage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + ); + pnlImageLayout.setVerticalGroup( + pnlImageLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(pnlImageLayout.createSequentialGroup() + .addComponent(pnlImageButtons, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblFluffImage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + //endregion + + //region Fluff Tab / Layout + GroupLayout pnlFluffLayout = new GroupLayout(pnlFluff); + pnlFluff.setLayout(pnlFluffLayout); + pnlFluffLayout.setHorizontalGroup( + pnlFluffLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addGroup(pnlFluffLayout.createSequentialGroup() + .addContainerGap() + .addComponent(pnlManufacturers, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tbpFluffEditors, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pnlImage, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addContainerGap()) + ); + pnlFluffLayout.setVerticalGroup( + pnlFluffLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addGroup(pnlFluffLayout.createSequentialGroup() + .addContainerGap() + .addGroup(pnlFluffLayout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addComponent(pnlManufacturers, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tbpFluffEditors, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnlImage, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + + tbpMainTabPane.addTab("Fluff", pnlFluff); + //endregion + //region Battleforce Tab / Battleforce Stats pnlBFStats.setBorder(javax.swing.BorderFactory.createTitledBorder("BattleForce Stats")); pnlBFStats.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); - - jLabel70.setText("MV"); pnlBFStats.add(jLabel70, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1)); - - jLabel71.setText("S (+0)"); pnlBFStats.add(jLabel71, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 30, -1, -1)); - - jLabel72.setText("M (+2)"); pnlBFStats.add(jLabel72, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 30, -1, -1)); - - jLabel73.setText("L (+4)"); pnlBFStats.add(jLabel73, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 30, -1, -1)); - - jLabel74.setText("E (+6)"); pnlBFStats.add(jLabel74, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 30, -1, -1)); - - jLabel75.setText("Wt."); pnlBFStats.add(jLabel75, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 30, -1, -1)); - - jLabel76.setText("OV"); pnlBFStats.add(jLabel76, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 30, -1, -1)); - - jLabel77.setText("Armor:"); pnlBFStats.add(jLabel77, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 110, -1, -1)); - - jLabel78.setText("Structure:"); pnlBFStats.add(jLabel78, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 140, -1, -1)); - - jLabel79.setText("Special Abilities:"); pnlBFStats.add(jLabel79, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, -1, -1)); - lblBFMV.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFMV.setText("0"); pnlBFStats.add(lblBFMV, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, 30, -1)); - lblBFWt.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFWt.setText("1"); pnlBFStats.add(lblBFWt, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 50, 30, -1)); - lblBFOV.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFOV.setText("0"); pnlBFStats.add(lblBFOV, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 50, 30, -1)); - lblBFExtreme.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFExtreme.setText("0"); pnlBFStats.add(lblBFExtreme, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 50, 30, -1)); - lblBFShort.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFShort.setText("0"); pnlBFStats.add(lblBFShort, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 50, 30, -1)); - lblBFMedium.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFMedium.setText("0"); pnlBFStats.add(lblBFMedium, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 50, 30, -1)); - lblBFLong.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFLong.setText("0"); pnlBFStats.add(lblBFLong, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 50, 30, -1)); - lblBFArmor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFArmor.setText("0"); pnlBFStats.add(lblBFArmor, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 30, 30, -1)); - lblBFStructure.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblBFStructure.setText("0"); pnlBFStats.add(lblBFStructure, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 60, 30, -1)); - - lblBFSA.setText("Placeholder"); pnlBFStats.add(lblBFSA, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 130, 430, 20)); + pnlBFStats.add(jLabel80, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 30, -1, -1)); + pnlBFStats.add(lblBFPoints, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 30, -1, -1)); + //endregion - jLabel80.setText("Points:"); - pnlBFStats.add(jLabel80, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 30, -1, -1)); - - lblBFPoints.setText("0"); - pnlBFStats.add(lblBFPoints, new org.netbeans.lib.awtextra.AbsoluteConstraints(510, 30, -1, -1)); - - jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Conversion Steps")); - - jTextAreaBFConversion.setColumns(20); - jTextAreaBFConversion.setEditable(false); - jTextAreaBFConversion.setRows(5); - jScrollPane14.setViewportView(jTextAreaBFConversion); - - javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); - jPanel10.setLayout(jPanel10Layout); - jPanel10Layout.setHorizontalGroup( - jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel10Layout.createSequentialGroup() - .addGap(4, 4, 4) - .addComponent(jScrollPane14) - .addContainerGap()) - ); - jPanel10Layout.setVerticalGroup( - jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane14) - ); - - pnlImage.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Fluff Image", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11))); // NOI18N - - lblFluffImage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - lblFluffImage.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - lblFluffImage.setMaximumSize(new java.awt.Dimension(375, 260)); - lblFluffImage.setMinimumSize(new java.awt.Dimension(375, 260)); - lblFluffImage.setPreferredSize(new java.awt.Dimension(350, 350)); - - jPanel1.setLayout(new java.awt.GridBagLayout()); - - btnLoadImage.setText("Load Image"); - btnLoadImage.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnLoadImageActionPerformed(evt); - } - }); - jPanel1.add(btnLoadImage, new java.awt.GridBagConstraints()); - - btnClearImage.setText("Clear Image"); - btnClearImage.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnClearImageActionPerformed(evt); - } - }); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - jPanel1.add(btnClearImage, gridBagConstraints); - - javax.swing.GroupLayout pnlImageLayout = new javax.swing.GroupLayout(pnlImage); - pnlImage.setLayout(pnlImageLayout); - pnlImageLayout.setHorizontalGroup( - pnlImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(lblFluffImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - ); - pnlImageLayout.setVerticalGroup( - pnlImageLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlImageLayout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(4, 4, 4) - .addComponent(lblFluffImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - javax.swing.GroupLayout pnlFluffLayout = new javax.swing.GroupLayout(pnlFluff); - pnlFluff.setLayout(pnlFluffLayout); - pnlFluffLayout.setHorizontalGroup( - pnlFluffLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlFluffLayout.createSequentialGroup() - .addContainerGap() - .addComponent(pnlImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(tbpFluffEditors, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pnlFluffLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlFluffLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(pnlBFStats, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(pnlExport, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - pnlFluffLayout.setVerticalGroup( - pnlFluffLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pnlFluffLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pnlFluffLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup(pnlFluffLayout.createSequentialGroup() - .addComponent(pnlBFStats, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlExport, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(tbpFluffEditors, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(pnlImage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap(40, Short.MAX_VALUE)) - ); - - tbpMainTabPane.addTab("Fluff and BattleForce", pnlFluff); - - mnuFile.setText("File"); - mnuFile.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuFileActionPerformed(evt); - } - }); - - mnuNewMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_DOWN_MASK)); - mnuNewMech.setText("New"); - mnuNewMech.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuNewMechActionPerformed(evt); - } - }); - mnuFile.add(mnuNewMech); - - mnuLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_DOWN_MASK)); - mnuLoad.setText("Load"); - mnuLoad.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuLoadActionPerformed(evt); - } - }); - mnuFile.add(mnuLoad); - - mnuOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_DOWN_MASK)); - mnuOpen.setText("Open"); - mnuOpen.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuOpenActionPerformed(evt); - } - }); - mnuFile.add(mnuOpen); - - mnuImport.setText("Import..."); - - mnuImportHMP.setText("from Heavy Metal Pro (HMP)"); - mnuImportHMP.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuImportHMPActionPerformed(evt); - } - }); - mnuImport.add(mnuImportHMP); - - mnuBatchHMP.setText("Batch Import HMP Files"); - mnuBatchHMP.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuBatchHMPActionPerformed(evt); - } - }); - mnuImport.add(mnuBatchHMP); - - mnuFile.add(mnuImport); - mnuFile.add(jSeparator22); - - mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_DOWN_MASK)); - mnuSave.setText("Save"); - mnuSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuSaveActionPerformed(evt); - } - }); - mnuFile.add(mnuSave); - - mnuSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); - mnuSaveAs.setText("Save As..."); - mnuSaveAs.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuSaveAsActionPerformed(evt); - } - }); - mnuFile.add(mnuSaveAs); - - mnuExport.setText("Export As..."); - - mnuExportHTML.setText("to HTML (Web)"); - mnuExportHTML.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportHTMLActionPerformed(evt); - } - }); - mnuExport.add(mnuExportHTML); - - mnuExportMTF.setText("to MTF (MegaMek)"); - mnuExportMTF.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportMTFActionPerformed(evt); - } - }); - mnuExport.add(mnuExportMTF); - - mnuExportTXT.setText("to TXT (Text)"); - mnuExportTXT.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportTXTActionPerformed(evt); - } - }); - mnuExport.add(mnuExportTXT); - - mnuExportClipboard.setText("to Clipboard (Text)"); - mnuExportClipboard.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExportClipboardActionPerformed(evt); - } - }); - mnuExport.add(mnuExportClipboard); - - mnuCreateTCGMech.setText("to TCG Format (Card)"); - mnuCreateTCGMech.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuCreateTCGMechActionPerformed(evt); - } - }); - mnuExport.add(mnuCreateTCGMech); - - mnuFile.add(mnuExport); - mnuFile.add(jSeparator23); - - mnuPrint.setText("Print"); - mnuFile.add(mnuPrint); - - mnuPrintPreview.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); - mnuPrintPreview.setText("Print Preview"); - mnuPrintPreview.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuPrintPreviewActionPerformed(evt); - } - }); - mnuFile.add(mnuPrintPreview); - mnuFile.add(jSeparator24); - - mnuExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_DOWN_MASK)); - mnuExit.setText("Exit"); - mnuExit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuExitActionPerformed(evt); - } - }); - mnuFile.add(mnuExit); - - jMenuBar1.add(mnuFile); - - mnuClearFluff.setText("Tools"); - - mnuSummary.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.ALT_DOWN_MASK)); - mnuSummary.setText("Show Summary"); - mnuSummary.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuSummaryActionPerformed(evt); - } - }); - mnuClearFluff.add(mnuSummary); - - mnuCostBVBreakdown.setText("Cost/BV Breakdown"); - mnuCostBVBreakdown.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuCostBVBreakdownActionPerformed(evt); - } - }); - mnuClearFluff.add(mnuCostBVBreakdown); + //region Battleforce Tab / Conversion Steps + pnlConversionSteps.setBorder(javax.swing.BorderFactory.createTitledBorder("Conversion Steps")); - mnuTextTRO.setText("Show Text TRO Format"); - mnuTextTRO.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuTextTROActionPerformed(evt); - } - }); - mnuClearFluff.add(mnuTextTRO); - mnuClearFluff.add(jSeparator26); + jTextAreaBFConversion.setColumns(60); + jTextAreaBFConversion.setEditable(false); + jTextAreaBFConversion.setRows(5); + scpBFConversion.setViewportView(jTextAreaBFConversion); - mnuBFB.setText("Load Force Balancer"); - mnuBFB.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuBFBActionPerformed(evt); - } - }); - mnuClearFluff.add(mnuBFB); - mnuClearFluff.add(jSeparator27); + GroupLayout jPanel10Layout = new GroupLayout(pnlConversionSteps); + pnlConversionSteps.setLayout(jPanel10Layout); + jPanel10Layout.setHorizontalGroup( + jPanel10Layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addGroup(jPanel10Layout.createSequentialGroup() + .addContainerGap() + .addComponent(scpBFConversion, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + jPanel10Layout.setVerticalGroup( + jPanel10Layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addComponent(scpBFConversion) + ); + //endregion + + //region Battleforce Tab / Layout + JPanel pnlBF = new JPanel(); + pnlBF.setLayout(new BoxLayout(pnlBF, BoxLayout.X_AXIS)); + pnlBF.add(pnlBFStats); + pnlBF.add(pnlConversionSteps); + //pnlBF.add(pnlExport); + tbpMainTabPane.addTab("BattleForce", pnlBF); + //endregion + + //region Menus + + //region File + mnuFile.addActionListener(this::mnuFileActionPerformed); + mnuFile.add(Utils.menuItem("New", this::mnuNewMechActionPerformed, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.ALT_MASK))); + mnuFile.add(Utils.menuItem("Load", this::mnuLoadActionPerformed, KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.ALT_MASK))); + mnuFile.add(Utils.menuItem("Open", this::mnuOpenActionPerformed, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.ALT_MASK))); + + mnuImport.add(Utils.menuItem("from Heavy Metal Pro (HMP)", this::mnuImportHMPActionPerformed)); + mnuImport.add(Utils.menuItem("Batch Import HMP Files", this::mnuBatchHMPActionPerformed)); + mnuFile.add(mnuImport); + mnuFile.add(Utils.etchedSeparator()); + mnuFile.add(Utils.menuItem("Save", this::mnuSaveActionPerformed, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK))); - mnuOptions.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_DOWN_MASK)); - mnuOptions.setText("Preferences"); - mnuOptions.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuOptionsActionPerformed(evt); - } - }); - mnuClearFluff.add(mnuOptions); + mnuSaveAs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK | InputEvent.CTRL_MASK)); + mnuSaveAs.addActionListener(this::mnuSaveAsActionPerformed); + mnuFile.add(mnuSaveAs); - mnuViewToolbar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuExport.add(Utils.menuItem("to HTML (Web)", this::mnuExportHTMLActionPerformed)); + mnuExport.add(Utils.menuItem("to MTF (MegaMek)", this::mnuExportMTFActionPerformed)); + mnuExport.add(Utils.menuItem("to TXT (Text)", this::mnuExportTXTActionPerformed)); + mnuExport.add(Utils.menuItem("to Clipboard (Text)", this::mnuExportClipboardActionPerformed)); + mnuExport.add(Utils.menuItem("to TCG Format (Card)", this::mnuCreateTCGMechActionPerformed)); + mnuFile.add(mnuExport); + mnuFile.add(Utils.etchedSeparator()); + mnuFile.add(Utils.menuItem("Print Preview", this::mnuPrintPreviewActionPerformed, KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK))); + mnuFile.add(Utils.etchedSeparator()); + mnuFile.add(Utils.menuItem("Exit", this::mnuExitActionPerformed, KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK))); + jMenuBar1.add(mnuFile); + //endregion + + //region Tools + mnuClearFluff.add(Utils.menuItem("Show Summary", this::mnuSummaryActionPerformed)); + mnuClearFluff.add(Utils.menuItem("Cost/BV Breakdown", this::mnuCostBVBreakdownActionPerformed)); + mnuClearFluff.add(Utils.menuItem("Show Text TRO Format", this::mnuTextTROActionPerformed)); + mnuClearFluff.add(Utils.etchedSeparator()); + mnuClearFluff.add(Utils.menuItem("Load Force Balancer", this::mnuBFBActionPerformed)); + mnuClearFluff.add(Utils.etchedSeparator()); + mnuClearFluff.add(Utils.menuItem("Preferences", this::mnuOptionsActionPerformed, KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK))); + + mnuViewToolbar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK)); mnuViewToolbar.setSelected(true); - mnuViewToolbar.setText("View Toolbar"); - mnuViewToolbar.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuViewToolbarActionPerformed(evt); - } - }); + mnuViewToolbar.addActionListener(this::mnuViewToolbarActionPerformed); mnuClearFluff.add(mnuViewToolbar); - mnuClearUserData.setText("Clear User Data"); - mnuClearUserData.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuClearUserDataActionPerformed(evt); - } - }); - mnuClearFluff.add(mnuClearUserData); - mnuClearFluff.add(jSeparator30); + mnuClearFluff.add(Utils.menuItem("Clear User Data", this::mnuClearUserDataActionPerformed)); + mnuClearFluff.add(Utils.etchedSeparator()); - mnuUnlock.setText("Unlock Chassis"); mnuUnlock.setEnabled(false); - mnuUnlock.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuUnlockActionPerformed(evt); - } - }); + mnuUnlock.addActionListener(this::mnuUnlockActionPerformed); mnuClearFluff.add(mnuUnlock); - - jMenuItem1.setText("Clear All Fluff"); - jMenuItem1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItem1ActionPerformed(evt); - } - }); - mnuClearFluff.add(jMenuItem1); - - mnuReloadEquipment.setText("Reload Equipment"); - mnuReloadEquipment.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuReloadEquipmentActionPerformed(evt); - } - }); - mnuClearFluff.add(mnuReloadEquipment); - + mnuClearFluff.add(Utils.menuItem("Clear All Fluff", this::jMenuItem1ActionPerformed)); + mnuClearFluff.add(Utils.menuItem("Reload Equipment", this::mnuReloadEquipmentActionPerformed)); jMenuBar1.add(mnuClearFluff); + //endregion - mnuHelp.setText("Help"); - - mnuCredits.setText("Credits"); - mnuCredits.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuCreditsActionPerformed(evt); - } - }); - mnuHelp.add(mnuCredits); - - mnuAboutSSW.setText("About SAW"); - mnuAboutSSW.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - mnuAboutSSWActionPerformed(evt); - } - }); - mnuHelp.add(mnuAboutSSW); - + //region About + mnuHelp.add(Utils.menuItem("Credits", this::mnuCreditsActionPerformed)); + mnuHelp.add(Utils.menuItem("About SAW", this::mnuAboutSSWActionPerformed)); jMenuBar1.add(mnuHelp); + //endregion setJMenuBar(jMenuBar1); + //endregion - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + //region Form Layout + GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(tlbIconBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlInfoPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(tbpMainTabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 1280, javax.swing.GroupLayout.PREFERRED_SIZE) + layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) + .addComponent(tlbIconBar, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pnlInfoPane, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tbpMainTabPane, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + layout.createParallelGroup(GroupLayout.Alignment.LEADING, true) .addGroup(layout.createSequentialGroup() - .addComponent(tlbIconBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(2, 2, 2) - .addComponent(tbpMainTabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 493, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(24, Short.MAX_VALUE)) + .addComponent(tlbIconBar, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(tbpMainTabPane) + .addComponent(pnlInfoPane, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) ); + //endregion pack(); - }// //GEN-END:initComponents + } + + private JButton OmniButton(JButton button, ActionListener listener) { + button.setEnabled(false); + button.setPreferredSize(new Dimension(120, 23)); + button.addActionListener(listener); + return button; + } + + private JPanel ArmorLocation(String title, JLabel label, JSpinner spinner, ChangeListener listener) { + JPanel pnl = new JPanel(); + pnl.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), title)); + pnl.setLayout(new java.awt.GridBagLayout()); + label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + label.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); + label.setPreferredSize(new Dimension(45, 20)); + pnl.add(label, Utils.gridBag(0, 1)); + pnl.add(new JLabel("Internal"), new GridBagConstraints()); + pnl.add(new JLabel("Armor"), Utils.gridBag(0, 2)); + spinner.setPreferredSize(new Dimension(45, 20)); + spinner.addChangeListener(listener); + pnl.add(spinner, Utils.gridBag(0, 3)); + return pnl; + } + + private JPanel EquipmentLocation(JList list, ListSelectionListener selection, MouseListener listener, AbstractListModel display) { + JPanel panel = new JPanel(); + list.setModel(display); + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + list.addListSelectionListener(selection); + list.addMouseListener( listener ); + list.setCellRenderer( new EquipmentListRenderer( this ) ); + JScrollPane pane = new JScrollPane(); + pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + pane.setViewportView(list); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(pane); + return panel; + } + + private JPanel DataEntry(String label, JTextField input, MouseListener listener) { + JPanel entry = new JPanel(); + entry.setLayout(new BoxLayout(entry, BoxLayout.X_AXIS)); + + JLabel dataLabel = new JLabel(); + dataLabel.setText(label); + dataLabel.setHorizontalAlignment(SwingConstants.RIGHT); + dataLabel.setPreferredSize(new Dimension(150, 20)); + + input.setFont(new java.awt.Font("Arial", Font.PLAIN, 11)); + input.addMouseListener(listener); + + entry.add(dataLabel); + entry.add(input); + + return entry; + } private void RefreshSummary() { // refreshes the display completely using info from the mech. @@ -5151,7 +2758,8 @@ private void RefreshSummary() { txtSumConTons.setText("" + CurVee.GetControls() ); txtSumTurTons.setText("" + CurVee.GetLoadout().GetTurret().GetTonnage() ); txtSumTurAV.setText( CurVee.GetLoadout().GetTurret().GetAvailability().GetBestCombinedCode() ); - txtTurretInfo.setText("Turret: " + CurVee.GetLoadout().GetTurret().GetTonnage() ); + txtTurretInfo.setText( "Turret: " + CurVee.GetLoadout().GetTurret().GetTonnageText() ); + txtRearTurretInfo.setText( "Rear Turret: " + CurVee.GetLoadout().GetRearTurret().GetTonnageText() ); txtSumRTuTons.setText("" + CurVee.GetLoadout().GetRearTurret().GetTonnage() ); txtSumRTuAV.setText( CurVee.GetLoadout().GetRearTurret().GetAvailability().GetBestCombinedCode() ); txtSumSpnTons.setText("" + CurVee.GetLoadout().GetSponsonTurretTonnage() ); @@ -5213,7 +2821,7 @@ private void RefreshSummary() { private void RecalcArmorPlacement() { if ( Load ) return; - + double tonnage = CurVee.GetArmor().GetTonnage(); ArmorTons.SetArmorTonnage( tonnage ); try { @@ -5230,54 +2838,49 @@ private void RecalcArmorPlacement() { RefreshSummary(); RefreshInfoPane(); } - + private void RecalcArmorLocations() { - pnlRotorArmor.setVisible(false); - if ( cmbTurret.getSelectedItem().toString().equals("No Turret") ) { - spnTurretArmor.setValue(0); - spnRearTurretArmor.setValue(0); - pnlTurretArmor.setVisible(false); - pnlRearTurretArmor.setVisible(false); - } else if ( cmbTurret.getSelectedItem().toString().equals("Single Turret") ) { - pnlTurretArmor.setVisible(true); - spnRearTurretArmor.setValue(0); - pnlRearTurretArmor.setVisible(false); + spnTurretArmor.setValue(0); + spnRearTurretArmor.setValue(0); + pnlTurretArmor.setVisible(false); + pnlRearTurretArmor.setVisible(false); + } else if ( cmbTurret.getSelectedItem().toString().equals("Single Turret")) { + pnlTurretArmor.setVisible(true); + spnRearTurretArmor.setValue(0); + pnlRearTurretArmor.setVisible(false); + } else if (cmbTurret.getSelectedItem().toString().equals("Chin Turret")) { + pnlTurretArmor.setVisible(true); + spnRearTurretArmor.setValue(0); + pnlRearTurretArmor.setVisible(false); } else if ( cmbTurret.getSelectedItem().toString().equals("Dual Turret") ) { - pnlTurretArmor.setVisible(true); - pnlRearTurretArmor.setVisible(true); + pnlTurretArmor.setVisible(true); + pnlRearTurretArmor.setVisible(true); } - if ( CurVee.IsVTOL() ) + if ( CurVee.IsVTOL() ) { pnlRotorArmor.setVisible(true); - else + } else { + pnlRotorArmor.setVisible(false); spnRotorArmor.setValue(0); + } } + private void SolidifyVehicle() { // sets some of the basic vehicle information normally kept in the GUI and // prepares the vehicle for saving to file - int year = 0; + int year; CurVee.setName( txtVehicleName.getText() ); CurVee.setModel( txtModel.getText() ); if( txtProdYear.getText().isEmpty() ) { - switch( cmbEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.setYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.setYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.setYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.setYear( 3132, false ); - break; + year = CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ); + if( year != 0 ) { + CurVee.SetYear( year, false ); + txtProdYear.setText( "" + year ); } - txtProdYear.setText(""+CurVee.getYear()); } else { try{ year = Integer.parseInt( txtProdYear.getText() ) ; - CurVee.setYear( year, true ); + CurVee.SetYear( year, true ); } catch( NumberFormatException n ) { Media.Messager( this, "The production year is not a number." ); tbpMainTabPane.setSelectedComponent( pnlBasicSetup ); @@ -5306,8 +2909,6 @@ private void SolidifyVehicle() { } private void BuildLocationSelector() { - int curSelection = Math.max(cmbLocation.getSelectedIndex(), 0); - ArrayList locs = new ArrayList(); locs.add("Front"); locs.add("Left"); @@ -5320,13 +2921,17 @@ private void BuildLocationSelector() { locs.add("Body"); if ( CurVee.isHasTurret1() ) locs.add("Turret"); - if ( CurVee.isHasTurret2() ) + if ( CurVee.isHasTurret2() ) locs.add("Rear Turret"); - + cmbLocation.setModel(new DefaultComboBoxModel(locs.toArray())); + int curSelection = cmbLocation.getSelectedIndex(); + if ( curSelection < 0 || curSelection >= locs.size()) { + curSelection = 0; // reset to Front + } cmbLocation.setSelectedIndex(curSelection); } - + private void BuildArmorSelector() { // builds the armor selection box ArrayList list = new ArrayList(); @@ -5348,7 +2953,7 @@ private void BuildArmorSelector() { // now set the armor chooser cmbArmorType.setModel( new javax.swing.DefaultComboBoxModel( temp ) ); - + cmbArmorType.setSelectedItem(CurVee.GetArmor().ActualName()); } @@ -5402,7 +3007,7 @@ private void FixArmorSpinners() { // fixes the armor spinners to match the new tonnage / motive type CVArmor a = CurVee.GetArmor(); a.SetMaxArmor(CurVee.GetArmorableLocationCount()); - + spnFrontArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_FRONT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_FRONT), 1) ); spnLeftArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_LEFT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_LEFT), 1) ); spnRightArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.CV_LOC_RIGHT ), 0, a.GetLocationMax(LocationIndex.CV_LOC_RIGHT), 1) ); @@ -5416,8 +3021,10 @@ private void FixArmorSpinners() { ((JSpinner.DefaultEditor)spnCruiseMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnJumpMP.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnHeatSinks.getEditor()).getTextField().addFocusListener(spinners); - - //Setup Spinner focus + + ((JSpinner.DefaultEditor)spnTurretTonnage.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnRearTurretTonnage.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnFrontArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnLeftArmor.getEditor()).getTextField().addFocusListener(spinners); ((JSpinner.DefaultEditor)spnRightArmor.getEditor()).getTextField().addFocusListener(spinners); @@ -5446,22 +3053,23 @@ public String BuildLookupName( ifState s ) { public void FixTonnageSpinner( int MinTonnage, int MaximumTonnage ) { int CurVal = Integer.parseInt(spnTonnage.getValue().toString()); - + if ( CurVal < MinTonnage ) CurVal = MinTonnage; - + if ( CurVal > MaximumTonnage ) CurVal = MaximumTonnage; spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVal, MinTonnage, MaximumTonnage, 1) ); spnTonnageStateChanged(null); } + // check the tonnage to see if it's legal and acts accordingly public void CheckTonnage( boolean RulesChange ) { if( CurVee.GetTonnage() < 1 ) { spnTonnage.setValue(1); } - + if ( CurVee.GetTonnage() > CurVee.GetMaxTonnage() ) { spnTonnage.setValue(CurVee.GetMaxTonnage()); } @@ -5480,15 +3088,21 @@ private void LoadSelections() { cmbArmorType.setSelectedItem( Selections[1] ); } - private void BuildTurretSelector() - { + private void BuildTurretSelector() { ArrayList list = new ArrayList(); - if ( !CurVee.IsOmni()) + if ( !CurVee.IsOmni()) { cmbTurret.setEnabled(true); + } list.add("No Turret"); - if ( CurVee.CanUseTurret() ) list.add("Single Turret"); + if ( CurVee.CanUseTurret() ) { + if (CurVee.IsVTOL()) { + list.add("Chin Turret"); + } else{ + list.add("Single Turret"); + } + } if ( CurVee.CanUseDualTurret() ) list.add("Dual Turret"); if ( list.isEmpty() ) { @@ -5512,8 +3126,7 @@ else if (CurVee.isHasTurret1()) cmbTurret.setSelectedItem("No Turret"); } - private void BuildChassisSelector() - { + private void BuildChassisSelector() { chkFlotationHull.setSelected(false); chkLimitedAmph.setSelected(false); chkFullAmph.setSelected(false); @@ -5564,16 +3177,14 @@ private void BuildChassisSelector() chkEnviroSealing.setEnabled(false); } } - - private void BuildExpEquipmentSelector() { - JCheckBox[] ExpEquipmentCheckboxes = { chkArmoredMotive, - chkSupercharger, - chkCommandConsole, + + private void BuildExpEquipmentSelector() { + JCheckBox[] ExpEquipmentCheckboxes = { chkCommandConsole, chkMinesweeper, - chkJetBooster, chkEscapePod, chkSponsonTurret }; if (cmbRulesLevel.getSelectedIndex() > 1) { + if (CurVee.CanUseSponson()) chkSponsonTurret.setEnabled(true); } else @@ -5663,7 +3274,9 @@ private void ShowInfoOn( abPlaceable p ) { default: lblInfoRulesLevel.setText( "??" ); } - lblInfoName.setText( p.CritName() ); + + pnlEquipInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), p.CritName())); + //lblInfoName.setText( p.CritName() ); lblInfoTonnage.setText( "" + p.GetTonnage() ); lblInfoCrits.setText( "" + p.NumCVSpaces() ); lblInfoCost.setText( "" + String.format( "%1$,.0f", p.GetCost() ) ); @@ -5823,19 +3436,18 @@ private void ShowInfoOn( abPlaceable p ) { lblInfoMountRestrict.setText( "None" ); } - lblInfoMountRestrict.setText(lblInfoMountRestrict.getText() + " MM Name " + p.MegaMekName(false)); + lblMMNameInfo.setText(p.MegaMekName(false)); } - private void btnAddToForceListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddToForceListActionPerformed - -}//GEN-LAST:event_btnAddToForceListActionPerformed + private void btnAddToForceListActionPerformed(java.awt.event.ActionEvent evt) { + } - private void btnForceListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnForceListActionPerformed + private void btnForceListActionPerformed(java.awt.event.ActionEvent evt) { GetForceDialogue().setLocationRelativeTo(this); GetForceDialogue().setVisible(true); -}//GEN-LAST:event_btnForceListActionPerformed + } - private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed + private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { setCursor( Hourglass ); File savevee = GetSaveFile( "saw", Prefs.get( "LastOpenCVDirectory", "" ), true, false ); @@ -5843,7 +3455,7 @@ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor( NormalCursor ); return; } - + //Since we are saving to a new file update the stored prefs try { Prefs.put("LastOpenCVDirectory", savevee.getCanonicalPath().replace(savevee.getName(), "")); @@ -5889,7 +3501,8 @@ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor( NormalCursor ); setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); CurVee.SetChanged( false ); - }//GEN-LAST:event_btnSaveActionPerformed + } + private void SaveOmniFluffInfo() { if( SetSource ) { CurVee.setSource( txtSource.getText() ); @@ -5900,23 +3513,7 @@ private void SaveOmniFluffInfo() { CurVee.SetYear( Integer.parseInt( txtProdYear.getText() ), chkYearRestrict.isSelected() ); } catch( Exception e ) { // nothing really to be done, set it to a default. - switch( cmbEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.SetYear( 3132, false ); - break; - case AvailableCode.ERA_ALL: - CurVee.SetYear( 0, false ); - break; - } + CurVee.SetYear( CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ), false ); } } } @@ -5926,12 +3523,12 @@ private void LoadOmniFluffInfo() { cmbEra.setSelectedIndex( CurVee.GetEra() ); cmbProductionEra.setSelectedIndex( CurVee.GetProductionEra() ); txtSource.setText( CurVee.getSource() ); - txtProdYear.setText( "" + CurVee.GetYear() ); + txtProdYear.setText( CurVee.YearWasSpecified() ? "" + CurVee.GetYear() : "" ); BuildTechBaseSelector(); } private File GetSaveFile( final String extension, String path, boolean autooverwrite, boolean singleloadout ) { - String filename = ""; + String filename; boolean overwrite = false; // perform standard actions required before saving @@ -5980,7 +3577,7 @@ private File GetSaveFile( final String extension, String path, boolean autooverw } } - File retval = null; + File retval; if( autooverwrite && overwrite ) { retval = new File( path + File.separator + filename ); } else { @@ -5997,11 +3594,7 @@ public boolean accept( File f ) { String checkext = Utils.getExtension( f ); if( checkext != null ) { - if( checkext.equals( extension ) ) { - return true; - } else { - return false; - } + return checkext.equals(extension); } return false; } @@ -6070,24 +3663,43 @@ private boolean VerifyVehicle( ActionEvent evt ) { //} // ensure we're not overweight + ArrayList loadouts = new ArrayList<>(); if( CurVee.IsOmni() ) { - ArrayList v = CurVee.GetLoadouts(); - for( int i = 0; i < v.size(); i++ ) { - CurVee.SetCurLoadout( ((ifCVLoadout) v.get( i )).GetName() ); - if( CurVee.GetCurrentTons() > CurVee.GetTonnage() ) { - Media.Messager( this, ((ifCVLoadout) v.get( i )).GetName() + - " loadout is overweight. Reduce the weight\nto equal or below the Vehicle's tonnage." ); - //cmbOmniVariant.setSelectedItem( ((ifCVLoadout) v.get( i )).GetName() ); - //cmbOmniVariantActionPerformed( evt ); - tbpMainTabPane.setSelectedComponent( pnlBasicSetup ); - SetSource = true; - return false; - } - } + loadouts.addAll( CurVee.GetLoadouts() ); } else { + loadouts.add( null ); + } + for( ifCVLoadout loadout : loadouts ) { + String name; + JPanel panel; + if( loadout == null ) { + name = "This Vehicle"; + panel = pnlBasicSetup; + } else { + name = loadout.GetName() + " loadout"; + CurVee.SetCurLoadout( loadout.GetName() ); + panel = pnlEquipment; + } if( CurVee.GetCurrentTons() > CurVee.GetTonnage() ) { - Media.Messager( this, "This Vehicle is overweight. Reduce the weight to\nequal or below the Vehicle's tonnage." ); - tbpMainTabPane.setSelectedComponent( pnlBasicSetup ); + Media.Messager( this, name + " is overweight.\n" + + "Reduce the weight to equal or below the Vehicle's tonnage." ); + tbpMainTabPane.setSelectedComponent( panel ); + SetSource = true; + return false; + } + Turret turret = CurVee.GetLoadout().GetTurret(); + if( turret.isTonnageSet() && turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + Media.Messager( this, name + "'s turret is overweight.\n" + + "Reduce the turret's weight to equal or below its max tonnage." ); + tbpMainTabPane.setSelectedComponent( panel ); + SetSource = true; + return false; + } + turret = CurVee.GetLoadout().GetRearTurret(); + if( turret.isTonnageSet() && turret.GetTonnageFromItems() > turret.GetMaxTonnage() ) { + Media.Messager( this, name + "'s rear turret is overweight.\n" + + "Reduce the rear turret's weight to equal or below its max tonnage." ); + tbpMainTabPane.setSelectedComponent( panel ); SetSource = true; return false; } @@ -6125,11 +3737,11 @@ private void RecalcEngine() { String OldVal = BuildLookupName( CurVee.GetEngine().GetCurrentState() ); String LookupVal = (String) cmbEngineType.getSelectedItem(); if( OldVal.equals( LookupVal ) ) { return; } - ifVisitor v = (ifVisitor) CurVee.Lookup( LookupVal ); + ifVisitor v = CurVee.Lookup( LookupVal ); try { CurVee.Visit( v ); } catch( Exception e ) { - v = (ifVisitor) CurVee.Lookup( OldVal ); + v = CurVee.Lookup( OldVal ); try { Media.Messager( this, "The new engine type is not valid. Error:\n" + e.getMessage() + "\nReverting to the previous engine." ); CurVee.Visit( v ); @@ -6138,28 +3750,31 @@ private void RecalcEngine() { // wow, second one? Get a new 'Mech. Media.Messager( this, "Fatal error while attempting to revert to the old engine:\n" + e.getMessage() + "\nStarting over with a new Vehicle. Sorry." ); GetNewVee(); - return; } } } private void GetNewVee() { boolean Omni = CurVee.IsOmni(); - + + quirks = new ArrayList(); CurVee = new CombatVehicle(); spnTonnage.setModel(new SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1)); spnCruiseMP.setModel(new SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1)); spnHeatSinks.setModel(new SpinnerNumberModel(CurVee.GetHeatSinks().GetNumHS(), 0, 50, 1)); - + cmbMotiveType.setSelectedIndex( 0 ); chkYearRestrict.setSelected( false ); txtProdYear.setText( "" ); + txtProdYear.setEnabled( true ); cmbEra.setEnabled( true ); cmbProductionEra.setEnabled( true ); cmbTechBase.setEnabled( true ); cmbTurret.setSelectedIndex(0); spnTurretTonnage.setModel(new SpinnerNumberModel(0.0, 0.0, 50.0, 0.5)); - txtProdYear.setEnabled( true ); + spnRearTurretTonnage.setModel(new SpinnerNumberModel(0.0, 0.0, 50.0, 0.5)); + + cmbOmniVariant.setModel( new DefaultComboBoxModel( new String[0] ) ); cmbRulesLevel.setSelectedItem( Prefs.get( "NewVee_RulesLevel", "Tournament Legal" ) ); cmbEra.setSelectedItem( Prefs.get( "NewVee_Era", "Age of War/Star League" ) ); @@ -6171,6 +3786,9 @@ private void GetNewVee() { chkFullAmph.setSelected(false); chkDuneBuggy.setSelected(false); chkEnviroSealing.setSelected(false); + chkTrailer.setSelected(false); + chkSupercharger.setSelected(false); + chkJetBooster.setSelected(false); if( Omni ) { UnlockGUIFromOmni(); @@ -6179,24 +3797,8 @@ private void GetNewVee() { CurVee.SetEra( cmbEra.getSelectedIndex() ); CurVee.SetProductionEra( cmbProductionEra.getSelectedIndex() ); CurVee.SetRulesLevel( cmbRulesLevel.getSelectedIndex() ); - switch( CurVee.GetEra() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.SetYear( 3130, false ); - break; - case AvailableCode.ERA_ALL: - CurVee.SetYear( 0, false ); - break; - } - + CurVee.SetYear( CommonTools.GetEraDefaultYear( CurVee.GetEra() ), false ); + cmbTechBase.setSelectedItem( Prefs.get( "NewVee_Techbase", "Inner Sphere" ) ); switch( cmbTechBase.getSelectedIndex() ) { case AvailableCode.TECH_INNER_SPHERE: @@ -6223,10 +3825,9 @@ private void GetNewVee() { BuildChassisSelector(); BuildEngineSelector(); BuildArmorSelector(); + BuildTurretSelector(); BuildExpEquipmentSelector(); CheckOmni(); - //cmbEngineType.setSelectedItem( saw.Constants.DEFAULT_ENGINE ); - //cmbArmorType.setSelectedItem( saw.Constants.DEFAULT_ARMOR ); FixMPSpinner(); FixJJSpinnerModel(); FixArmorSpinners(); @@ -6237,6 +3838,8 @@ private void GetNewVee() { SetWeaponChoosers(); ResetAmmo(); + tblQuirks.setModel(new tbQuirks(new ArrayList())); + Overview.StartNewDocument(); Capabilities.StartNewDocument(); History.StartNewDocument(); @@ -6257,6 +3860,7 @@ private void GetNewVee() { //Reset Manufacturers tblWeaponManufacturers.setModel( new javax.swing.table.AbstractTableModel() { + @Override public String getColumnName( int col ) { if( col == 1 ) { @@ -6268,20 +3872,18 @@ public String getColumnName( int col ) { public int getRowCount() { return CurVee.GetLoadout().GetEquipment().size(); } public int getColumnCount() { return 2; } public Object getValueAt( int row, int col ) { + if (CurVee.GetLoadout().GetEquipment().isEmpty()) { return null; } + if (CurVee.GetLoadout().GetEquipment().size() <= row) { return null; } Object o = CurVee.GetLoadout().GetEquipment().get( row ); if( col == 1 ) { - return ((abPlaceable) o).GetManufacturer(); + return CommonTools.UnknownToEmpty( ((abPlaceable) o).GetManufacturer() ); } else { return ((abPlaceable) o).CritName(); } } @Override public boolean isCellEditable( int row, int col ) { - if( col == 0 ) { - return false; - } else { - return true; - } + return col != 0; } @Override public void setValueAt( Object value, int row, int col ) { @@ -6293,11 +3895,11 @@ public void setValueAt( Object value, int row, int col ) { // fireTableCellUpdated( row, col ); //} else { ArrayList v = CurVee.GetLoadout().GetEquipment(); - for( int i = 0; i < v.size(); i++ ) { - if( FileCommon.LookupStripArc( ((abPlaceable) v.get( i )).LookupName() ).equals( FileCommon.LookupStripArc( a.LookupName() ) ) ) { - ((abPlaceable) v.get( i )).SetManufacturer( (String) value ); - } + for (Object o : v) { + if (FileCommon.LookupStripArc(((abPlaceable) o).LookupName()).equals(FileCommon.LookupStripArc(a.LookupName()))) { + ((abPlaceable) o).SetManufacturer((String) value); } + } fireTableDataChanged(); //} } @@ -6325,139 +3927,35 @@ private void CheckOmni() { // now let's ensure that all the omni controls are enabled or disabled // as appropriate - if( chkOmniVee.isEnabled() ) { - if( chkOmniVee.isSelected() ) { - //btnLockChassis.setEnabled( true ); - } else { - //btnLockChassis.setEnabled( false ); - } - } else { - //btnLockChassis.setEnabled( false ); - } + btnLockChassis.setEnabled( chkOmniVee.isEnabled() && chkOmniVee.isSelected() ); } + private void RefreshEquipment() { // refreshes the equipment selectors //fix the CASE control CASE Case = new CASE(); - if ( CommonTools.IsAllowed( Case.GetAvailability(), CurVee) || CurVee.GetTechBase() == AvailableCode.TECH_CLAN ) { - chkClanCASE.setEnabled(true); - } else { - chkClanCASE.setSelected(false); - chkClanCASE.setEnabled(false); - } + setCheckbox(chkCASE, ( CommonTools.IsAllowed( Case.GetAvailability(), CurVee) || CurVee.GetTechBase() == AvailableCode.TECH_CLAN ), CurVee.GetLoadout().HasCase(), CurVee.isOmni()); // fix Artemis IV controls ifMissileGuidance ArtCheck = new ArtemisIVFCS( null ); - if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { - chkFCSAIV.setEnabled( true ); - } else { - chkFCSAIV.setSelected( false ); - chkFCSAIV.setEnabled( false ); - } + setCheckbox(chkFCSAIV, ( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ), CurVee.UsingArtemisIV(), CurVee.isOmni()); // fix Artemis V controls ArtCheck = new ArtemisVFCS( null ); - if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { - chkFCSAV.setEnabled( true ); - } else { - chkFCSAV.setSelected( false ); - chkFCSAV.setEnabled( false ); - } + setCheckbox(chkFCSAV, ( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ), CurVee.UsingArtemisV(), CurVee.isOmni()); - // fix Artemis IV controls + // fix ApolloFCS controls ArtCheck = new ApolloFCS( null ); - if( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ) { - chkFCSApollo.setEnabled( true ); - } else { - chkFCSApollo.setSelected( false ); - chkFCSApollo.setEnabled( false ); - } + setCheckbox(chkFCSApollo, ( CommonTools.IsAllowed( ArtCheck.GetAvailability(), CurVee ) ), CurVee.UsingApollo(), CurVee.isOmni()); // fix the targeting computer display - if( CommonTools.IsAllowed( CurVee.GetTC().GetAvailability(), CurVee ) ) { - chkUseTC.setEnabled( true ); - if( CurVee.UsingTC() ) { - chkUseTC.setSelected( true ); - } else { - chkUseTC.setSelected( false ); - } - } else { - chkUseTC.setSelected( false ); - chkUseTC.setEnabled( false ); - } - - // check all multi-slot systems - if( CommonTools.IsAllowed( CurVee.GetBlueShield().GetAvailability(), CurVee ) ) { - //chkBSPFD.setEnabled( true ); - } else { - //chkBSPFD.setEnabled( false ); - //chkBSPFD.setSelected( false ); - } - if( CommonTools.IsAllowed( CurVee.GetLoadout().GetSupercharger().GetAvailability(), CurVee ) ) { - chkSupercharger.setEnabled( true ); - } else { - chkSupercharger.setEnabled( false ); - } + setCheckbox(chkUseTC, ( CommonTools.IsAllowed( CurVee.GetTC().GetAvailability(), CurVee ) ), CurVee.UsingTC(), CurVee.isOmni()); - // now set all the equipment if needed - if( ! chkFCSAIV.isEnabled() ) { - try { - CurVee.SetFCSArtemisIV( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - chkFCSAIV.setSelected( false ); - } else { - if( CurVee.UsingArtemisIV() ) { - chkFCSAIV.setSelected( true ); - } else { - chkFCSAIV.setSelected( false ); - } - } - if( ! chkFCSAV.isEnabled() ) { - try { - CurVee.SetFCSArtemisV( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - chkFCSAV.setSelected( false ); - } else { - if( CurVee.UsingArtemisV() ) { - chkFCSAV.setSelected( true ); - } else { - chkFCSAV.setSelected( false ); - } - } - if( ! chkFCSApollo.isEnabled() ) { - try { - CurVee.SetFCSApollo( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - chkFCSApollo.setSelected( false ); - } else { - if( CurVee.UsingApollo() ) { - chkFCSApollo.setSelected( true ); - } else { - chkFCSApollo.setSelected( false ); - } - } - if( ! chkSupercharger.isEnabled() ) { - try { - CurVee.GetLoadout().SetSupercharger( false ); - } catch( Exception e ) { - Media.Messager( this, e.getMessage() ); - } - } else { - if( CurVee.GetLoadout().HasSupercharger() ) { - chkSupercharger.setSelected( true ); - } else { - chkSupercharger.setSelected( false ); - } - } + setCheckbox(chkSupercharger, ( CommonTools.IsAllowed( CurVee.GetLoadout().GetSupercharger().GetAvailability(), CurVee ) && !CurVee.IsVTOL() ), CurVee.GetLoadout().HasSupercharger(), CurVee.isOmni()); + setCheckbox(chkJetBooster, ( CommonTools.IsAllowed( CurVee.GetLoadout().GetVTOLBooster().GetAvailability(), CurVee ) && CurVee.IsVTOL() && !CurVee.IsOmni() ), CurVee.GetLoadout().HasVTOLBooster(), CurVee.isOmni()); + setCheckbox(chkArmoredMotive, ( CommonTools.IsAllowed( CurVee.GetLoadout().GetArmoredMotiveSystem().GetAvailability(), CurVee ) && !CurVee.IsVTOL() ), CurVee.GetLoadout().HasArmoredMotiveSystem(), CurVee.isOmni()); if( ! chkUseTC.isEnabled() ) { CurVee.UseTC( false, false ); } - chkClanCASE.setSelected( CurVee.GetLoadout().HasISCASE() ); if( CurVee.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { chkFractional.setEnabled( true ); @@ -6470,25 +3968,34 @@ private void RefreshEquipment() { if( CurVee.IsOmni() ) { // these items can only be loaded into the base chassis, so they // are always locked for an Omni (although they may be checked). - //chkBSPFD.setEnabled( false ); chkEnviroSealing.setEnabled( false ); chkCommandConsole.setEnabled( false ); + chkJetBooster.setEnabled(false); - // now see if we have a supercharger on the base chassis + //These items can be selected on the base or variants but if the base + //has them disable and mark as selected if( CurVee.GetBaseLoadout().HasSupercharger() ) { chkSupercharger.setEnabled( false ); + chkSupercharger.setSelected( true ); } - } else { - try { - //if( ! chkBSPFD.isEnabled() ) { locArmor.SetBlueShield( false ); } - //if( ! chkCommandConsole.isEnabled() ) { locArmor.SetCommandConsole( false ); } - } catch( Exception e ) { - // we should never get this, but report it if we do - Media.Messager( this, e.getMessage() ); + if( CurVee.GetBaseLoadout().HasCase() ) { + chkCASE.setEnabled( false ); + chkCASE.setSelected( true ); } } } + private void Log(String message) { + txtLog.append(message + "\n"); + } + + private void setCheckbox(JCheckBox element, Boolean isEnabled, Boolean isSelected, Boolean allowSelection) { + element.setEnabled(isEnabled); + element.setSelected(false); + if (isEnabled || allowSelection) { + element.setSelected(isSelected); + } + } private void SetWeaponChoosers() { // sets the weapon choosers up. first, get the user's choices. @@ -6501,7 +4008,7 @@ private void SetWeaponChoosers() { Equipment[ARTILLERY] = data.GetEquipment().GetArtillery( CurVee ); Equipment[EQUIPMENT] = data.GetEquipment().GetEquipment( CurVee ); Equipment[AMMUNITION] = new Object[] { " " }; - if( CurVee.GetLoadout().GetNonCore().toArray().length <= 0 ) { + if(CurVee.GetLoadout().GetNonCore().toArray().length == 0) { Equipment[SELECTED] = new Object[] { " " }; } else { Equipment[SELECTED] = CurVee.GetLoadout().GetNonCore().toArray(); @@ -6523,7 +4030,7 @@ private void SetWeaponChoosers() { lstSelectedEquipment.setListData( Equipment[SELECTED] ); lstChooseArtillery.setListData( Equipment[ARTILLERY] ); lstSelectedEquipment.repaint(); - + ResetAmmo(); } @@ -6531,8 +4038,7 @@ private void UnlockGUIFromOmni() { // this should be used anytime a new mech is made or when unlocking // an Omni. isLocked = false; - - chkOmniVee.setSelected( false ); + chkOmniVee.setEnabled( true ); mnuUnlock.setEnabled( false ); cmbMotiveType.setEnabled( true ); @@ -6540,6 +4046,7 @@ private void UnlockGUIFromOmni() { cmbEngineType.setEnabled( true ); cmbTurret.setEnabled( true ); spnTurretTonnage.setEnabled( true ); + spnRearTurretTonnage.setEnabled( true ); spnFrontArmor.setEnabled( true ); spnLeftArmor.setEnabled( true ); spnRightArmor.setEnabled( true ); @@ -6554,17 +4061,14 @@ private void UnlockGUIFromOmni() { chkTrailer.setEnabled( true ); //btnEfficientArmor.setEnabled( true ); //btnBalanceArmor.setEnabled( true ); - //btnLockChassis.setEnabled( true ); chkFCSAIV.setEnabled( true ); chkFCSAV.setEnabled( true ); chkFCSApollo.setEnabled( true ); - chkOmniVee.setSelected( false ); - chkOmniVee.setEnabled( true ); - btnLockChassis.setEnabled( true ); + btnLockChassis.setEnabled( chkOmniVee.isSelected() ); spnCruiseMP.setEnabled( true ); chkYearRestrict.setEnabled( true ); - //chkBSPFD.setEnabled( true ); chkSupercharger.setEnabled( true ); + chkJetBooster.setEnabled(true); chkEnviroSealing.setEnabled( false ); // now enable the Omni controls cmbOmniVariant.setEnabled( false ); @@ -6609,6 +4113,7 @@ private void RecalcArmor() { } SetPatchworkArmor(); } + private boolean AddECM() { // Adds an ECM suite if a certain system needs it if( Prefs.getBoolean( "AutoAddECM", true ) ) { @@ -6635,11 +4140,10 @@ private boolean AddECM() { return false; } } - return true; } else { Media.Messager( this, "Please add an appropriate ECM Suite to complement this\n system. The Vehicle is not valid without an ECM Suite." ); - return true; } + return true; } private void SetPatchworkArmor() { @@ -6749,7 +4253,7 @@ private void RecalcEquipment() { clan = true; } } - + private void FixHeatSinkSpinnerModel() { // mainly provided for Omnis. if( CurVee.IsOmni() ) { @@ -6763,7 +4267,7 @@ private void FixHeatSinkSpinnerModel() { ((JSpinner.DefaultEditor)spnHeatSinks.getEditor()).getTextField().addFocusListener(spinners); } - private void btnNewVeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewVeeActionPerformed + private void btnNewVeeActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION ); @@ -6771,12 +4275,12 @@ private void btnNewVeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR } GetNewVee(); Prefs.put("Currentfile", ""); - }//GEN-LAST:event_btnNewVeeActionPerformed + } private void RefreshOmniVariants() { ArrayList v = CurVee.GetLoadouts(); String[] variants = new String[v.size()]; - if( v.size() <= 0 ) { + if(v.size() == 0) { variants = new String[] { common.Constants.BASELOADOUT_NAME }; } else { for( int i = 0; i < v.size(); i++ ) { @@ -6795,49 +4299,22 @@ private void RefreshOmniChoices() { // equipment it has loaded. CheckEquipment(); } - + private void CheckEquipment() { // consolidating some code here. - if( CurVee.UsingArtemisIV() ) { - chkFCSAIV.setSelected( true ); - } else { - chkFCSAIV.setSelected( false ); - } - if( CurVee.UsingArtemisV() ) { - chkFCSAV.setSelected( true ); - } else { - chkFCSAV.setSelected( false ); - } - if( CurVee.UsingApollo() ) { - chkFCSApollo.setSelected( true ); - } else { - chkFCSApollo.setSelected( false ); - } - - if( CurVee.UsingTC() ) { - chkUseTC.setSelected( true ); - } else { - chkUseTC.setSelected( false ); - } - - - if( CurVee.GetLoadout().HasSupercharger() ) { - chkSupercharger.setSelected( true ); - } else { - chkSupercharger.setSelected( false ); - } - if( CurVee.GetLoadout().HasISCASE() ) { - chkClanCASE.setSelected( true ); - } else { - chkClanCASE.setSelected( false ); - } + chkFCSAIV.setSelected( CurVee.UsingArtemisIV() ); + chkFCSAV.setSelected( CurVee.UsingArtemisV() ); + chkFCSApollo.setSelected( CurVee.UsingApollo() ); + chkUseTC.setSelected( CurVee.UsingTC() ); + chkJetBooster.setSelected( CurVee.GetBaseLoadout().HasVTOLBooster() ); + chkSupercharger.setSelected( CurVee.GetBaseLoadout().HasSupercharger() ); + chkCASE.setSelected( CurVee.GetLoadout().HasCase() ); } - + private void LockGUIForOmni() { - // this locks most of the GUI controls. Used mainly by Omnimechs. + // this locks most of the GUI controls. Used mainly by OmniVehichles. isLocked = true; - - chkOmniVee.setSelected( true ); + chkOmniVee.setEnabled( false ); mnuUnlock.setEnabled( true ); spnTonnage.setEnabled( false ); @@ -6845,6 +4322,7 @@ private void LockGUIForOmni() { cmbEngineType.setEnabled( false ); cmbTurret.setEnabled( false ); spnTurretTonnage.setEnabled( false ); + spnRearTurretTonnage.setEnabled( false ); spnFrontArmor.setEnabled( false ); spnLeftArmor.setEnabled( false ); spnRightArmor.setEnabled( false ); @@ -6875,9 +4353,13 @@ private void LockGUIForOmni() { chkFractional.setEnabled( false ); chkEnviroSealing.setEnabled( false ); + chkJetBooster.setEnabled(false); if( CurVee.GetBaseLoadout().HasSupercharger() ) { chkSupercharger.setEnabled( false ); } + if ( chkCASE.isSelected() ) { + chkCASE.setEnabled(false); + } // now enable the omnimech controls cmbOmniVariant.setEnabled( true ); @@ -6886,7 +4368,7 @@ private void LockGUIForOmni() { btnRenameVariant.setEnabled( true ); } - private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbOmniVariantActionPerformed + private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) { SaveOmniFluffInfo(); String variant = (String) cmbOmniVariant.getSelectedItem(); boolean changed = CurVee.HasChanged(); @@ -6895,11 +4377,7 @@ private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) {//GE // now fix the GUI LoadOmniFluffInfo(); - //FixTransferHandlers(); - //SetLoadoutArrays(); SetWeaponChoosers(); - //BuildJumpJetSelector(); - //cmbJumpJetType.setSelectedItem(CurVee.GetJumpJets().LookupName()); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); RefreshOmniVariants(); @@ -6911,13 +4389,13 @@ private void cmbOmniVariantActionPerformed(java.awt.event.ActionEvent evt) {//GE // this prevents the program from setting the changed tag if we simply // open an omnimech for browsing. CurVee.SetChanged(changed); - }//GEN-LAST:event_cmbOmniVariantActionPerformed + } - private void mnuNewMechActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuNewMechActionPerformed + private void mnuNewMechActionPerformed(java.awt.event.ActionEvent evt) { btnNewVeeActionPerformed(evt); - }//GEN-LAST:event_mnuNewMechActionPerformed + } - private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuLoadActionPerformed + private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -6933,12 +4411,13 @@ private void mnuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST CurVee = m; LoadVehicleIntoGUI(); CurVee.SetChanged(false); - }//GEN-LAST:event_mnuLoadActionPerformed + } - private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuOpenActionPerformed + private void mnuOpenActionPerformed(java.awt.event.ActionEvent evt) { btnOpenActionPerformed(evt); - }//GEN-LAST:event_mnuOpenActionPerformed - public CombatVehicle LoadVehicle (){ + } + + public CombatVehicle LoadVehicle() { CombatVehicle m = null; File tempFile = new File( Prefs.get( "LastOpenCVDirectory", "" ) ); @@ -6968,7 +4447,7 @@ public String getDescription() { fc.setAcceptAllFileFilterUsed( false ); fc.setCurrentDirectory( tempFile ); int returnVal = fc.showDialog( this, "Load Vehicle" ); - if( returnVal != JFileChooser.APPROVE_OPTION ) { return m; } + if( returnVal != JFileChooser.APPROVE_OPTION ) { return null; } File loadmech = fc.getSelectedFile(); String filename = ""; try { @@ -6978,7 +4457,7 @@ public String getDescription() { Prefs.put("CurrentCVfile", loadmech.getCanonicalPath()); } catch( Exception e ) { Media.Messager( this, "There was a problem opening the file:\n" + e.getMessage() ); - return m; + return null; } try { @@ -7004,8 +4483,7 @@ public String getDescription() { return m; } - private void LoadVehicleFromFile( String filename ) - { + private void LoadVehicleFromFile( String filename ) { CombatVehicle m = null; if (! filename.isEmpty() ) { try { @@ -7027,9 +4505,9 @@ public void LoadVehicleIntoGUI() { // Put it in the gui. UnlockGUIFromOmni(); - + chkYearRestrict.setSelected( CurVee.IsYearRestricted() ); - txtProdYear.setText( "" + CurVee.GetYear() ); + txtProdYear.setText( CurVee.YearWasSpecified() ? "" + CurVee.GetYear() : "" ); cmbEra.setEnabled( true ); cmbTechBase.setEnabled( true ); txtProdYear.setEnabled( true ); @@ -7061,28 +4539,44 @@ public void LoadVehicleIntoGUI() { cmbTechBase.setEnabled( false ); txtProdYear.setEnabled( false ); } - + //Set all the inputs txtVehicleName.setText( CurVee.GetName() ); txtModel.setText( CurVee.GetModel() ); cmbTechBase.setSelectedIndex( CurVee.GetLoadout().GetTechBase() ); cmbMotiveType.setSelectedItem( CurVee.GetMotiveLookupName() ); spnTonnage.setModel( new javax.swing.SpinnerNumberModel(CurVee.GetTonnage(), 1, CurVee.GetMaxTonnage(), 1) ); - spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1) ); - if ( CurVee.isHasTurret1() ) cmbTurret.setSelectedItem("Single Turret"); - if ( CurVee.isHasTurret2() ) cmbTurret.setSelectedItem("Dual Turret"); + spnCruiseMP.setModel( new javax.swing.SpinnerNumberModel(CurVee.getCruiseMP(), 1, CurVee.getMaxCruiseMP(), 1) ); FixArmorSpinners(); // now that we're done with the special stuff... Load = false; - + if( CurVee.IsOmni() ) { - if ( CurVee.isHasTurret1() ) - spnTurretTonnage.setModel( new SpinnerNumberModel(CurVee.GetBaseLoadout().GetTurret().GetMaxTonnage(), 0, 99.0, 0.5) ); + chkOmniVee.setSelected( true ); LockGUIForOmni(); RefreshOmniVariants(); RefreshOmniChoices(); + } else { + cmbOmniVariant.setModel( new javax.swing.DefaultComboBoxModel( new String[0] ) ); + } + + double turretTons = 0.0; + if( CurVee.isHasTurret1() ) { + if( chkOmniVee.isSelected() ) { + spnTurretTonnage.setEnabled( !isLocked ); + turretTons = CurVee.GetLoadout().GetTurret().GetTonnage(); + } + } + SetTurretTonnage( turretTons ); + double rearTurretTons = 0.0; + if( CurVee.isHasTurret2() ) { + if( chkOmniVee.isSelected() ) { + spnRearTurretTonnage.setEnabled( !isLocked ); + rearTurretTons = CurVee.GetLoadout().GetRearTurret().GetTonnage(); + } } + SetRearTurretTonnage( rearTurretTons ); FixTonnageSpinner( CurVee.GetMinTonnage(), CurVee.GetMaxTonnage() ); BuildChassisSelector(); @@ -7101,19 +4595,21 @@ public void LoadVehicleIntoGUI() { data.Rebuild( CurVee ); RefreshEquipment(); chkUseTC.setSelected( CurVee.UsingTC() ); - chkClanCASE.setSelected( CurVee.GetLoadout().HasISCASE() ); + chkCASE.setSelected( CurVee.GetLoadout().HasCase() ); chkEnviroSealing.setSelected( CurVee.HasEnvironmentalSealing() ); //chkCommandConsole.setSelected( CurVee.HasCommandConsole() ); RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); + RefreshQuirks(); // load the fluff image. Media media = new Media(); media.blankLogo(lblFluffImage); media.setLogo(lblFluffImage, media.DetermineMatchingImage(CurVee.GetName(), CurVee.GetModel(), CurVee.GetSSWImage())); + quirks = CurVee.GetQuirks(); Overview.SetText( CurVee.getOverview() ); Capabilities.SetText( CurVee.getCapabilities() ); History.SetText( CurVee.getHistory() ); @@ -7121,28 +4617,26 @@ public void LoadVehicleIntoGUI() { Variants.SetText( CurVee.getVariants() ); Notables.SetText( CurVee.getNotables() ); Additional.SetText( CurVee.GetAdditional() ); - txtManufacturer.setText( CurVee.GetCompany() ); - txtManufacturerLocation.setText( CurVee.GetLocation() ); - txtEngineManufacturer.setText( CurVee.GetEngineManufacturer() ); - txtArmorModel.setText( CurVee.GetArmorModel() ); - txtChassisModel.setText( CurVee.GetChassisModel() ); + txtManufacturer.setText( CommonTools.UnknownToEmpty( CurVee.GetCompany() ) ); + txtManufacturerLocation.setText( CommonTools.UnknownToEmpty( CurVee.GetLocation() ) ); + txtEngineManufacturer.setText( CommonTools.UnknownToEmpty( CurVee.GetEngineManufacturer() ) ); + txtArmorModel.setText( CommonTools.UnknownToEmpty( CurVee.GetArmorModel() ) ); + txtChassisModel.setText( CommonTools.UnknownToEmpty( CurVee.GetChassisModel() ) ); if( CurVee.GetJumpJets().GetNumJJ() > 0 ) { txtJJModel.setEnabled( true ); } txtSource.setText( CurVee.getSource() ); // omnimechs may have jump jets in one loadout and not another. - txtJJModel.setText( CurVee.GetJJModel() ); - txtCommSystem.setText( CurVee.GetCommSystem() ); - txtTNTSystem.setText( CurVee.GetTandTSystem() ); + txtJJModel.setText( CommonTools.UnknownToEmpty( CurVee.GetJJModel() ) ); + txtCommSystem.setText( CommonTools.UnknownToEmpty( CurVee.GetCommSystem() ) ); + txtTNTSystem.setText( CommonTools.UnknownToEmpty( CurVee.GetTandTSystem() ) ); setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); CurVee.SetChanged(false); } - - - private void mnuImportHMPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuImportHMPActionPerformed + private void mnuImportHMPActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -7221,15 +4715,15 @@ public String getDescription() { CurVee = m; LoadVehicleIntoGUI(); CurVee.SetChanged(false); - }//GEN-LAST:event_mnuImportHMPActionPerformed + } - private void mnuBatchHMPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuBatchHMPActionPerformed + private void mnuBatchHMPActionPerformed(java.awt.event.ActionEvent evt) { dlgBatchHMP batch = new dlgBatchHMP(this, true); batch.setLocationRelativeTo(this); batch.setVisible(true); - }//GEN-LAST:event_mnuBatchHMPActionPerformed + } - private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSaveActionPerformed + private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) { // Solidify the mech first. setCursor(Hourglass); @@ -7292,9 +4786,9 @@ private void mnuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST setCursor(NormalCursor); setTitle(saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel()); CurVee.SetChanged(false); - }//GEN-LAST:event_mnuSaveActionPerformed + } - private void mnuSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSaveAsActionPerformed + private void mnuSaveAsActionPerformed(java.awt.event.ActionEvent evt) { setCursor(Hourglass); File savemech = GetSaveFile("saw", Prefs.get("LastOpenCVDirectory", ""), false, false); if (savemech == null) { @@ -7351,27 +4845,27 @@ private void mnuSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR setTitle(saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel()); CurVee.SetChanged(false); setCursor(NormalCursor); - }//GEN-LAST:event_mnuSaveAsActionPerformed + } - private void mnuExportHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportHTMLActionPerformed + private void mnuExportHTMLActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportHTMLActionPerformed(evt); SetSource = true; - }//GEN-LAST:event_mnuExportHTMLActionPerformed + } - private void mnuExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportMTFActionPerformed + private void mnuExportMTFActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportMTFActionPerformed(evt); SetSource = true; - }//GEN-LAST:event_mnuExportMTFActionPerformed + } - private void mnuExportTXTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportTXTActionPerformed + private void mnuExportTXTActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportTXTActionPerformed(evt); SetSource = true; - }//GEN-LAST:event_mnuExportTXTActionPerformed + } - private void mnuExportClipboardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExportClipboardActionPerformed + private void mnuExportClipboardActionPerformed(java.awt.event.ActionEvent evt) { // takes the text export and copies it to thesystem clipboard. String CurLoadout = ""; String output = ""; @@ -7398,20 +4892,20 @@ private void mnuExportClipboardActionPerformed(java.awt.event.ActionEvent evt) { } java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(export, this); - }//GEN-LAST:event_mnuExportClipboardActionPerformed + } - private void mnuCreateTCGMechActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCreateTCGMechActionPerformed + private void mnuCreateTCGMechActionPerformed(java.awt.event.ActionEvent evt) { // Create CCG stats for mech // TODO: Add handling code to check if a canon card already exists. SolidifyVehicle(); //dlgCCGMech ccgMech = new dlgCCGMech(this, true, CurVee); //ccgMech.setLocationRelativeTo(this); //ccgMech.setVisible(true); - }//GEN-LAST:event_mnuCreateTCGMechActionPerformed + } - private void mnuPrintPreviewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuPrintPreviewActionPerformed + private void mnuPrintPreviewActionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); - }//GEN-LAST:event_mnuPrintPreviewActionPerformed + } public void QuickSave() { File saveFile = GetSaveFile( "saw", Prefs.get( "LastOpenCVDirectory", "" ), true, false ); @@ -7429,8 +4923,8 @@ public void QuickSave() { mnuSaveActionPerformed(null); } } - - private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed + + private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.HasChanged()) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -7439,11 +4933,10 @@ private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST } } CloseProgram(); - }//GEN-LAST:event_mnuExitActionPerformed + } - private void mnuFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuFileActionPerformed -// TODO add your handling code here: - }//GEN-LAST:event_mnuFileActionPerformed + private void mnuFileActionPerformed(java.awt.event.ActionEvent evt) { + } private void CloseProgram() { try { @@ -7456,22 +4949,22 @@ private void CloseProgram() { System.exit(0); } - - private void mnuSummaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSummaryActionPerformed + + private void mnuSummaryActionPerformed(java.awt.event.ActionEvent evt) { SolidifyVehicle(); dlgSummaryInfo Summary = new dlgSummaryInfo(this, true, CurVee); Summary.setLocationRelativeTo(this); Summary.setVisible(true); - }//GEN-LAST:event_mnuSummaryActionPerformed + } - private void mnuCostBVBreakdownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCostBVBreakdownActionPerformed + private void mnuCostBVBreakdownActionPerformed(java.awt.event.ActionEvent evt) { SolidifyVehicle(); dlgCostBVBreakdown costbv = new dlgCostBVBreakdown(this, true, CurVee); costbv.setLocationRelativeTo(this); costbv.setVisible(true); - }//GEN-LAST:event_mnuCostBVBreakdownActionPerformed + } - private void mnuTextTROActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuTextTROActionPerformed + private void mnuTextTROActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; SolidifyVehicle(); dlgTextExport Text = new dlgTextExport(this, true, CurVee); @@ -7479,9 +4972,9 @@ private void mnuTextTROActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI Text.setVisible(true); CurVee.SetCurLoadout((String) cmbOmniVariant.getSelectedItem()); SetSource = true; - }//GEN-LAST:event_mnuTextTROActionPerformed + } - private void mnuBFBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuBFBActionPerformed + private void mnuBFBActionPerformed(java.awt.event.ActionEvent evt) { String[] call = {"java", "-Xmx256m", "-jar", "bfb.jar"}; try { Runtime.getRuntime().exec(call); @@ -7489,22 +4982,22 @@ private void mnuBFBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: Media.Messager("Error while trying to open BFB\n" + ex.getMessage()); System.out.println(ex.getMessage()); } - }//GEN-LAST:event_mnuBFBActionPerformed + } - private void mnuOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuOptionsActionPerformed + private void mnuOptionsActionPerformed(java.awt.event.ActionEvent evt) { dlgPrefs preferences = new dlgPrefs(this, true); preferences.setLocationRelativeTo(this); preferences.setVisible(true); ResetAmmo(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_mnuOptionsActionPerformed + } - private void mnuViewToolbarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuViewToolbarActionPerformed + private void mnuViewToolbarActionPerformed(java.awt.event.ActionEvent evt) { setViewToolbar(mnuViewToolbar.getState()); - }//GEN-LAST:event_mnuViewToolbarActionPerformed + } - private void mnuClearUserDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuClearUserDataActionPerformed + private void mnuClearUserDataActionPerformed(java.awt.event.ActionEvent evt) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "This will remove all Solaris 7 user data.\nAre you sure you want to continue?", "Clear User Data?", javax.swing.JOptionPane.YES_NO_OPTION); if (choice == 1) { @@ -7514,9 +5007,9 @@ private void mnuClearUserDataActionPerformed(java.awt.event.ActionEvent evt) {// Prefs.put("S7Password", ""); Prefs.put("S7UserID", ""); } - }//GEN-LAST:event_mnuClearUserDataActionPerformed + } - private void mnuUnlockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuUnlockActionPerformed + private void mnuUnlockActionPerformed(java.awt.event.ActionEvent evt) { int choice = javax.swing.JOptionPane.showConfirmDialog(this, "Are you sure you want to unlock the chassis?\nAll omni loadouts" + " will be deleted\nand the Vehicle will revert to its base loadout.", @@ -7530,9 +5023,9 @@ private void mnuUnlockActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); LoadVehicleIntoGUI(); - }//GEN-LAST:event_mnuUnlockActionPerformed + } - private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed + private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) { Overview.StartNewDocument(); Capabilities.StartNewDocument(); History.StartNewDocument(); @@ -7548,21 +5041,21 @@ private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI txtJJModel.setText(""); txtCommSystem.setText(""); txtTNTSystem.setText(""); - }//GEN-LAST:event_jMenuItem1ActionPerformed + } - private void mnuCreditsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCreditsActionPerformed + private void mnuCreditsActionPerformed(java.awt.event.ActionEvent evt) { dlgCredits Credits = new dlgCredits(this, true); Credits.setLocationRelativeTo(this); Credits.setVisible(true); - }//GEN-LAST:event_mnuCreditsActionPerformed + } - private void mnuAboutSSWActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAboutSSWActionPerformed + private void mnuAboutSSWActionPerformed(java.awt.event.ActionEvent evt) { dlgAboutBox about = new dlgAboutBox(this, true); about.setLocationRelativeTo(this); about.setVisible(true); - }//GEN-LAST:event_mnuAboutSSWActionPerformed + } - private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintActionPerformed + private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) { PagePrinter printer = SetupPrinter(); Scenario s = new Scenario(); s.getAttackerForce().AddUnit(new Unit(CurVee)); @@ -7570,9 +5063,9 @@ private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS prv.setRSOnly(); prv.setLocationRelativeTo(this); prv.setVisible(true); - }//GEN-LAST:event_btnPrintActionPerformed + } - private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenActionPerformed + private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) { if( CurVee.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, "The current Vehicle has changed.\nDo you want to discard those changes?", "Discard Changes?", javax.swing.JOptionPane.YES_NO_OPTION ); @@ -7583,25 +5076,23 @@ private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST dOpen.setSize( 1024, 600 ); dOpen.setVisible(true); - }//GEN-LAST:event_btnOpenActionPerformed + } - private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed + private void formWindowClosed(java.awt.event.WindowEvent evt) { CloseProgram(); - }//GEN-LAST:event_formWindowClosed + } - private void btnOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOptionsActionPerformed + private void btnOptionsActionPerformed(java.awt.event.ActionEvent evt) { dlgPrefs preferences = new dlgPrefs( this, true ); preferences.setLocationRelativeTo( this ); preferences.setVisible( true ); - //Mechrender.Reset(); ResetAmmo(); - //RefreshInternalPoints(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnOptionsActionPerformed + } - private void btnExportClipboardIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportClipboardIconActionPerformed - // takes the text export and copies it to thesystem clipboard. + private void btnExportClipboardIconActionPerformed(java.awt.event.ActionEvent evt) { + // takes the text export and copies it to thesystem clipboard. String CurLoadout = ""; String output = ""; @@ -7627,15 +5118,15 @@ private void btnExportClipboardIconActionPerformed(java.awt.event.ActionEvent ev } java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents( export, this ); - }//GEN-LAST:event_btnExportClipboardIconActionPerformed + } - private void btnChatInfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChatInfoActionPerformed + private void btnChatInfoActionPerformed(java.awt.event.ActionEvent evt) { java.awt.datatransfer.StringSelection export = new java.awt.datatransfer.StringSelection(CurVee.GetChatInfo()); java.awt.datatransfer.Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(export, this); - }//GEN-LAST:event_btnChatInfoActionPerformed + } - private void btnExportHTMLIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportHTMLIconActionPerformed + private void btnExportHTMLIconActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; // exports the mech to HTML format String CurLoadout = ""; @@ -7672,30 +5163,38 @@ private void btnExportHTMLIconActionPerformed(java.awt.event.ActionEvent evt) {/ } setTitle( saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel() ); SetSource = true; - }//GEN-LAST:event_btnExportHTMLIconActionPerformed + } - private void btnExportTextIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportTextIconActionPerformed + private void btnExportTextIconActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportTXTActionPerformed( evt ); SetSource = true; - }//GEN-LAST:event_btnExportTextIconActionPerformed + } - private void btnExportMTFIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportMTFIconActionPerformed + private void btnExportMTFIconActionPerformed(java.awt.event.ActionEvent evt) { SetSource = false; btnExportMTFActionPerformed( evt ); SetSource = true; - }//GEN-LAST:event_btnExportMTFIconActionPerformed + } - private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddQuirkActionPerformed - /* - * dlgQuirks qmanage = new dlgQuirks(this, true, data, quirks); - * qmanage.setLocationRelativeTo(this); qmanage.setVisible(true); - * tblQuirks.setModel(new tbQuirks(quirks)); - * - */ - }//GEN-LAST:event_btnAddQuirkActionPerformed + private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) { + ArrayList filtered = new ArrayList(); + for (Quirk item : data.GetQuirks()) { + if (item.isCombatvehicle()) { + filtered.add(item); + } + } + dlgQuirks qmanage = new dlgQuirks(this, true, CurVee, filtered, quirks); + qmanage.setLocationRelativeTo(this); qmanage.setVisible(true); + CurVee.SetQuirks(quirks); + RefreshQuirks(); + } + + private void RefreshQuirks() { + tblQuirks.setModel(new tbQuirks(CurVee.GetQuirks())); + } - private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportMTFActionPerformed + private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) { // exports the mech to MTF format for use in Megamek String dir = Prefs.get("MTFExportPath", "none"); @@ -7708,7 +5207,7 @@ private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN- } String filename = ""; - IO.MTFWriter mtfw = new IO.MTFWriter(CurVee); + IO.MTFWriter mtfw = new IO.MTFWriter(CurVee, saw.Constants.AppDescription + " " + saw.Constants.GetVersion()); try { filename = savemech.getCanonicalPath(); mtfw.WriteMTF(filename); @@ -7720,9 +5219,9 @@ private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // if there were no problems, let the user know how it went Media.Messager(this, "Vehicle saved successfully to MTF:\n" + filename); setTitle(saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel()); - }//GEN-LAST:event_btnExportMTFActionPerformed + } - private void btnExportHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportHTMLActionPerformed + private void btnExportHTMLActionPerformed(java.awt.event.ActionEvent evt) { // exports the mech to HTML format String CurLoadout = ""; if (CurVee.IsOmni()) { @@ -7757,9 +5256,9 @@ private void btnExportHTMLActionPerformed(java.awt.event.ActionEvent evt) {//GEN //cmbOmniVariantActionPerformed( evt ); } setTitle(saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel()); - }//GEN-LAST:event_btnExportHTMLActionPerformed + } - private void btnExportTXTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportTXTActionPerformed + private void btnExportTXTActionPerformed(java.awt.event.ActionEvent evt) { // exports the mech to TXT format String CurLoadout = ""; if (CurVee.IsOmni()) { @@ -7794,15 +5293,15 @@ private void btnExportTXTActionPerformed(java.awt.event.ActionEvent evt) {//GEN- //cmbOmniVariantActionPerformed( evt ); } setTitle(saw.Constants.AppName + " " + saw.Constants.GetVersion() + " - " + CurVee.GetName() + " " + CurVee.GetModel()); - }//GEN-LAST:event_btnExportTXTActionPerformed + } - private void btnClearImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearImageActionPerformed + private void btnClearImageActionPerformed(java.awt.event.ActionEvent evt) { // Set the fluff image to default lblFluffImage.setIcon(null); CurVee.SetSSWImage(""); - }//GEN-LAST:event_btnClearImageActionPerformed + } - private void btnLoadImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadImageActionPerformed + private void btnLoadImageActionPerformed(java.awt.event.ActionEvent evt) { // Opens a file chooser for the user, then resizes the chosen image to // fit in the fluff label and adds it JFileChooser fc = new JFileChooser(); @@ -7861,9 +5360,9 @@ private void btnLoadImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // add the image to the fluff image label lblFluffImage.setIcon(newFluffImage); CurVee.SetSSWImage(fc.getSelectedFile().getPath()); - }//GEN-LAST:event_btnLoadImageActionPerformed + } - private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddEquipActionPerformed + private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) { abPlaceable a = null; int Index = 0; ArrayList v; @@ -7955,12 +5454,8 @@ private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F if (a != null) { try { CurVee.GetLoadout().CheckExclusions(a); - if (a instanceof Equipment) { - if (!((Equipment) a).Validate(CurVee)) { - if (((Equipment) a).MaxAllowed() > 0) { - throw new Exception("Only " + ((Equipment) a).MaxAllowed() + " " + a.CritName() + "(s) may be mounted on one Vehicle."); - } - } + if (a instanceof ifEquipment) { + ((ifEquipment) a).Validate(CurVee); } } catch (Exception e) { Media.Messager(e.getMessage()); @@ -8022,9 +5517,9 @@ private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F RefreshInfoPane(); cmbNumEquips.setSelectedIndex(0); } - }//GEN-LAST:event_btnAddEquipActionPerformed + } - private void btnClearEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearEquipActionPerformed + private void btnClearEquipActionPerformed(java.awt.event.ActionEvent evt) { CurVee.GetLoadout().SafeClearLoadout(); // refresh the selected equipment listbox @@ -8046,9 +5541,9 @@ private void btnClearEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnClearEquipActionPerformed + } - private void btnRemoveEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveEquipActionPerformed + private void btnRemoveEquipActionPerformed(java.awt.event.ActionEvent evt) { if (lstSelectedEquipment.getSelectedIndex() < 0) { return; } @@ -8086,26 +5581,25 @@ private void btnRemoveEquipActionPerformed(java.awt.event.ActionEvent evt) {//GE // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnRemoveEquipActionPerformed + } - private void lstSelectedEquipmentKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_lstSelectedEquipmentKeyPressed + private void lstSelectedEquipmentKeyPressed(java.awt.event.KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_DELETE) { btnRemoveEquipActionPerformed(new ActionEvent(evt.getSource(), evt.getID(), null)); } - }//GEN-LAST:event_lstSelectedEquipmentKeyPressed + } - private void lstSelectedEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstSelectedEquipmentValueChanged + private void lstSelectedEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstSelectedEquipment.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[SELECTED][lstSelectedEquipment.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstSelectedEquipmentValueChanged + } - private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkClanCASEActionPerformed - if (!chkClanCASE.isSelected()) { - CurVee.GetLoadout().SetClanCASE(false); - CurVee.GetLoadout().RemoveISCase(); + private void chkCASEActionPerformed(java.awt.event.ActionEvent evt) { + if (!chkCASE.isSelected()) { + CurVee.GetLoadout().RemoveCase(); SetWeaponChoosers(); RefreshSummary(); RefreshInfoPane(); @@ -8115,20 +5609,16 @@ private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F try { switch (CurVee.GetTechBase()) { case AvailableCode.TECH_INNER_SPHERE: - CurVee.GetLoadout().SetISCASE(); + CurVee.GetLoadout().AddCase(false); break; case AvailableCode.TECH_CLAN: - CurVee.GetLoadout().SetClanCASE(true); - CurVee.GetLoadout().SetISCASE(); + CurVee.GetLoadout().AddCase(true); break; case AvailableCode.TECH_BOTH: dlgTechBaseChooser tech = new dlgTechBaseChooser(this, true); tech.setLocationRelativeTo(this); tech.setVisible(true); - if (tech.IsClan()) { - CurVee.GetLoadout().SetClanCASE(true); - } - CurVee.GetLoadout().SetISCASE(); + CurVee.GetLoadout().AddCase(tech.IsClan()); break; } } catch (Exception e) { @@ -8137,9 +5627,9 @@ private void chkClanCASEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F SetWeaponChoosers(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkClanCASEActionPerformed + } - private void chkFCSApolloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFCSApolloActionPerformed + private void chkFCSApolloActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.UsingApollo() == chkFCSApollo.isSelected()) { return; } @@ -8161,9 +5651,9 @@ private void chkFCSApolloActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkFCSApolloActionPerformed + } - private void chkFCSAVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFCSAVActionPerformed + private void chkFCSAVActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.UsingArtemisV() == chkFCSAV.isSelected()) { return; } @@ -8185,9 +5675,9 @@ private void chkFCSAVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkFCSAVActionPerformed + } - private void chkFCSAIVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFCSAIVActionPerformed + private void chkFCSAIVActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.UsingArtemisIV() == chkFCSAIV.isSelected()) { return; } @@ -8208,10 +5698,10 @@ private void chkFCSAIVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR } // now refresh the information panes RefreshSummary(); - RefreshInfoPane(); - }//GEN-LAST:event_chkFCSAIVActionPerformed + RefreshInfoPane(); + } - private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkUseTCActionPerformed + private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) { if (CurVee.UsingTC() == chkUseTC.isSelected()) { return; } @@ -8238,78 +5728,78 @@ private void chkUseTCActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS SetWeaponChoosers(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkUseTCActionPerformed + } - private void lstChooseAmmunitionValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseAmmunitionValueChanged + private void lstChooseAmmunitionValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstChooseAmmunition.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[AMMUNITION][lstChooseAmmunition.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstChooseAmmunitionValueChanged + } - private void lstChooseArtilleryValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseArtilleryValueChanged + private void lstChooseArtilleryValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstChooseArtillery.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[ARTILLERY][lstChooseArtillery.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstChooseArtilleryValueChanged + } - private void lstChooseEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseEquipmentValueChanged + private void lstChooseEquipmentValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstChooseEquipment.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[EQUIPMENT][lstChooseEquipment.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstChooseEquipmentValueChanged + } - private void lstChoosePhysicalValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChoosePhysicalValueChanged + private void lstChoosePhysicalValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstChoosePhysical.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[PHYSICAL][lstChoosePhysical.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstChoosePhysicalValueChanged + } - private void lstChooseMissileValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseMissileValueChanged + private void lstChooseMissileValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstChooseMissile.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[MISSILE][lstChooseMissile.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstChooseMissileValueChanged + } - private void lstChooseEnergyValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseEnergyValueChanged + private void lstChooseEnergyValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstChooseEnergy.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[ENERGY][lstChooseEnergy.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstChooseEnergyValueChanged + } - private void lstChooseBallisticValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lstChooseBallisticValueChanged + private void lstChooseBallisticValueChanged(javax.swing.event.ListSelectionEvent evt) { if (lstChooseBallistic.getSelectedIndex() < 0) { return; } abPlaceable p = (abPlaceable) Equipment[BALLISTIC][lstChooseBallistic.getSelectedIndex()]; ShowInfoOn(p); - }//GEN-LAST:event_lstChooseBallisticValueChanged + } - private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMaximizeActionPerformed + private void btnMaximizeActionPerformed(java.awt.event.ActionEvent evt) { // this simply maximizes the mech's armor CVArmor a = CurVee.GetArmor(); a.Maximize(); - + // if we fix the spinner models, they should refresh the screen FixArmorSpinners(); // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnMaximizeActionPerformed + } - private void btnUseRemainingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUseRemainingActionPerformed + private void btnUseRemainingActionPerformed(java.awt.event.ActionEvent evt) { // see if we have a good number double freetons = CurVee.GetTonnage() - CurVee.GetCurrentTons() + CurVee.GetArmor().GetTonnage(); @@ -8332,9 +5822,9 @@ private void btnUseRemainingActionPerformed(java.awt.event.ActionEvent evt) {//G // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnUseRemainingActionPerformed + } - private void btnSetArmorTonsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetArmorTonsActionPerformed + private void btnSetArmorTonsActionPerformed(java.awt.event.ActionEvent evt) { // we'll need a new dialogue to get the tonnage dlgArmorTonnage ArmorDialogue = new dlgArmorTonnage(this, true, CurVee); ArmorDialogue.setLocationRelativeTo(this); @@ -8363,9 +5853,9 @@ private void btnSetArmorTonsActionPerformed(java.awt.event.ActionEvent evt) {//G // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnSetArmorTonsActionPerformed + } - private void cmbArmorTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbArmorTypeActionPerformed + private void cmbArmorTypeActionPerformed(java.awt.event.ActionEvent evt) { if (Load) { return; } @@ -8379,9 +5869,9 @@ private void cmbArmorTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_cmbArmorTypeActionPerformed + } - private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRotorArmorStateChanged + private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8425,9 +5915,9 @@ private void spnRotorArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRotorArmorStateChanged + } - private void spnRearTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRearTurretArmorStateChanged + private void spnRearTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8467,9 +5957,9 @@ private void spnRearTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) { // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRearTurretArmorStateChanged + } - private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTurretArmorStateChanged + private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8513,9 +6003,9 @@ private void spnTurretArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GE // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnTurretArmorStateChanged + } - private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRearArmorStateChanged + private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8566,9 +6056,9 @@ private void spnRearArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRearArmorStateChanged + } - private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnLeftArmorStateChanged + private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8619,9 +6109,9 @@ private void spnLeftArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnLeftArmorStateChanged + } - private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnFrontArmorStateChanged + private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8672,9 +6162,9 @@ private void spnFrontArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnFrontArmorStateChanged + } - private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnRightArmorStateChanged + private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8725,9 +6215,9 @@ private void spnRightArmorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnRightArmorStateChanged + } - private void btnRenameVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRenameVariantActionPerformed + private void btnRenameVariantActionPerformed(java.awt.event.ActionEvent evt) { SaveOmniFluffInfo(); String VariantName = ""; @@ -8760,9 +6250,9 @@ private void btnRenameVariantActionPerformed(java.awt.event.ActionEvent evt) {// CurVee.GetLoadout().SetName(VariantName); RefreshOmniVariants(); - }//GEN-LAST:event_btnRenameVariantActionPerformed + } - private void btnDeleteVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteVariantActionPerformed + private void btnDeleteVariantActionPerformed(java.awt.event.ActionEvent evt) { // see if the user actually wants to delete the variant int choice = javax.swing.JOptionPane.showConfirmDialog(this, "Are you sure you want to delete this variant?", "Delete Variant?", javax.swing.JOptionPane.YES_NO_OPTION); @@ -8781,19 +6271,15 @@ private void btnDeleteVariantActionPerformed(java.awt.event.ActionEvent evt) {// // refresh all the displays LoadOmniFluffInfo(); RefreshOmniVariants(); - //FixTransferHandlers(); - //SetLoadoutArrays(); SetWeaponChoosers(); - //BuildJumpJetSelector(); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); RefreshOmniChoices(); - //SolidifyJJManufacturer(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnDeleteVariantActionPerformed + } - private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddVariantActionPerformed + private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) { SaveOmniFluffInfo(); String VariantName = ""; @@ -8821,24 +6307,20 @@ private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN // fix the GUI LoadOmniFluffInfo(); - //FixTransferHandlers(); - //SetLoadoutArrays(); SetWeaponChoosers(); - //BuildJumpJetSelector(); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); RefreshOmniVariants(); RefreshOmniChoices(); - //SolidifyJJManufacturer(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnAddVariantActionPerformed + } - private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLockChassisActionPerformed + private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) { // currently testing right now. SaveOmniFluffInfo(); String VariantName = ""; - + // 2020-11-13 Omnis can't have Hardened Armor, but we wrote this generic // in case later other armor types come along if (!CurVee.GetArmor().AllowOmni()){ @@ -8875,19 +6357,16 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE // make it an omni CurVee.SetOmni(VariantName); - chkOmniVee.setEnabled(false); - //FixTransferHandlers(); FixJJSpinnerModel(); FixHeatSinkSpinnerModel(); LockGUIForOmni(); RefreshOmniVariants(); RefreshOmniChoices(); - //SolidifyJJManufacturer(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_btnLockChassisActionPerformed + } - private void chkFractionalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFractionalActionPerformed + private void chkFractionalActionPerformed(java.awt.event.ActionEvent evt) { if (chkFractional.isSelected() == CurVee.UsingFractionalAccounting()) { return; } @@ -8904,45 +6383,108 @@ private void chkFractionalActionPerformed(java.awt.event.ActionEvent evt) {//GEN RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkFractionalActionPerformed + } - private void chkSuperchargerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSuperchargerActionPerformed - - }//GEN-LAST:event_chkSuperchargerActionPerformed + private void chkJetBoosterActionPerformed(java.awt.event.ActionEvent evt) { + if( CurVee.GetLoadout().HasVTOLBooster() == chkJetBooster.isSelected() ) { + return; + } + try { + CurVee.GetLoadout().SetVTOLBooster( chkJetBooster.isSelected()); + } catch( Exception e ) { + Media.Messager( this, e.getMessage() ); + try { + CurVee.GetLoadout().SetVTOLBooster( false ); + } catch( Exception x ) { + // how the hell did we get an error removing it? + Media.Messager( this, x.getMessage() ); + } + chkJetBooster.setSelected( false ); + } + RefreshSelectedEquipment(); + RefreshSummary(); + RefreshInfoPane(); + } + private void chkArmoredMotiveActionPerformed(ActionEvent evt) { + if (CurVee.GetLoadout().HasArmoredMotiveSystem() == chkArmoredMotive.isSelected()) { + return; + } + try { + switch (CurVee.GetTechBase()) { + case AvailableCode.TECH_INNER_SPHERE: + CurVee.GetLoadout().SetArmoredMotiveSystem(chkArmoredMotive.isSelected(), false); + break; + case AvailableCode.TECH_CLAN: + CurVee.GetLoadout().SetArmoredMotiveSystem(chkArmoredMotive.isSelected(), true); + break; + case AvailableCode.TECH_BOTH: + dlgTechBaseChooser tech = new dlgTechBaseChooser(this, true); + tech.setLocationRelativeTo(this); + tech.setVisible(true); + CurVee.GetLoadout().SetArmoredMotiveSystem(chkArmoredMotive.isSelected(), tech.IsClan()); + break; + } + } catch( Exception e ) { + Media.Messager( this, e.getMessage() ); + chkArmoredMotive.setSelected( false ); + } + RefreshSelectedEquipment(); + RefreshSummary(); + RefreshInfoPane(); + } + private void chkSuperchargerActionPerformed(java.awt.event.ActionEvent evt) { + if( CurVee.GetLoadout().HasSupercharger() == chkSupercharger.isSelected() ) { + return; + } + try { + CurVee.GetLoadout().SetSupercharger( chkSupercharger.isSelected()); + } catch( Exception e ) { + Media.Messager( this, e.getMessage() ); + try { + CurVee.GetLoadout().SetSupercharger( false ); + } catch( Exception x ) { + // how the hell did we get an error removing it? + Media.Messager( this, x.getMessage() ); + } + chkSupercharger.setSelected( false ); + } + RefreshSelectedEquipment(); + RefreshSummary(); + RefreshInfoPane(); + } - private void chkEnviroSealingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkEnviroSealingActionPerformed + private void chkEnviroSealingActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetEnvironmentalSealing(chkEnviroSealing.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkEnviroSealingActionPerformed + } - private void chkDuneBuggyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkDuneBuggyActionPerformed + private void chkDuneBuggyActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetDuneBuggy(chkDuneBuggy.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkDuneBuggyActionPerformed + } - private void chkFullAmphActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFullAmphActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_chkFullAmphActionPerformed + private void chkFullAmphActionPerformed(java.awt.event.ActionEvent evt) { + } - private void chkLimitedAmphActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkLimitedAmphActionPerformed + private void chkLimitedAmphActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetLimitedAmphibious(chkLimitedAmph.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkLimitedAmphActionPerformed + } - private void chkFlotationHullActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkFlotationHullActionPerformed + private void chkFlotationHullActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetFlotationHull(chkFlotationHull.isSelected()); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_chkFlotationHullActionPerformed + } - private void spnCruiseMPInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_spnCruiseMPInputMethodTextChanged + private void spnCruiseMPInputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnCruiseMPStateChanged(null); - }//GEN-LAST:event_spnCruiseMPInputMethodTextChanged + } - private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnCruiseMPStateChanged + private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -8983,31 +6525,71 @@ private void spnCruiseMPStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-F // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnCruiseMPStateChanged + } + + private void spnTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) { + SetTurretTonnage( null ); + RefreshSummary(); + RefreshInfoPane(); + } - private void spnTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTurretTonnageStateChanged - double Tons = 0; + private void SetTurretTonnage( Double Tons ) { try { - Tons = Double.parseDouble(spnTurretTonnage.getValue().toString()); - CurVee.GetLoadout().GetTurret().SetTonnage(Tons); - } catch (Exception e) { + if( Tons != null ) { + // following may end up calling spnTurretTonnageStateChanged + // which in turn will call this again with null Tons, + // so it's okay although potentially redundant + spnTurretTonnage.setValue( Tons ); + } + if( CurVee.isHasTurret1() && chkOmniVee.isSelected() ) { + if( Tons == null) { + Tons = Double.parseDouble( spnTurretTonnage.getValue().toString() ); + } + CurVee.GetLoadout().GetTurret().SetTonnage( Tons ); + } else { + CurVee.GetLoadout().GetTurret().UnsetTonnage(); + } + } catch( Exception e ) { Media.Messager(e.getMessage()); return; } + } + private void spnRearTurretTonnageStateChanged(javax.swing.event.ChangeEvent evt) { + SetRearTurretTonnage( null ); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnTurretTonnageStateChanged + } + + private void SetRearTurretTonnage( Double Tons ) { + try { + if( Tons != null ) { + // following may end up calling spnRearTurretTonnageStateChanged + // which in turn will call this again with null Tons, + // so it's okay although potentially redundant + spnRearTurretTonnage.setValue( Tons ); + } + if( CurVee.isHasTurret2() && chkOmniVee.isSelected() ) { + if( Tons == null) { + Tons = Double.parseDouble( spnRearTurretTonnage.getValue().toString() ); + } + CurVee.GetLoadout().GetRearTurret().SetTonnage( Tons ); + } else { + CurVee.GetLoadout().GetRearTurret().UnsetTonnage(); + } + } catch( Exception e ) { + Media.Messager(e.getMessage()); + return; + } + } - private void spnHeatSinksInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_spnHeatSinksInputMethodTextChanged - // TODO add your handling code here: - }//GEN-LAST:event_spnHeatSinksInputMethodTextChanged + private void spnHeatSinksInputMethodTextChanged(java.awt.event.InputMethodEvent evt) { + } - private void spnHeatSinksFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_spnHeatSinksFocusGained - // TODO add your handling code here: - }//GEN-LAST:event_spnHeatSinksFocusGained + private void spnHeatSinksFocusGained(java.awt.event.FocusEvent evt) { + } - private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnHeatSinksStateChanged + private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -9044,29 +6626,37 @@ private void spnHeatSinksStateChanged(javax.swing.event.ChangeEvent evt) {//GEN- // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnHeatSinksStateChanged + } - private void cmbTurretActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTurretActionPerformed + private void cmbTurretActionPerformed(java.awt.event.ActionEvent evt) { if (Load) { return; } - //TODO add logic to CombatVehicle to handle the turret + String Turret = cmbTurret.getSelectedItem().toString(); - if (Turret.equals("Single Turret")) { + if(Turret.equals("Single Turret") || Turret.equals("Chin Turret") ) { CurVee.setHasTurret1(true); - if (chkOmniVee.isSelected() && !isLocked) { - spnTurretTonnage.setEnabled(true); - } - } else if (Turret.equals("Dual Turret")) { + CurVee.setHasTurret2(false); + } else if( Turret.equals("Dual Turret") ) { CurVee.setHasTurret1(true); CurVee.setHasTurret2(true); - if (chkOmniVee.isSelected() && !isLocked) { - spnTurretTonnage.setEnabled(true); - } } else { CurVee.setHasTurret1(false); CurVee.setHasTurret2(false); - spnTurretTonnage.setEnabled(false); + } + if( CurVee.isHasTurret1() ) { + spnTurretTonnage.setEnabled( chkOmniVee.isSelected() && !isLocked ); + SetTurretTonnage( null ); + } else { + spnTurretTonnage.setEnabled( false ); + SetTurretTonnage( 0.0 ); + } + if( CurVee.isHasTurret2() ) { + spnRearTurretTonnage.setEnabled( chkOmniVee.isSelected() && !isLocked ); + SetRearTurretTonnage( null ); + } else { + spnRearTurretTonnage.setEnabled( false ); + SetRearTurretTonnage( 0.0 ); } BuildLocationSelector(); @@ -9074,7 +6664,7 @@ private void cmbTurretActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR RefreshSelectedEquipment(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_cmbTurretActionPerformed + } private void RefreshSelectedEquipment() { Equipment[SELECTED] = CurVee.GetLoadout().GetNonCore().toArray(); @@ -9082,7 +6672,7 @@ private void RefreshSelectedEquipment() { lstSelectedEquipment.repaint(); } - private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbEngineTypeActionPerformed + private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) { if (Load) { return; } @@ -9100,10 +6690,10 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN } RecalcEngine(); FixMPSpinner(); - + //When the engine changes we need to re-check the Heat Sinks CurVee.ResetHeatSinks(); - + // only nuclear-powered mechs may use jump jets if (CurVee.GetEngine().IsNuclear()) { /* @@ -9125,17 +6715,16 @@ private void cmbEngineTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN // now refresh the information panes RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_cmbEngineTypeActionPerformed + } - private void spnTonnageInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_spnTonnageInputMethodTextChanged + private void spnTonnageInputMethodTextChanged(java.awt.event.InputMethodEvent evt) { spnTonnageStateChanged(null); - }//GEN-LAST:event_spnTonnageInputMethodTextChanged - - private void spnTonnageFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_spnTonnageFocusGained + } - }//GEN-LAST:event_spnTonnageFocusGained + private void spnTonnageFocusGained(java.awt.event.FocusEvent evt) { + } - private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTonnageStateChanged + private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) { if (Load) { return; } @@ -9196,12 +6785,11 @@ private void spnTonnageStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FI FixArmorSpinners(); // now refresh the information panes - //RefreshInternalPoints(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_spnTonnageStateChanged + } - private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkTrailerActionPerformed + private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetTrailer(chkTrailer.isSelected()); BuildEngineSelector(); if ( chkTrailer.isSelected() ) { @@ -9230,21 +6818,17 @@ private void chkTrailerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI SetWeaponChoosers(); RefreshEquipment(); RefreshInfoPane(); - }//GEN-LAST:event_chkTrailerActionPerformed + } - private void chkOmniVeeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOmniVeeActionPerformed - if (chkOmniVee.isSelected()) { - btnLockChassis.setEnabled(true); - } else { - btnLockChassis.setEnabled(false); - } + private void chkOmniVeeActionPerformed(java.awt.event.ActionEvent evt) { + btnLockChassis.setEnabled( chkOmniVee.isSelected() ); cmbTurretActionPerformed(evt); - }//GEN-LAST:event_chkOmniVeeActionPerformed + } - private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbMotiveTypeActionPerformed + private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) { if ( Load ) return; boolean wasVtol = CurVee.IsVTOL(); - + switch (cmbMotiveType.getSelectedIndex()) { case 0: //Hovercraft CurVee.SetHover(); @@ -9296,15 +6880,17 @@ private void cmbMotiveTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN FixMPSpinner(); if( CurVee.IsVTOL() != wasVtol ) RecalcArmorPlacement(); RecalcArmorLocations(); + RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); - }//GEN-LAST:event_cmbMotiveTypeActionPerformed + RefreshEquipment(); + } - private void cmbProductionEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbProductionEraActionPerformed + private void cmbProductionEraActionPerformed(java.awt.event.ActionEvent evt) { CurVee.SetProductionEra(cmbProductionEra.getSelectedIndex()); - }//GEN-LAST:event_cmbProductionEraActionPerformed + } - private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkYearRestrictActionPerformed + private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) { // This locks in the mech's production year, era, and tech base. int year = 0; if (CurVee.IsYearRestricted() == chkYearRestrict.isSelected()) { @@ -9317,76 +6903,28 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G cmbTechBase.setEnabled(true); txtProdYear.setEnabled(true); CurVee.SetYearRestricted(false); - switch (cmbEra.getSelectedIndex()) { - case AvailableCode.ERA_STAR_LEAGUE: - CurVee.SetYear(2750, false); - break; - case AvailableCode.ERA_SUCCESSION: - CurVee.SetYear(3025, false); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurVee.SetYear(3070, false); - break; - case AvailableCode.ERA_DARK_AGES: - CurVee.SetYear(3132, false); - break; - case AvailableCode.ERA_ALL: - CurVee.SetYear(0, false); - break; - } + CurVee.SetYear( CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ), false ); } else { // ensure we have a good year. try { year = Integer.parseInt(txtProdYear.getText()); } catch (NumberFormatException n) { Media.Messager(this, "The production year is not a number."); - txtProdYear.setText(""); + txtProdYear.setText( "" ); chkYearRestrict.setSelected(false); return; } // ensure the year is between the era years. - switch (cmbEra.getSelectedIndex()) { - case AvailableCode.ERA_STAR_LEAGUE: - // Star League era - if (year < 2443 || year > 2800) { - Media.Messager(this, "The year does not fall within this era."); - txtProdYear.setText(""); - chkYearRestrict.setSelected(false); - return; - } - break; - case AvailableCode.ERA_SUCCESSION: - // Succession Wars era - if (year < 2801 || year > 3050) { - Media.Messager(this, "The year does not fall within this era."); - txtProdYear.setText(""); - chkYearRestrict.setSelected(false); - return; - } - break; - case AvailableCode.ERA_CLAN_INVASION: - // Clan Invasion Era - if (year < 3051 || year > 3131) { - Media.Messager(this, "The year does not fall within this era."); - txtProdYear.setText(""); - chkYearRestrict.setSelected(false); - return; - } - break; - case AvailableCode.ERA_DARK_AGES: - // Clan Invasion Era - if (year < 3132) { - Media.Messager(this, "The year does not fall within this era."); - txtProdYear.setText(""); - chkYearRestrict.setSelected(false); - return; - } - break; - case AvailableCode.ERA_ALL: - // all era - chkYearRestrict.setSelected(false); - chkYearRestrict.setEnabled(false); + if( cmbEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CommonTools.IsYearInEra( year, cmbEra.getSelectedIndex() ) ) { + Media.Messager( this, "The year does not fall within this era." ); + txtProdYear.setText( "" ); + chkYearRestrict.setSelected( false ); + } + } else { + chkYearRestrict.setSelected( false ); + chkYearRestrict.setEnabled( false ); } // we know we have a good year, lock it in. @@ -9403,11 +6941,6 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G // first, refresh all the combo boxes. BuildChassisSelector(); BuildEngineSelector(); - //BuildGyroSelector(); - //BuildCockpitSelector(); - //BuildEnhancementSelector(); - //BuildHeatsinkSelector(); - //BuildJumpJetSelector(); BuildArmorSelector(); RefreshEquipment(); CheckOmni(); @@ -9417,16 +6950,8 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G // now redo the mech based on what happened. RecalcEngine(); - //RecalcGyro(); - //RecalcIntStruc(); - //RecalcCockpit(); - //CurVee.GetActuators().PlaceActuators(); - //RecalcHeatSinks(); - //RecalcJumpJets(); - //RecalcEnhancements(); RecalcArmor(); RecalcEquipment(); - //CurVee.GetLoadout().FlushIllegal( cmbMechEra.getSelectedIndex(), year, chkYearRestrict.isSelected() ); CurVee.GetLoadout().FlushIllegal(); // finally, refresh the information panes @@ -9434,9 +6959,9 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); - }//GEN-LAST:event_chkYearRestrictActionPerformed + } - private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbTechBaseActionPerformed + private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) { if (Load) { return; } @@ -9473,6 +6998,10 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F break; } + //Adding these here for now, since the loadout gets completely trashed, these selections need to go away. + chkSupercharger.setSelected(false); + chkJetBooster.setSelected(false); + // save the current selections. The 'Mech should have already // flushed any illegal equipment in the changeover SaveSelections(); @@ -9482,11 +7011,6 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F // refresh all the combo boxes. BuildChassisSelector(); BuildEngineSelector(); - //BuildGyroSelector(); - //BuildCockpitSelector(); - //BuildEnhancementSelector(); - //BuildHeatsinkSelector(); - //BuildJumpJetSelector(); BuildArmorSelector(); RefreshEquipment(); FixMPSpinner(); @@ -9497,18 +7021,10 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F LoadSelections(); if (CurVee.GetTechBase() == AvailableCode.TECH_CLAN) { - chkClanCASE.setSelected(true); - chkClanCASEActionPerformed(evt); + chkCASE.setSelected(true); + chkCASEActionPerformed(evt); } - // recalculate the mech. RecalcEngine(); - //RecalcGyro(); - //RecalcIntStruc(); - //RecalcCockpit(); - //CurVee.GetActuators().PlaceActuators(); - //RecalcHeatSinks(); - //RecalcJumpJets(); - //RecalcEnhancements(); RecalcArmor(); } @@ -9520,9 +7036,9 @@ private void cmbTechBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); - }//GEN-LAST:event_cmbTechBaseActionPerformed + } - private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbEraActionPerformed + private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) { if (Load) { return; } @@ -9543,54 +7059,17 @@ private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: int tbsave = cmbTechBase.getSelectedIndex(); // change the year range and tech base options - switch (cmbEra.getSelectedIndex()) { - case AvailableCode.ERA_STAR_LEAGUE: - lblEraYears.setText("2443 ~ 2800"); - txtProdYear.setText(""); - CurVee.SetEra(AvailableCode.ERA_STAR_LEAGUE); - CurVee.SetYear(2750, false); - if (!CurVee.IsOmni()) { - chkYearRestrict.setEnabled(true); - } - break; - case AvailableCode.ERA_SUCCESSION: - lblEraYears.setText("2801 ~ 3050"); - txtProdYear.setText(""); - CurVee.SetEra(AvailableCode.ERA_SUCCESSION); - CurVee.SetYear(3025, false); - if (!CurVee.IsOmni()) { - chkYearRestrict.setEnabled(true); - } - break; - case AvailableCode.ERA_CLAN_INVASION: - lblEraYears.setText("3051 ~ 3131"); - txtProdYear.setText(""); - CurVee.SetEra(AvailableCode.ERA_CLAN_INVASION); - CurVee.SetYear(3075, false); - if (!CurVee.IsOmni()) { - chkYearRestrict.setEnabled(true); - } - break; - case AvailableCode.ERA_DARK_AGES: - lblEraYears.setText("3132 on"); - txtProdYear.setText(""); - CurVee.SetEra(AvailableCode.ERA_DARK_AGES); - CurVee.SetYear(3132, false); - if (!CurVee.IsOmni()) { - chkYearRestrict.setEnabled(true); - } - break; - case AvailableCode.ERA_ALL: - lblEraYears.setText("Any"); - txtProdYear.setText(""); - CurVee.SetEra(AvailableCode.ERA_ALL); - CurVee.SetYear(0, false); - chkYearRestrict.setEnabled(false); - break; + lblEraYears.setText( CommonTools.GetEraYearRange( cmbEra.getSelectedIndex() ) ); + txtProdYear.setText( "" ); + CurVee.SetEra( cmbEra.getSelectedIndex() ); + CurVee.SetYear( CommonTools.GetEraDefaultYear( cmbEra.getSelectedIndex() ), false ); + if( cmbEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CurVee.IsOmni() ) { chkYearRestrict.setEnabled( true ); } + } else { + chkYearRestrict.setEnabled( false ); } if (CurVee.IsOmni()) { - //BuildJumpJetSelector(); RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); @@ -9616,14 +7095,13 @@ private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: // get the currently chosen selections SaveSelections(); + // since you can only ever change the era when not restricted, we're not + // doing it here. Pass in default values. + CurVee.GetLoadout().FlushIllegal(); + // refresh all the combo boxes. BuildChassisSelector(); BuildEngineSelector(); - //BuildGyroSelector(); - //BuildCockpitSelector(); - //BuildEnhancementSelector(); - //BuildHeatsinkSelector(); - //BuildJumpJetSelector(); BuildArmorSelector(); FixMPSpinner(); FixJJSpinnerModel(); @@ -9635,29 +7113,17 @@ private void cmbEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST: // when a new era is selected, we have to recalculate the mech RecalcEngine(); - //RecalcGyro(); - //RecalcIntStruc(); - //RecalcCockpit(); - //CurVee.GetActuators().PlaceActuators(); - //RecalcHeatSinks(); - //RecalcJumpJets(); - //RecalcEnhancements(); RecalcArmor(); RecalcEquipment(); - // since you can only ever change the era when not restricted, we're not - // doing it here. Pass in default values. - CurVee.GetLoadout().FlushIllegal(); - //CurVee.GetLoadout().FlushIllegal( cmbEra.getSelectedIndex(), 0, false ); - // now refresh the information panes RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); - }//GEN-LAST:event_cmbEraActionPerformed + } - private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbRulesLevelActionPerformed + private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) { int NewLevel = cmbRulesLevel.getSelectedIndex(); int OldLevel = CurVee.GetLoadout().GetRulesLevel(); int OldType = cmbMotiveType.getSelectedIndex(); @@ -9678,7 +7144,6 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN } BuildTechBaseSelector(); cmbTechBase.setSelectedIndex(CurVee.GetLoadout().GetTechBase()); - RefreshEquipment(); RecalcEquipment(); } else { // can't. reset to the default rules level and scold the user @@ -9710,7 +7175,6 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN // since you can only ever change the rules level when not restricted, // we're not doing it here. Pass in default values. - //CurVee.GetLoadout().FlushIllegal( locArmor.GetEra(), 0, false ); CurVee.GetLoadout().FlushIllegal(); // refresh all the combo boxes. @@ -9720,41 +7184,36 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN BuildExpEquipmentSelector(); FixMPSpinner(); FixJJSpinnerModel(); - RefreshEquipment(); // now reset the combo boxes to the closest choices we previously selected LoadSelections(); RecalcEngine(); - //RecalcIntStruc(); - //RecalcHeatSinks(); RecalcArmor(); RecalcEquipment(); } BuildTurretSelector(); // now refresh the information panes + RefreshEquipment(); RefreshSummary(); RefreshInfoPane(); SetWeaponChoosers(); ResetAmmo(); - }//GEN-LAST:event_cmbRulesLevelActionPerformed + } - private void cmbLocationMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cmbLocationMouseClicked + private void cmbLocationMouseClicked(java.awt.event.MouseEvent evt) { if ( evt.getClickCount() == 2 ) btnAddEquipActionPerformed(null); - }//GEN-LAST:event_cmbLocationMouseClicked + } - private void chkSponsonTurretActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkSponsonTurretActionPerformed - if (chkSponsonTurret.isSelected()) - CurVee.setHasSponsonTurret(true); - else - CurVee.setHasSponsonTurret(false); + private void chkSponsonTurretActionPerformed(java.awt.event.ActionEvent evt) { + CurVee.setHasSponsonTurret(chkSponsonTurret.isSelected()); RefreshSelectedEquipment(); BuildLocationSelector(); - }//GEN-LAST:event_chkSponsonTurretActionPerformed + } - private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuReloadEquipmentActionPerformed + private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) { try { data = new DataFactory( CurVee ); } catch( Exception e ) { @@ -9762,8 +7221,8 @@ private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) { e.printStackTrace(); } SetWeaponChoosers(); - }//GEN-LAST:event_mnuReloadEquipmentActionPerformed - + } + private PagePrinter SetupPrinter() { PagePrinter printer = new PagePrinter(); Media media = new Media(); @@ -9774,10 +7233,10 @@ private PagePrinter SetupPrinter() { sheet.setPrintMech(true); sheet.setUnitImage(media.GetImage(CurVee.GetSSWImage())); printer.Append(BFBPrinter.Letter.toPage(), sheet); - + return printer; } - + private void FixMPSpinner() { // This fixes the walking MP spinner if the mech's tonnage changes. int MaxWalk = CurVee.getMaxCruiseMP(); @@ -9809,7 +7268,7 @@ private void FixJJSpinnerModel() { // changes, here is a quick little routine to do it without extra fuss. int min = 0; - int max = 0; + int max; int current = 0; // if( locArmor.IsOmni() ) { @@ -9846,39 +7305,17 @@ private void FixJJSpinnerModel() { spnJumpMP.setModel( new javax.swing.SpinnerNumberModel( current, min, max, 1) ); } - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnAddEquip; - private javax.swing.JButton btnAddQuirk; - private javax.swing.JButton btnAddToForceList; private javax.swing.JButton btnAddVariant; - private javax.swing.JButton btnChatInfo; - private javax.swing.JButton btnClearEquip; - private javax.swing.JButton btnClearImage; private javax.swing.JButton btnDeleteVariant; - private javax.swing.JButton btnExportClipboardIcon; - private javax.swing.JButton btnExportHTML; - private javax.swing.JButton btnExportHTMLIcon; - private javax.swing.JButton btnExportMTF; - private javax.swing.JButton btnExportMTFIcon; - private javax.swing.JButton btnExportTXT; - private javax.swing.JButton btnExportTextIcon; - private javax.swing.JButton btnForceList; - private javax.swing.JButton btnLoadImage; private javax.swing.JButton btnLockChassis; private javax.swing.JButton btnMaximize; - private javax.swing.JButton btnNewVee; - private javax.swing.JButton btnOpen; - private javax.swing.JButton btnOptions; - private javax.swing.JButton btnPrint; - private javax.swing.JButton btnRemoveEquip; private javax.swing.JButton btnRenameVariant; - private javax.swing.JButton btnSave; private javax.swing.JButton btnSetArmorTons; private javax.swing.JButton btnUseRemaining; private javax.swing.JCheckBox chkArmoredMotive; private javax.swing.JCheckBox chkBalanceFRArmor; private javax.swing.JCheckBox chkBalanceLRArmor; - private javax.swing.JCheckBox chkClanCASE; + private javax.swing.JCheckBox chkCASE; private javax.swing.JCheckBox chkCommandConsole; private javax.swing.JCheckBox chkDuneBuggy; private javax.swing.JCheckBox chkEnviroSealing; @@ -9910,146 +7347,7 @@ private void FixJJSpinnerModel() { private javax.swing.JComboBox cmbRulesLevel; private javax.swing.JComboBox cmbTechBase; private javax.swing.JComboBox cmbTurret; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel10; - private javax.swing.JLabel jLabel11; - private javax.swing.JLabel jLabel12; - private javax.swing.JLabel jLabel13; - private javax.swing.JLabel jLabel14; - private javax.swing.JLabel jLabel15; - private javax.swing.JLabel jLabel16; - private javax.swing.JLabel jLabel17; - private javax.swing.JLabel jLabel18; - private javax.swing.JLabel jLabel19; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel20; - private javax.swing.JLabel jLabel21; - private javax.swing.JLabel jLabel22; - private javax.swing.JLabel jLabel23; - private javax.swing.JLabel jLabel24; - private javax.swing.JLabel jLabel25; - private javax.swing.JLabel jLabel26; - private javax.swing.JLabel jLabel27; - private javax.swing.JLabel jLabel28; - private javax.swing.JLabel jLabel29; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel30; - private javax.swing.JLabel jLabel31; - private javax.swing.JLabel jLabel32; - private javax.swing.JLabel jLabel33; - private javax.swing.JLabel jLabel34; - private javax.swing.JLabel jLabel35; - private javax.swing.JLabel jLabel36; - private javax.swing.JLabel jLabel37; - private javax.swing.JLabel jLabel38; - private javax.swing.JLabel jLabel39; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel40; - private javax.swing.JLabel jLabel41; - private javax.swing.JLabel jLabel42; - private javax.swing.JLabel jLabel43; - private javax.swing.JLabel jLabel44; - private javax.swing.JLabel jLabel45; - private javax.swing.JLabel jLabel46; - private javax.swing.JLabel jLabel47; - private javax.swing.JLabel jLabel48; - private javax.swing.JLabel jLabel49; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel50; - private javax.swing.JLabel jLabel51; - private javax.swing.JLabel jLabel52; - private javax.swing.JLabel jLabel53; - private javax.swing.JLabel jLabel54; - private javax.swing.JLabel jLabel55; - private javax.swing.JLabel jLabel56; - private javax.swing.JLabel jLabel57; - private javax.swing.JLabel jLabel58; - private javax.swing.JLabel jLabel59; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel60; - private javax.swing.JLabel jLabel61; - private javax.swing.JLabel jLabel62; - private javax.swing.JLabel jLabel63; - private javax.swing.JLabel jLabel64; - private javax.swing.JLabel jLabel65; - private javax.swing.JLabel jLabel66; - private javax.swing.JLabel jLabel67; - private javax.swing.JLabel jLabel68; - private javax.swing.JLabel jLabel69; - private javax.swing.JLabel jLabel7; - private javax.swing.JLabel jLabel70; - private javax.swing.JLabel jLabel71; - private javax.swing.JLabel jLabel72; - private javax.swing.JLabel jLabel73; - private javax.swing.JLabel jLabel74; - private javax.swing.JLabel jLabel75; - private javax.swing.JLabel jLabel76; - private javax.swing.JLabel jLabel77; - private javax.swing.JLabel jLabel78; - private javax.swing.JLabel jLabel79; - private javax.swing.JLabel jLabel8; - private javax.swing.JLabel jLabel80; - private javax.swing.JLabel jLabel81; - private javax.swing.JLabel jLabel82; - private javax.swing.JLabel jLabel83; - private javax.swing.JLabel jLabel84; - private javax.swing.JLabel jLabel85; - private javax.swing.JLabel jLabel86; - private javax.swing.JLabel jLabel87; - private javax.swing.JLabel jLabel88; - private javax.swing.JLabel jLabel89; - private javax.swing.JLabel jLabel9; - private javax.swing.JLabel jLabel90; - private javax.swing.JLabel jLabel91; - private javax.swing.JLabel jLabel92; - private javax.swing.JLabel jLabel93; - private javax.swing.JMenuBar jMenuBar1; - private javax.swing.JMenuItem jMenuItem1; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel10; - private javax.swing.JPanel jPanel11; - private javax.swing.JPanel jPanel5; - private javax.swing.JPanel jPanel6; - private javax.swing.JPanel jPanel7; - private javax.swing.JPanel jPanel8; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JScrollPane jScrollPane14; - private javax.swing.JScrollPane jScrollPane19; - private javax.swing.JScrollPane jScrollPane20; - private javax.swing.JScrollPane jScrollPane21; - private javax.swing.JScrollPane jScrollPane22; - private javax.swing.JScrollPane jScrollPane23; - private javax.swing.JScrollPane jScrollPane24; - private javax.swing.JScrollPane jScrollPane8; - private javax.swing.JScrollPane jScrollPane9; - private javax.swing.JToolBar.Separator jSeparator1; - private javax.swing.JSeparator jSeparator10; - private javax.swing.JSeparator jSeparator11; - private javax.swing.JSeparator jSeparator12; - private javax.swing.JSeparator jSeparator13; - private javax.swing.JSeparator jSeparator14; - private javax.swing.JSeparator jSeparator15; - private javax.swing.JSeparator jSeparator16; - private javax.swing.JSeparator jSeparator17; - private javax.swing.JSeparator jSeparator18; - private javax.swing.JSeparator jSeparator19; - private javax.swing.JToolBar.Separator jSeparator2; - private javax.swing.JSeparator jSeparator20; - private javax.swing.JToolBar.Separator jSeparator21; - private javax.swing.JSeparator jSeparator22; - private javax.swing.JSeparator jSeparator23; - private javax.swing.JSeparator jSeparator24; - private javax.swing.JToolBar.Separator jSeparator25; - private javax.swing.JSeparator jSeparator26; - private javax.swing.JSeparator jSeparator27; - private javax.swing.JToolBar.Separator jSeparator3; - private javax.swing.JSeparator jSeparator30; - private javax.swing.JToolBar.Separator jSeparator4; - private javax.swing.JSeparator jSeparator5; - private javax.swing.JSeparator jSeparator6; - private javax.swing.JSeparator jSeparator7; - private javax.swing.JSeparator jSeparator8; - private javax.swing.JSeparator jSeparator9; + private javax.swing.JLabel lblMMNameInfo; private javax.swing.JTextArea jTextAreaBFConversion; private javax.swing.JLabel lblArmorCoverage; private javax.swing.JLabel lblArmorLeftInLot; @@ -10067,7 +7365,6 @@ private void FixJJSpinnerModel() { private javax.swing.JLabel lblBFStructure; private javax.swing.JLabel lblBFWt; private javax.swing.JLabel lblBaseEngineRating; - private javax.swing.JLabel lblBattleMechQuirks; private javax.swing.JLabel lblEraYears; private javax.swing.JLabel lblFinalEngineRating; private javax.swing.JLabel lblFlankMP; @@ -10087,7 +7384,6 @@ private void FixJJSpinnerModel() { private javax.swing.JLabel lblInfoHeat; private javax.swing.JLabel lblInfoIntro; private javax.swing.JLabel lblInfoMountRestrict; - private javax.swing.JLabel lblInfoName; private javax.swing.JLabel lblInfoRange; private javax.swing.JLabel lblInfoReintro; private javax.swing.JLabel lblInfoRulesLevel; @@ -10096,13 +7392,12 @@ private void FixJJSpinnerModel() { private javax.swing.JLabel lblInfoType; private javax.swing.JLabel lblLeftIntPts; private javax.swing.JLabel lblMinEngineTons; + private javax.swing.JLabel lblMoveSummary; private javax.swing.JLabel lblNumCrew; - private javax.swing.JLabel lblProdYear; private javax.swing.JLabel lblRearIntPts; private javax.swing.JLabel lblRearTurretIntPts; private javax.swing.JLabel lblRightIntPts; private javax.swing.JLabel lblRotorIntPts; - private javax.swing.JLabel lblSelectVariant; private javax.swing.JLabel lblSupensionFacter; private javax.swing.JLabel lblTurretIntPts; private javax.swing.JLabel lblVeeClass; @@ -10115,81 +7410,21 @@ private void FixJJSpinnerModel() { private javax.swing.JList lstChooseMissile; private javax.swing.JList lstChoosePhysical; private javax.swing.JList lstSelectedEquipment; - private javax.swing.JMenuItem mnuAboutSSW; - private javax.swing.JMenuItem mnuBFB; - private javax.swing.JMenuItem mnuBatchHMP; - private javax.swing.JMenu mnuClearFluff; - private javax.swing.JMenuItem mnuClearUserData; - private javax.swing.JMenuItem mnuCostBVBreakdown; - private javax.swing.JMenuItem mnuCreateTCGMech; - private javax.swing.JMenuItem mnuCredits; - private javax.swing.JMenuItem mnuExit; - private javax.swing.JMenu mnuExport; - private javax.swing.JMenuItem mnuExportClipboard; - private javax.swing.JMenuItem mnuExportHTML; - private javax.swing.JMenuItem mnuExportMTF; - private javax.swing.JMenuItem mnuExportTXT; - private javax.swing.JMenu mnuFile; - private javax.swing.JMenu mnuHelp; - private javax.swing.JMenu mnuImport; - private javax.swing.JMenuItem mnuImportHMP; - private javax.swing.JMenuItem mnuLoad; - private javax.swing.JMenuItem mnuNewMech; - private javax.swing.JMenuItem mnuOpen; - private javax.swing.JMenuItem mnuOptions; - private javax.swing.JMenu mnuPrint; - private javax.swing.JMenuItem mnuPrintPreview; - private javax.swing.JMenuItem mnuReloadEquipment; - private javax.swing.JMenuItem mnuSave; - private javax.swing.JMenuItem mnuSaveAs; - private javax.swing.JMenuItem mnuSummary; - private javax.swing.JMenuItem mnuTextTRO; private javax.swing.JMenuItem mnuUnlock; private javax.swing.JCheckBoxMenuItem mnuViewToolbar; private javax.swing.JPanel pnlAdditionalFluff; - private javax.swing.JPanel pnlAmmunition; - private javax.swing.JPanel pnlArtillery; - private javax.swing.JPanel pnlBFStats; - private javax.swing.JPanel pnlBallistic; private javax.swing.JPanel pnlBasicSetup; private javax.swing.JPanel pnlCapabilities; - private javax.swing.JPanel pnlChassis; - private javax.swing.JPanel pnlChassisMods; - private javax.swing.JPanel pnlControls; private javax.swing.JPanel pnlDeployment; - private javax.swing.JPanel pnlEnergy; - private javax.swing.JPanel pnlEquipInfo; private javax.swing.JPanel pnlEquipment; - private javax.swing.JPanel pnlEquipmentChooser; - private javax.swing.JPanel pnlExperimental; - private javax.swing.JPanel pnlExport; - private javax.swing.JPanel pnlFluff; - private javax.swing.JPanel pnlFrontArmor; + private javax.swing.JPanel pnlEquipInfo; private javax.swing.JPanel pnlHistory; - private javax.swing.JPanel pnlImage; - private javax.swing.JPanel pnlInfoPane; - private javax.swing.JPanel pnlInformation; - private javax.swing.JPanel pnlLeftArmor; - private javax.swing.JPanel pnlManufacturers; - private javax.swing.JPanel pnlMissile; - private javax.swing.JPanel pnlMovement; private javax.swing.JPanel pnlNotables; - private javax.swing.JPanel pnlOmniInfo; private javax.swing.JPanel pnlOverview; - private javax.swing.JPanel pnlPhysical; - private javax.swing.JPanel pnlQuirks; - private javax.swing.JPanel pnlRearArmor; private javax.swing.JPanel pnlRearTurretArmor; - private javax.swing.JPanel pnlRightArmor; private javax.swing.JPanel pnlRotorArmor; - private javax.swing.JPanel pnlSelected; - private javax.swing.JPanel pnlSpecials; - private javax.swing.JPanel pnlSummary; private javax.swing.JPanel pnlTurretArmor; private javax.swing.JPanel pnlVariants; - private javax.swing.JPanel pnlWeaponsManufacturers; - private javax.swing.JScrollPane scpQuirkTable; - private javax.swing.JScrollPane scpWeaponManufacturers; private javax.swing.JSpinner spnCruiseMP; private javax.swing.JSpinner spnFrontArmor; private javax.swing.JSpinner spnHeatSinks; @@ -10202,9 +7437,8 @@ private void FixJJSpinnerModel() { private javax.swing.JSpinner spnTonnage; private javax.swing.JSpinner spnTurretArmor; private javax.swing.JSpinner spnTurretTonnage; - private javax.swing.JTable tblQuirks; + private javax.swing.JSpinner spnRearTurretTonnage; private javax.swing.JTable tblWeaponManufacturers; - private javax.swing.JTabbedPane tbpFluffEditors; private javax.swing.JTabbedPane tbpMainTabPane; private javax.swing.JTabbedPane tbpWeaponChooser; private javax.swing.JToolBar tlbIconBar; @@ -10220,10 +7454,12 @@ private void FixJJSpinnerModel() { private javax.swing.JTextField txtInfoFreeTons; private javax.swing.JTextField txtInfoTonnage; private javax.swing.JTextField txtJJModel; + private javax.swing.JTextArea txtLog; private javax.swing.JTextField txtManufacturer; private javax.swing.JTextField txtManufacturerLocation; private javax.swing.JTextField txtModel; private javax.swing.JTextField txtProdYear; + private javax.swing.JTextField txtRearTurretInfo; private javax.swing.JTextField txtSource; private javax.swing.JTextField txtSumArmAV; private javax.swing.JTextField txtSumArmSpace; @@ -10238,7 +7474,6 @@ private void FixJJSpinnerModel() { private javax.swing.JTextField txtSumIntAV; private javax.swing.JTextField txtSumIntTons; private javax.swing.JTextField txtSumJJAV; - private javax.swing.JTextField txtSumJJSpace; private javax.swing.JTextField txtSumJJTons; private javax.swing.JTextField txtSumLifAV; private javax.swing.JTextField txtSumLifTons; @@ -10253,6 +7488,7 @@ private void FixJJSpinnerModel() { private javax.swing.JTextField txtTNTSystem; private javax.swing.JTextField txtTurretInfo; private javax.swing.JTextField txtVehicleName; + private javax.swing.JTable tblQuirks; // End of variables declaration//GEN-END:variables public void lostOwnership(Clipboard clipboard, Transferable contents) { diff --git a/ssw/src/main/java/ssw/Main.java b/ssw/src/main/java/ssw/Main.java index 8b96019c..9b33ade4 100644 --- a/ssw/src/main/java/ssw/Main.java +++ b/ssw/src/main/java/ssw/Main.java @@ -119,7 +119,7 @@ public void run() { switch( screensize ) { case SSWConstants.SCREEN_SIZE_WIDE_1280: MainFrame = new frmMainWide(); - MainFrame.setSize( 1240, 610 ); + MainFrame.setSize( 1350, 650 ); break; default: MainFrame = new frmMain(); diff --git a/ssw/src/main/java/ssw/gui/dlgPrefs.form b/ssw/src/main/java/ssw/gui/dlgPrefs.form index cc35cc56..451594ce 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrefs.form +++ b/ssw/src/main/java/ssw/gui/dlgPrefs.form @@ -445,7 +445,7 @@ - + @@ -525,6 +525,16 @@ + + + + + + + + + + @@ -537,6 +547,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ssw/src/main/java/ssw/gui/dlgPrefs.java b/ssw/src/main/java/ssw/gui/dlgPrefs.java index 09ed407b..39d328a3 100644 --- a/ssw/src/main/java/ssw/gui/dlgPrefs.java +++ b/ssw/src/main/java/ssw/gui/dlgPrefs.java @@ -81,6 +81,8 @@ private void SetState() { chkHeatAllMP.setEnabled( true ); } chkHeatUAC.setSelected( Prefs.getBoolean( "HeatACFullRate", false ) ); + chkHeatStreaks.setSelected( Prefs.getBoolean( "HeatStreaksHalfRate", false ) ); + chkCostAmmoMult.setSelected( Prefs.getBoolean( "CostAmmoMult", false ) ); chkAutoAddECM.setSelected( Prefs.getBoolean( "AutoAddECM", true ) ); chkMaxNotInt.setSelected( Prefs.getBoolean( "UseMaxArmorInstead", false ) ); @@ -152,6 +154,8 @@ private void SaveState() { Prefs.putBoolean( "HeatExcludeJumpMP", chkHeatJumpMP.isSelected() ); Prefs.putBoolean( "HeatExcludeAllMP", chkHeatAllMP.isSelected() ); Prefs.putBoolean( "HeatACFullRate", chkHeatUAC.isSelected() ); + Prefs.putBoolean( "HeatStreaksHalfRate", chkHeatStreaks.isSelected() ); + Prefs.putBoolean( "CostAmmoMult", chkCostAmmoMult.isSelected() ); Prefs.putBoolean( "UseMaxArmorInstead", chkMaxNotInt.isSelected() ); Prefs.putBoolean( "ArmorUseCustomPercent", chkCustomPercents.isSelected() ); Prefs.putBoolean( "ArmorMaxHead", rdoArmorMaxHead.isSelected() ); @@ -214,6 +218,8 @@ private void SetDefaults() { Prefs.putBoolean( "HeatExcludeJumpMP", false ); Prefs.putBoolean( "HeatExcludeAllMP", false ); Prefs.putBoolean( "HeatACFullRate", false ); + Prefs.putBoolean( "HeatStreaksHalfRate", false ); + Prefs.putBoolean( "CostAmmoMult", false ); Prefs.putBoolean( "UseMaxArmorInstead", false ); Prefs.putBoolean( "ArmorUseCustomPercent", false ); Prefs.putBoolean( "ArmorMaxHead", true ); @@ -292,7 +298,10 @@ private void initComponents() { chkHeatJumpMP = new javax.swing.JCheckBox(); chkHeatAllMP = new javax.swing.JCheckBox(); chkHeatUAC = new javax.swing.JCheckBox(); + chkHeatStreaks = new javax.swing.JCheckBox(); jLabel19 = new javax.swing.JLabel(); + jPanel15 = new javax.swing.JPanel(); + chkCostAmmoMult = new javax.swing.JCheckBox(); jPanel13 = new javax.swing.JPanel(); chkAutoAddECM = new javax.swing.JCheckBox(); jPanel4 = new javax.swing.JPanel(); @@ -660,6 +669,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); jPanel8.add(chkHeatUAC, gridBagConstraints); + chkHeatStreaks.setText("Streaks have 50% fire rate (ala MML)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 8; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); + jPanel8.add(chkHeatStreaks, gridBagConstraints); + jLabel19.setText("Non-BV Heat Calculations:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; @@ -668,10 +685,25 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; - gridBagConstraints.gridheight = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; pnlConstruction.add(jPanel8, gridBagConstraints); + jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Cost Options")); + jPanel15.setLayout(new java.awt.GridBagLayout()); + + chkCostAmmoMult.setText("Apply weight mult to ammo (ala MML)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0); + jPanel15.add(chkCostAmmoMult, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; + pnlConstruction.add(jPanel15, gridBagConstraints); + jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Usability Options")); jPanel13.setLayout(new javax.swing.BoxLayout(jPanel13, javax.swing.BoxLayout.LINE_AXIS)); @@ -1653,6 +1685,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JButton btnSetDefaults; private javax.swing.JButton btnTXTPath; private javax.swing.JCheckBox chkAutoAddECM; + private javax.swing.JCheckBox chkCostAmmoMult; private javax.swing.JCheckBox chkCustomPercents; private javax.swing.JCheckBox chkGroupAmmoAtBottom; private javax.swing.JCheckBox chkHeatAllMP; @@ -1660,6 +1693,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JCheckBox chkHeatJumpMP; private javax.swing.JCheckBox chkHeatOSWeapons; private javax.swing.JCheckBox chkHeatRearWeapons; + private javax.swing.JCheckBox chkHeatStreaks; private javax.swing.JCheckBox chkHeatSystems; private javax.swing.JCheckBox chkHeatUAC; private javax.swing.JCheckBox chkLoadLastMech; @@ -1691,6 +1725,7 @@ private void btnDefaultImagePathActionPerformed(java.awt.event.ActionEvent evt) private javax.swing.JPanel jPanel12; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel14; + private javax.swing.JPanel jPanel15; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; diff --git a/ssw/src/main/java/ssw/gui/dlgQuirks.java b/ssw/src/main/java/ssw/gui/dlgQuirks.java index 3ec4471b..2106df2e 100644 --- a/ssw/src/main/java/ssw/gui/dlgQuirks.java +++ b/ssw/src/main/java/ssw/gui/dlgQuirks.java @@ -44,11 +44,17 @@ public dlgQuirks(java.awt.Frame parent, boolean modal, DataFactory quirks, Array initComponents(); list = quirks; + ArrayList mechQuirks = new ArrayList(); + for (Quirk item : list.GetQuirks()) { + if (item.isBattlemech() || item.isIndustrialmech()) { + mechQuirks.add(item); + } + } existingQuirks = currentQuirks; tblQ = new tbQuirks(currentQuirks); tblQ.setupTable(tblSelected); - tblList.setModel(new tbQuirks(list.GetQuirks())); + tblList.setModel(new tbQuirks(mechQuirks)); } private void Refresh() @@ -193,36 +199,36 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pack(); }// //GEN-END:initComponents - private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed + private void btnAddActionPerformed(java.awt.event.ActionEvent evt) { Quirk q = (Quirk)((tbQuirks) tblList.getModel()).get( tblList.convertRowIndexToModel( tblList.getSelectedRow() )); tblQ.quirklist.add(q); Refresh(); - }//GEN-LAST:event_btnAddActionPerformed + } - private void btnRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveActionPerformed + private void btnRemoveActionPerformed(java.awt.event.ActionEvent evt) { Quirk q = (Quirk)((tbQuirks) tblSelected.getModel()).get( tblSelected.convertRowIndexToModel( tblSelected.getSelectedRow() )); tblQ.quirklist.remove(q); Refresh(); - }//GEN-LAST:event_btnRemoveActionPerformed + } - private void btnDoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDoneActionPerformed + private void btnDoneActionPerformed(java.awt.event.ActionEvent evt) { setVisible( false ); - }//GEN-LAST:event_btnDoneActionPerformed + } - private void tblListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblListMouseClicked + private void tblListMouseClicked(java.awt.event.MouseEvent evt) { if ( evt.getClickCount() == 2 ) { btnAddActionPerformed(null); } - }//GEN-LAST:event_tblListMouseClicked + } - private void tblSelectedMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblSelectedMouseClicked + private void tblSelectedMouseClicked(java.awt.event.MouseEvent evt) { if ( evt.getClickCount() == 2 ) { btnRemoveActionPerformed(null); } - }//GEN-LAST:event_tblSelectedMouseClicked + } - // Variables declaration - do not modify//GEN-BEGIN:variables + // Variables declaration - do not modify private javax.swing.JButton btnAdd; private javax.swing.JButton btnDone; private javax.swing.JButton btnRemove; @@ -231,6 +237,6 @@ private void tblSelectedMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST private javax.swing.JLabel lblBattleMechQuirks; private javax.swing.JTable tblList; private javax.swing.JTable tblSelected; - // End of variables declaration//GEN-END:variables + // End of variables declaration } diff --git a/ssw/src/main/java/ssw/gui/dlgSSWFiles.java b/ssw/src/main/java/ssw/gui/dlgSSWFiles.java index a46c7230..e8e209a2 100644 --- a/ssw/src/main/java/ssw/gui/dlgSSWFiles.java +++ b/ssw/src/main/java/ssw/gui/dlgSSWFiles.java @@ -56,7 +56,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - jLabel1.setText("\n

Solaris Skunkwerks needs to know where you have placed your Mech files.

\n

If you have not downloaded the zip file containing these files yet please go to
\n

http://www.solarisskunkwerks.com/downloads


\n and download the Master file available there.

\n
\n

Once this file has downloaded you can unzip it wherever you would like as the next step will be to tell SSW where you put them.

"); + jLabel1.setText("\n

Solaris Skunkwerks needs to know where you have placed your Mech files.

\n

If you have not downloaded the zip file containing these files yet please go to
\n

https://github.com/Solaris-Skunk-Werks/SSW-Master/archive/refs/heads/master.zip


\n and download the Master file available there.

\n
\n

Once this file has downloaded you can unzip it wherever you would like as the next step will be to tell SSW where you put them.

"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); diff --git a/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java b/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java index 8651facf..7ed648cd 100644 --- a/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java +++ b/ssw/src/main/java/ssw/gui/dlgSelectiveAllocate.java @@ -70,10 +70,10 @@ public dlgSelectiveAllocate( java.awt.Frame parent, boolean modal, EquipmentColl private void InitializeSingle() { if( Parent.GetMech().IsQuad() ) { - ((TitledBorder) pnlRA.getBorder()).setTitle( "RFL" ); - ((TitledBorder) pnlLA.getBorder()).setTitle( "LFL" ); + ((TitledBorder) pnlRA.getBorder()).setTitle( "FRL" ); + ((TitledBorder) pnlLA.getBorder()).setTitle( "FRL" ); ((TitledBorder) pnlRL.getBorder()).setTitle( "RRL" ); - ((TitledBorder) pnlLL.getBorder()).setTitle( "LRL" ); + ((TitledBorder) pnlLL.getBorder()).setTitle( "RLL" ); } else { ((TitledBorder) pnlRA.getBorder()).setTitle( "RA" ); ((TitledBorder) pnlLA.getBorder()).setTitle( "LA" ); diff --git a/ssw/src/main/java/ssw/gui/frmMain.form b/ssw/src/main/java/ssw/gui/frmMain.form index 1a9dd9b6..804b7b8f 100644 --- a/ssw/src/main/java/ssw/gui/frmMain.form +++ b/ssw/src/main/java/ssw/gui/frmMain.form @@ -940,7 +940,7 @@ - + @@ -952,6 +952,7 @@ + @@ -4978,10 +4979,10 @@ - + - - + + @@ -6494,9 +6495,9 @@ - + - + @@ -8155,15 +8156,15 @@ - + - + - + - + @@ -8252,13 +8253,13 @@ - + - + - +
diff --git a/ssw/src/main/java/ssw/gui/frmMain.java b/ssw/src/main/java/ssw/gui/frmMain.java index 54717c53..5213101e 100644 --- a/ssw/src/main/java/ssw/gui/frmMain.java +++ b/ssw/src/main/java/ssw/gui/frmMain.java @@ -49,6 +49,7 @@ import visitors.ifVisitor; import javax.swing.*; +import javax.swing.event.ListSelectionListener; import javax.swing.text.JTextComponent; import java.awt.*; import java.awt.datatransfer.DataFlavor; @@ -457,6 +458,7 @@ public void actionPerformed(ActionEvent e) { cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); cmbCockpitType.setSelectedItem( SSWConstants.DEFAULT_COCKPIT ); + chkCommandConsole.setSelected( false ); cmbPhysEnhance.setSelectedItem( SSWConstants.DEFAULT_ENHANCEMENT ); cmbHeatSinkType.setSelectedItem( Prefs.get( "NewMech_Heatsinks", "Single Heat Sink" ) ); cmbJumpJetType.setSelectedItem( SSWConstants.DEFAULT_JUMPJET ); @@ -480,7 +482,7 @@ public String getColumnName( int col ) { public Object getValueAt( int row, int col ) { Object o = CurMech.GetLoadout().GetEquipment().get( row ); if( col == 1 ) { - return ((abPlaceable) o).GetManufacturer(); + return CommonTools.UnknownToEmpty( ((abPlaceable) o).GetManufacturer() ); } else { return ((abPlaceable) o).CritName(); } @@ -1556,6 +1558,10 @@ private void RecalcCockpit() { try { CurMech.Visit( v ); + + if (!CurMech.GetCockpit().CanArmor()) + CurMech.GetCockpit().ArmorComponent(false); + } catch( Exception e ) { v = (ifVisitor) CurMech.Lookup( OldVal ); try { @@ -2012,15 +2018,7 @@ private void CheckOmnimech() { // now let's ensure that all the omni controls are enabled or disabled // as appropriate - if( chkOmnimech.isEnabled() ) { - if( chkOmnimech.isSelected() ) { - btnLockChassis.setEnabled( true ); - } else { - btnLockChassis.setEnabled( false ); - } - } else { - btnLockChassis.setEnabled( false ); - } + btnLockChassis.setEnabled( chkOmnimech.isEnabled() && chkOmnimech.isSelected() ); } private void SaveOmniFluffInfo() { @@ -2033,23 +2031,7 @@ private void SaveOmniFluffInfo() { CurMech.SetYear( Integer.parseInt( txtProdYear.getText() ), chkYearRestrict.isSelected() ); } catch( Exception e ) { // nothing really to be done, set it to a default. - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3132, false ); - break; - case AvailableCode.ERA_ALL: - CurMech.SetYear( 0, false ); - break; - } + CurMech.SetYear( CommonTools.GetEraDefaultYear( cmbMechEra.getSelectedIndex() ), false ); } } } @@ -2059,7 +2041,7 @@ private void LoadOmniFluffInfo() { cmbMechEra.setSelectedIndex( CurMech.GetEra() ); cmbProductionEra.setSelectedIndex( CurMech.GetProductionEra() ); txtSource.setText( CurMech.GetSource() ); - txtProdYear.setText( "" + CurMech.GetYear() ); + txtProdYear.setText( CurMech.YearWasSpecified() ? "" + CurMech.GetYear() : "" ); BuildTechBaseSelector(); } @@ -2181,7 +2163,7 @@ public void RefreshInfoPane() { txtInfoTonnage.setText( "Tons: " + CurMech.GetCurrentTons() ); txtInfoFreeTons.setText( "Free Tons: " + ( CurMech.GetTonnage() - CurMech.GetCurrentTons() ) ); } - txtInfoMaxHeat.setText( "Max Heat: " + CurMech.GetMaxHeat() ); + txtInfoMaxHeat.setText( "Max Heat: " + String.format( "%1$,.1f", CurMech.GetMaxHeat() ) ); txtInfoHeatDiss.setText( "Heat Dissipation: " + CurMech.GetHeatSinks().TotalDissipation() ); txtInfoFreeCrits.setText( "Free Crits: " + CurMech.GetLoadout().FreeCrits() ); txtInfoUnplaced.setText( "Unplaced Crits: " + CurMech.GetLoadout().UnplacedCrits() ); @@ -2648,23 +2630,7 @@ private void GetNewMech() { CurMech.SetEra( cmbMechEra.getSelectedIndex() ); CurMech.SetProductionEra( cmbProductionEra.getSelectedIndex() ); CurMech.SetRulesLevel( cmbRulesLevel.getSelectedIndex() ); - switch( CurMech.GetEra() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3130, false ); - break; - case AvailableCode.ERA_ALL: - CurMech.SetYear( 0, false ); - break; - } + CurMech.SetYear( CommonTools.GetEraDefaultYear( CurMech.GetEra() ), false ); BuildTechBaseSelector(); cmbTechBase.setSelectedItem( Prefs.get( "NewMech_Techbase", "Inner Sphere" ) ); switch( cmbTechBase.getSelectedIndex() ) { @@ -2709,6 +2675,7 @@ private void GetNewMech() { cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); cmbCockpitType.setSelectedItem( SSWConstants.DEFAULT_COCKPIT ); + chkCommandConsole.setSelected( false ); cmbPhysEnhance.setSelectedItem( SSWConstants.DEFAULT_ENHANCEMENT ); cmbHeatSinkType.setSelectedItem( Prefs.get( "NewMech_Heatsinks", "Single Heat Sink" ) ); cmbJumpJetType.setSelectedItem( SSWConstants.DEFAULT_JUMPJET ); @@ -2776,7 +2743,7 @@ public String getColumnName( int col ) { public Object getValueAt( int row, int col ) { Object o = CurMech.GetLoadout().GetEquipment().get( row ); if( col == 1 ) { - return ((abPlaceable) o).GetManufacturer(); + return CommonTools.UnknownToEmpty( ((abPlaceable) o).GetManufacturer() ); } else { return ((abPlaceable) o).CritName(); } @@ -3162,23 +3129,14 @@ private void RemoveItemCritTab() { private void SolidifyMech() { // sets some of the basic mech information normally kept in the BFB.GUI and // prepares the mech for saving to file - int year = 0; + int year; CurMech.SetName( txtMechName.getText() ); CurMech.SetModel( txtMechModel.getText() ); if( txtProdYear.getText().isEmpty() ) { - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3132, false ); - break; + year = CommonTools.GetEraDefaultYear( cmbMechEra.getSelectedIndex() ); + if( year != 0 ) { + CurMech.SetYear( year, false ); + txtProdYear.setText( "" + year ); } } else { try{ @@ -3242,7 +3200,6 @@ private void FixTransferHandlers() { private void LockGUIForOmni() { // this locks most of the BFB.GUI controls. Used mainly by Omnimechs. - chkOmnimech.setSelected( true ); chkOmnimech.setEnabled( false ); mnuUnlock.setEnabled( true ); cmbTonnage.setEnabled( false ); @@ -3358,7 +3315,6 @@ private void LockGUIForOmni() { private void UnlockGUIFromOmni() { // this should be used anytime a new mech is made or when unlocking // an omnimech. - chkOmnimech.setSelected( false ); chkOmnimech.setEnabled( true ); mnuUnlock.setEnabled( false ); cmbTonnage.setEnabled( true ); @@ -3388,7 +3344,6 @@ private void UnlockGUIFromOmni() { btnEfficientArmor.setEnabled( true ); btnBalanceArmor.setEnabled( true ); cmbJumpJetType.setEnabled( true ); - btnLockChassis.setEnabled( true ); chkFCSAIV.setEnabled( true ); chkFCSAV.setEnabled( true ); chkFCSApollo.setEnabled( true ); @@ -3406,9 +3361,7 @@ private void UnlockGUIFromOmni() { chkHDTurret.setEnabled( true ); chkLTTurret.setEnabled( true ); chkRTTurret.setEnabled( true ); - chkOmnimech.setSelected( false ); - chkOmnimech.setEnabled( true ); - btnLockChassis.setEnabled( false ); + btnLockChassis.setEnabled( chkOmnimech.isSelected() ); spnWalkMP.setEnabled( true ); chkYearRestrict.setEnabled( true ); chkNullSig.setEnabled( true ); @@ -3537,6 +3490,7 @@ private boolean VerifyMech( ActionEvent evt ) { private void ConfigureUtilsMenu( java.awt.Component c ) { // configures the utilities popup menu + boolean rear = LegalRearMount( CurItem ); boolean armor = LegalArmoring( CurItem ) && CommonTools.IsAllowed( abPlaceable.ArmoredAC, CurMech ); boolean cap = LegalCapacitor( CurItem ) && CommonTools.IsAllowed( PPCCapAC, CurMech ); boolean insul = LegalInsulator( CurItem ) && CommonTools.IsAllowed( LIAC, CurMech ); @@ -3545,11 +3499,7 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { boolean lotchange = LegalLotChange( CurItem ); boolean turreted = LegalTurretMount( CurItem ); boolean dumper = LegalDumper( CurItem ); - mnuArmorComponent.setEnabled( armor ); - mnuAddCapacitor.setEnabled( cap ); - mnuAddInsulator.setEnabled( insul ); - mnuAddPulseModule.setEnabled(pulseModule); - mnuCaseless.setEnabled( caseless ); + mnuMountRear.setVisible( rear ); mnuArmorComponent.setVisible( armor ); mnuAddCapacitor.setVisible( cap ); mnuAddInsulator.setVisible( insul ); @@ -3558,6 +3508,13 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { mnuSetLotSize.setVisible( lotchange ); mnuTurret.setVisible( turreted ); mnuDumper.setVisible( dumper ); + if( rear ) { + if( CurItem.IsMountedRear() ) { + mnuMountRear.setText( "Unmount Rear " ); + } else { + mnuMountRear.setText( "Mount Rear " ); + } + } if( armor ) { if( CurItem.IsArmored() ) { mnuArmorComponent.setText( "Unarmor Component" ); @@ -3565,8 +3522,8 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { mnuArmorComponent.setText( "Armor Component" ); } } - if( turreted && ( CurItem instanceof RangedWeapon ) ) { - if( ((RangedWeapon) CurItem).IsTurreted() ) { + if( turreted ) { + if( CurItem.IsTurreted() ) { mnuTurret.setText( "Remove from Turret" ); } else { mnuTurret.setText( "Add to Turret"); @@ -3675,22 +3632,6 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { mnuUnallocateAll.setText( "Unallocate All" ); mnuUnallocateAll.setEnabled( false ); } - if( c == lstHDCrits || c == lstCTCrits || c == lstLTCrits || c == lstRTCrits || c == lstLLCrits || c == lstRLCrits || ( CurMech.IsQuad() && (c == lstRACrits || c == lstLACrits))) { - if( CurItem.CanMountRear() ) { - mnuMountRear.setEnabled( true ); - if( CurItem.IsMountedRear() ) { - mnuMountRear.setText( "Unmount Rear " ); - } else { - mnuMountRear.setText( "Mount Rear " ); - } - } else { - mnuMountRear.setEnabled( false ); - mnuMountRear.setText( "Mount Rear " ); - } - } else { - mnuMountRear.setEnabled( false ); - mnuMountRear.setText( "Mount Rear " ); - } if( CurItem.Contiguous() ) { EquipmentCollection C = CurMech.GetLoadout().GetCollection( CurItem ); if( C == null ) { @@ -3862,57 +3803,19 @@ private void PulseModule() { } private void TurretMount() { - if( CurItem instanceof RangedWeapon ) { - RangedWeapon w = (RangedWeapon) CurItem; - int location = CurMech.GetLoadout().Find( CurItem ); - if( w.IsTurreted() ) { - if( location == LocationIndex.MECH_LOC_HD ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot remove from turret!" ); - return; - } - } else { - if( location == LocationIndex.MECH_LOC_HD ) { - w.AddToTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.AddToTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.AddToTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot add to turret!" ); - return; - } - } - } else if( CurItem instanceof MGArray ) { - MGArray w = (MGArray) CurItem; + if( CurItem.IsTurreted() ) { + CurItem.MountTurret( null ); + } else { int location = CurMech.GetLoadout().Find( CurItem ); - if( w.IsTurreted() ) { - if( location == LocationIndex.MECH_LOC_HD ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot remove from turret!" ); - return; - } + if( location == LocationIndex.MECH_LOC_HD ) { + CurItem.MountTurret( CurMech.GetLoadout().GetHDTurret() ); + } else if( location == LocationIndex.MECH_LOC_LT ) { + CurItem.MountTurret( CurMech.GetLoadout().GetLTTurret() ); + } else if( location == LocationIndex.MECH_LOC_RT ) { + CurItem.MountTurret( CurMech.GetLoadout().GetRTTurret() ); } else { - if( location == LocationIndex.MECH_LOC_HD ) { - w.AddToTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.AddToTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.AddToTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot add to turret!" ); - return; - } + Media.Messager( this, "Invalid turret location!" ); + return; } } RefreshInfoPane(); @@ -4048,6 +3951,23 @@ public void SetVariableSize() { } } + public boolean LegalRearMount( abPlaceable p ) { + switch( CurMech.GetLoadout().Find( p ) ) { + case LocationIndex.MECH_LOC_HD: + case LocationIndex.MECH_LOC_CT: + case LocationIndex.MECH_LOC_LT: + case LocationIndex.MECH_LOC_RT: + case LocationIndex.MECH_LOC_LL: + case LocationIndex.MECH_LOC_RL: + return CurItem.CanMountRear(); + case LocationIndex.MECH_LOC_LA: + case LocationIndex.MECH_LOC_RA: + return CurMech.IsQuad() && CurItem.CanMountRear(); + default: + return false; + } + } + public boolean LegalArmoring( abPlaceable p ) { // This tells us whether it is legal to armor a particular component if( p.CanArmor() ) { @@ -4103,7 +4023,7 @@ public boolean LegalCaseless( abPlaceable p ) { } public boolean LegalTurretMount( abPlaceable p ) { - if( ! (( p instanceof RangedWeapon ) || ( p instanceof MGArray )) ) { return false; } + if( ! p.CanMountTurret() ) { return false; } int location = CurMech.GetLoadout().Find( p ); if( location == LocationIndex.MECH_LOC_HD ) { if( CurMech.IsOmnimech() ) { @@ -4978,41 +4898,13 @@ private void initComponents() { lblPWRLLoc = new javax.swing.JLabel(); pnlEquipment = new javax.swing.JPanel(); tbpWeaponChooser = new javax.swing.JTabbedPane(); - pnlBallistic = new javax.swing.JPanel(); - jSeparator3 = new javax.swing.JSeparator(); - jScrollPane8 = new javax.swing.JScrollPane(); lstChooseBallistic = new javax.swing.JList(); - jSeparator4 = new javax.swing.JSeparator(); - pnlEnergy = new javax.swing.JPanel(); - jSeparator2 = new javax.swing.JSeparator(); - jScrollPane9 = new javax.swing.JScrollPane(); lstChooseEnergy = new javax.swing.JList(); - jSeparator1 = new javax.swing.JSeparator(); - pnlMissile = new javax.swing.JPanel(); - jSeparator5 = new javax.swing.JSeparator(); - jScrollPane19 = new javax.swing.JScrollPane(); lstChooseMissile = new javax.swing.JList(); - jSeparator6 = new javax.swing.JSeparator(); - pnlPhysical = new javax.swing.JPanel(); - jSeparator8 = new javax.swing.JSeparator(); - jScrollPane20 = new javax.swing.JScrollPane(); lstChoosePhysical = new javax.swing.JList(); - jSeparator7 = new javax.swing.JSeparator(); - pnlEquipmentChooser = new javax.swing.JPanel(); - jSeparator10 = new javax.swing.JSeparator(); - jScrollPane21 = new javax.swing.JScrollPane(); lstChooseEquipment = new javax.swing.JList(); - jSeparator9 = new javax.swing.JSeparator(); - pnlArtillery = new javax.swing.JPanel(); - jSeparator18 = new javax.swing.JSeparator(); - jScrollPane24 = new javax.swing.JScrollPane(); lstChooseArtillery = new javax.swing.JList(); - jSeparator19 = new javax.swing.JSeparator(); - pnlAmmunition = new javax.swing.JPanel(); - jSeparator11 = new javax.swing.JSeparator(); - jScrollPane22 = new javax.swing.JScrollPane(); lstChooseAmmunition = new javax.swing.JList(); - jSeparator12 = new javax.swing.JSeparator(); pnlSpecials = new javax.swing.JPanel(); jLabel16 = new javax.swing.JLabel(); chkUseTC = new javax.swing.JCheckBox(); @@ -5021,7 +4913,7 @@ private void initComponents() { chkFCSApollo = new javax.swing.JCheckBox(); chkClanCASE = new javax.swing.JCheckBox(); pnlSelected = new javax.swing.JPanel(); - jScrollPane23 = new javax.swing.JScrollPane(); + scrSelectedEquip = new javax.swing.JScrollPane(); lstSelectedEquipment = new javax.swing.JList(); pnlControls = new javax.swing.JPanel(); btnRemoveEquip = new javax.swing.JButton(); @@ -5117,7 +5009,7 @@ private void initComponents() { lstRLCrits = new javax.swing.JList(); chkRLCASE2 = new javax.swing.JCheckBox(); pnlEquipmentToPlace = new javax.swing.JPanel(); - jScrollPane18 = new javax.swing.JScrollPane(); + scrEquipToPlace = new javax.swing.JScrollPane(); lstCritsToPlace = new javax.swing.JList(); btnRemoveItemCrits = new javax.swing.JButton(); onlLoadoutControls = new javax.swing.JPanel(); @@ -5697,7 +5589,7 @@ public void mousePressed( MouseEvent e ) { pnlBasicInformation.add(jSeparator28, new java.awt.GridBagConstraints()); pnlBasicInformation.add(jSeparator29, new java.awt.GridBagConstraints()); - cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages" })); + cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages", "ilClan" })); cmbProductionEra.setMaximumSize(new java.awt.Dimension(90, 20)); cmbProductionEra.setMinimumSize(new java.awt.Dimension(90, 20)); cmbProductionEra.setPreferredSize(new java.awt.Dimension(90, 20)); @@ -7625,339 +7517,32 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlEquipment.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); - tbpWeaponChooser.setTabPlacement(javax.swing.JTabbedPane.RIGHT); - tbpWeaponChooser.setMaximumSize(new java.awt.Dimension(300, 300)); - tbpWeaponChooser.setMinimumSize(new java.awt.Dimension(300, 300)); - tbpWeaponChooser.setPreferredSize(new java.awt.Dimension(300, 300)); - - pnlBallistic.setLayout(new javax.swing.BoxLayout(pnlBallistic, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator3.setAlignmentX(0.0F); - jSeparator3.setAlignmentY(0.0F); - pnlBallistic.add(jSeparator3); - - jScrollPane8.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane8.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane8.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseBallistic.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseBallistic.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseBallistic.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseBallistic.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseBallistic.setVisibleRowCount(16); - lstChooseBallistic.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseBallisticValueChanged(evt); - } - }); - MouseListener mlBallistic = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseBallistic.addMouseListener( mlBallistic ); - lstChooseBallistic.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane8.setViewportView(lstChooseBallistic); - - pnlBallistic.add(jScrollPane8); - - jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator4.setAlignmentX(0.0F); - jSeparator4.setAlignmentY(0.0F); - pnlBallistic.add(jSeparator4); - - tbpWeaponChooser.addTab("Ballistic", pnlBallistic); - - pnlEnergy.setLayout(new javax.swing.BoxLayout(pnlEnergy, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator2.setAlignmentX(0.0F); - jSeparator2.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator2); - - jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane9.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEnergy.setModel(new javax.swing.AbstractListModel() { + //region Equipment Tab / Weapons and Equipment Lists + AbstractListModel placeholder = new AbstractListModel() { String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEnergy.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEnergy.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEnergy.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEnergy.setVisibleRowCount(16); - lstChooseEnergy.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEnergyValueChanged(evt); - } - }); - MouseListener mlEnergy = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } }; - lstChooseEnergy.addMouseListener( mlEnergy ); - lstChooseEnergy.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane9.setViewportView(lstChooseEnergy); - - pnlEnergy.add(jScrollPane9); - - jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator1.setAlignmentX(0.0F); - jSeparator1.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator1); - - tbpWeaponChooser.addTab("Energy", pnlEnergy); - - pnlMissile.setLayout(new javax.swing.BoxLayout(pnlMissile, javax.swing.BoxLayout.Y_AXIS)); - jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator5.setAlignmentX(0.0F); - jSeparator5.setAlignmentY(0.0F); - pnlMissile.add(jSeparator5); - - jScrollPane19.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane19.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane19.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseMissile.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseMissile.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseMissile.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseMissile.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseMissile.setVisibleRowCount(16); - lstChooseMissile.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseMissileValueChanged(evt); - } - }); - MouseListener mlMissile = new MouseAdapter() { + MouseListener mlAddEquip = new MouseAdapter() { public void mouseClicked( MouseEvent e ) { if ( e.getClickCount() == 2 && e.getButton() == 1 ) { btnAddEquipActionPerformed( null ); } } }; - lstChooseMissile.addMouseListener( mlMissile ); - lstChooseMissile.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane19.setViewportView(lstChooseMissile); - - pnlMissile.add(jScrollPane19); - - jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator6.setAlignmentX(0.0F); - jSeparator6.setAlignmentY(0.0F); - pnlMissile.add(jSeparator6); - - tbpWeaponChooser.addTab("Missile", pnlMissile); - pnlPhysical.setLayout(new javax.swing.BoxLayout(pnlPhysical, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator8.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator8.setAlignmentX(0.0F); - jSeparator8.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator8); - - jScrollPane20.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane20.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane20.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChoosePhysical.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChoosePhysical.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChoosePhysical.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChoosePhysical.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChoosePhysical.setVisibleRowCount(16); - lstChoosePhysical.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChoosePhysicalValueChanged(evt); - } - }); - MouseListener mlPhysical = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChoosePhysical.addMouseListener( mlPhysical ); - lstChoosePhysical.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane20.setViewportView(lstChoosePhysical); - - pnlPhysical.add(jScrollPane20); - - jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator7.setAlignmentX(0.0F); - jSeparator7.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator7); - - tbpWeaponChooser.addTab("Physical", pnlPhysical); - - pnlEquipmentChooser.setLayout(new javax.swing.BoxLayout(pnlEquipmentChooser, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator10.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator10.setAlignmentX(0.0F); - jSeparator10.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator10); - - jScrollPane21.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane21.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane21.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEquipment.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEquipment.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEquipment.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEquipment.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEquipment.setVisibleRowCount(16); - lstChooseEquipment.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEquipmentValueChanged(evt); - } - }); - MouseListener mlEquipment = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseEquipment.addMouseListener( mlEquipment ); - lstChooseEquipment.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane21.setViewportView(lstChooseEquipment); - - pnlEquipmentChooser.add(jScrollPane21); - - jSeparator9.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator9.setAlignmentX(0.0F); - jSeparator9.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator9); - - tbpWeaponChooser.addTab("Equipment", pnlEquipmentChooser); - - pnlArtillery.setLayout(new javax.swing.BoxLayout(pnlArtillery, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator18.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator18.setAlignmentX(0.0F); - jSeparator18.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator18); - - jScrollPane24.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane24.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane24.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseArtillery.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseArtillery.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseArtillery.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseArtillery.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseArtillery.setVisibleRowCount(16); - lstChooseArtillery.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseArtilleryValueChanged(evt); - } - }); - MouseListener mlArtillery = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseArtillery.addMouseListener( mlArtillery ); - lstChooseArtillery.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane24.setViewportView(lstChooseArtillery); - - pnlArtillery.add(jScrollPane24); - - jSeparator19.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator19.setAlignmentX(0.0F); - jSeparator19.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator19); - - tbpWeaponChooser.addTab("Artillery", pnlArtillery); - - pnlAmmunition.setLayout(new javax.swing.BoxLayout(pnlAmmunition, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator11.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator11.setAlignmentX(0.0F); - jSeparator11.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator11); - - jScrollPane22.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane22.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane22.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseAmmunition.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseAmmunition.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseAmmunition.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseAmmunition.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseAmmunition.setVisibleRowCount(16); - lstChooseAmmunition.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseAmmunitionValueChanged(evt); - } - }); - MouseListener mlAmmo = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseAmmunition.addMouseListener( mlAmmo ); - lstChooseAmmunition.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane22.setViewportView(lstChooseAmmunition); - - pnlAmmunition.add(jScrollPane22); - - jSeparator12.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator12.setAlignmentX(0.0F); - jSeparator12.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator12); - - tbpWeaponChooser.addTab("Ammunition", pnlAmmunition); + tbpWeaponChooser.setTabPlacement(javax.swing.JTabbedPane.RIGHT); + tbpWeaponChooser.setMaximumSize(new java.awt.Dimension(300, 300)); + tbpWeaponChooser.setMinimumSize(new java.awt.Dimension(300, 300)); + tbpWeaponChooser.setPreferredSize(new java.awt.Dimension(300, 300)); + tbpWeaponChooser.addTab("Ballistic", EquipmentLocation(lstChooseBallistic, this::lstChooseBallisticValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Energy", EquipmentLocation(lstChooseEnergy, this::lstChooseEnergyValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Missile", EquipmentLocation(lstChooseMissile, this::lstChooseMissileValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Physical", EquipmentLocation(lstChoosePhysical, this::lstChoosePhysicalValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Equipment", EquipmentLocation(lstChooseEquipment, this::lstChooseEquipmentValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Artillery", EquipmentLocation(lstChooseArtillery, this::lstChooseArtilleryValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Ammunition", EquipmentLocation(lstChooseAmmunition, this::lstChooseAmmunitionValueChanged, mlAddEquip, placeholder)); pnlEquipment.add(tbpWeaponChooser, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, -1)); @@ -8047,11 +7632,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlSelected.setMinimumSize(new java.awt.Dimension(212, 286)); pnlSelected.setLayout(new javax.swing.BoxLayout(pnlSelected, javax.swing.BoxLayout.LINE_AXIS)); - jScrollPane23.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane23.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); + scrSelectedEquip.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrSelectedEquip.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); - lstSelectedEquipment.setModel( new javax.swing.DefaultListModel() - ); + lstSelectedEquipment.setModel( new javax.swing.DefaultListModel() ); lstSelectedEquipment.setMaximumSize(new java.awt.Dimension(180, 225)); lstSelectedEquipment.setMinimumSize(new java.awt.Dimension(180, 225)); lstSelectedEquipment.setPreferredSize(null); @@ -8088,9 +7672,9 @@ public void mousePressed( MouseEvent e ) { }; lstSelectedEquipment.addMouseListener( mlSelect ); lstSelectedEquipment.setCellRenderer( new ssw.gui.EquipmentSelectedRenderer( this ) ); - jScrollPane23.setViewportView(lstSelectedEquipment); + scrSelectedEquip.setViewportView(lstSelectedEquipment); - pnlSelected.add(jScrollPane23); + pnlSelected.add(scrSelectedEquip); pnlEquipment.add(pnlSelected, new org.netbeans.lib.awtextra.AbsoluteConstraints(492, 20, 230, 300)); @@ -9262,7 +8846,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlEquipmentToPlace.setMinimumSize(new java.awt.Dimension(146, 330)); pnlEquipmentToPlace.setLayout(new javax.swing.BoxLayout(pnlEquipmentToPlace, javax.swing.BoxLayout.PAGE_AXIS)); - jScrollPane18.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrEquipToPlace.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); lstCritsToPlace.setFont( PrintConsts.BaseCritFont ); lstCritsToPlace.setModel(new javax.swing.AbstractListModel() { @@ -9332,9 +8916,9 @@ public void valueChanged(javax.swing.event.ListSelectionEvent evt) { lstCritsToPlaceValueChanged(evt); } }); - jScrollPane18.setViewportView(lstCritsToPlace); + scrEquipToPlace.setViewportView(lstCritsToPlace); - pnlEquipmentToPlace.add(jScrollPane18); + pnlEquipmentToPlace.add(scrEquipToPlace); btnRemoveItemCrits.setText("Remove Item"); btnRemoveItemCrits.setEnabled(false); @@ -9923,7 +9507,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { tblQuirks.getColumnModel().getColumn(1).setPreferredWidth(5); } - btnAddQuirk.setText("Add Quirk"); + btnAddQuirk.setText("Manage Quirks"); btnAddQuirk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAddQuirkActionPerformed(evt); @@ -10311,10 +9895,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtInfoMaxHeat.setEditable(false); txtInfoMaxHeat.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N txtInfoMaxHeat.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtInfoMaxHeat.setText("Max Heat: 000"); - txtInfoMaxHeat.setMaximumSize(new java.awt.Dimension(77, 20)); - txtInfoMaxHeat.setMinimumSize(new java.awt.Dimension(77, 20)); - txtInfoMaxHeat.setPreferredSize(new java.awt.Dimension(77, 20)); + txtInfoMaxHeat.setText("Max Heat: 00.0"); + txtInfoMaxHeat.setMaximumSize(new java.awt.Dimension(87, 20)); + txtInfoMaxHeat.setMinimumSize(new java.awt.Dimension(87, 20)); + txtInfoMaxHeat.setPreferredSize(new java.awt.Dimension(87, 20)); pnlInfoPanel.add(txtInfoMaxHeat); txtInfoHeatDiss.setEditable(false); @@ -10357,9 +9941,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtInfoCost.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N txtInfoCost.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoCost.setText("Cost: 000,000,000"); - txtInfoCost.setMaximumSize(new java.awt.Dimension(125, 20)); - txtInfoCost.setMinimumSize(new java.awt.Dimension(125, 20)); - txtInfoCost.setPreferredSize(new java.awt.Dimension(125, 20)); + txtInfoCost.setMaximumSize(new java.awt.Dimension(115, 20)); + txtInfoCost.setMinimumSize(new java.awt.Dimension(115, 20)); + txtInfoCost.setPreferredSize(new java.awt.Dimension(115, 20)); pnlInfoPanel.add(txtInfoCost); gridBagConstraints = new java.awt.GridBagConstraints(); @@ -10655,6 +10239,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pack(); }// //GEN-END:initComponents + private JPanel EquipmentLocation(JList list, ListSelectionListener selection, MouseListener listener, AbstractListModel display) { + JPanel panel = new JPanel(); + list.setModel(display); + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + list.addListSelectionListener(selection); + list.addMouseListener( listener ); + list.setCellRenderer( new EquipmentListRenderer( this ) ); + JScrollPane pane = new JScrollPane(); + pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + pane.setViewportView(list); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(pane); + return panel; + } + private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed if( CurMech.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, @@ -10807,42 +10407,13 @@ private void cmbMechEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI int tbsave = cmbTechBase.getSelectedIndex(); // change the year range and tech base options - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - lblEraYears.setText( "2443 ~ 2800" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_STAR_LEAGUE ); - CurMech.SetYear( 2750, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_SUCCESSION: - lblEraYears.setText( "2801 ~ 3050" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_SUCCESSION ); - CurMech.SetYear( 3025, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_CLAN_INVASION: - lblEraYears.setText( "3051 ~ 3131" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_CLAN_INVASION ); - CurMech.SetYear( 3075, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_DARK_AGES: - lblEraYears.setText( "3132 on" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_DARK_AGES ); - CurMech.SetYear( 3132, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_ALL: - lblEraYears.setText( "Any" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_ALL ); - CurMech.SetYear( 0, false ); - chkYearRestrict.setEnabled( false ); - break; + lblEraYears.setText( CommonTools.GetEraYearRange( cmbMechEra.getSelectedIndex() ) ); + txtProdYear.setText( "" ); + CurMech.SetEra( cmbMechEra.getSelectedIndex() ); + if( cmbMechEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } + } else { + chkYearRestrict.setEnabled( false ); } if( CurMech.IsOmnimech() ) { @@ -12311,8 +11882,8 @@ private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F if( a != null ) { try { CurMech.GetLoadout().CheckExclusions( a ); - if( a instanceof Equipment ) { - ((Equipment)a).Validate( CurMech ); + if( a instanceof ifEquipment ) { + ((ifEquipment)a).Validate( CurMech ); } } catch( Exception e ) { Media.Messager( e.getMessage() ); @@ -12498,7 +12069,7 @@ private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN- } String filename = ""; - IO.MTFWriter mtfw = new IO.MTFWriter( CurMech ); + IO.MTFWriter mtfw = new IO.MTFWriter( CurMech, SSWConstants.AppDescription + " " + SSWConstants.GetVersion() ); try { filename = savemech.getCanonicalPath(); mtfw.WriteMTF( filename ); @@ -12628,23 +12199,7 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G cmbTechBase.setEnabled( true ); txtProdYear.setEnabled( true ); CurMech.SetYearRestricted( false ); - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3132, false ); - break; - case AvailableCode.ERA_ALL: - CurMech.SetYear( 0, false ); - break; - } + CurMech.SetYear( CommonTools.GetEraDefaultYear( cmbMechEra.getSelectedIndex() ), false ); } else { // ensure we have a good year. try{ @@ -12657,47 +12212,15 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G } // ensure the year is between the era years. - switch ( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - // Star League era - if( year < 2443 || year > 2800 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_SUCCESSION: - // Succession Wars era - if( year < 2801 || year > 3050 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_CLAN_INVASION: - // Clan Invasion Era - if( year < 3051 || year > 3131 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_DARK_AGES: - // Clan Invasion Era - if( year < 3132 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_ALL: - // all era + if( cmbMechEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CommonTools.IsYearInEra( year, cmbMechEra.getSelectedIndex() ) ) { + Media.Messager( this, "The year does not fall within this era." ); + txtProdYear.setText( "" ); chkYearRestrict.setSelected( false ); - chkYearRestrict.setEnabled( false ); + } + } else { + chkYearRestrict.setSelected( false ); + chkYearRestrict.setEnabled( false ); } // we know we have a good year, lock it in. @@ -12835,6 +12358,7 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN FixWalkMPSpinner(); FixJJSpinnerModel(); RefreshEquipment(); + CheckOmnimech(); // now reset the combo boxes to the closest choices we previously selected LoadSelections(); @@ -12906,7 +12430,6 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE // make it an omni CurMech.SetOmnimech( VariantName ); - chkOmnimech.setEnabled( false ); FixTransferHandlers(); SetLoadoutArrays(); FixJJSpinnerModel(); @@ -12920,11 +12443,7 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE }//GEN-LAST:event_btnLockChassisActionPerformed private void chkOmnimechActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOmnimechActionPerformed - if( chkOmnimech.isSelected() ) { - btnLockChassis.setEnabled( true ); - } else { - btnLockChassis.setEnabled( false ); - } + btnLockChassis.setEnabled( chkOmnimech.isSelected() ); }//GEN-LAST:event_chkOmnimechActionPerformed private void btnAddVariantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddVariantActionPerformed @@ -13588,7 +13107,7 @@ public void LoadMechIntoGUI() { } } chkYearRestrict.setSelected( CurMech.IsYearRestricted() ); - txtProdYear.setText( "" + CurMech.GetYear() ); + txtProdYear.setText( CurMech.YearWasSpecified() ? "" + CurMech.GetYear() : "" ); cmbMechEra.setEnabled( true ); cmbTechBase.setEnabled( true ); txtProdYear.setEnabled( true ); @@ -13626,6 +13145,7 @@ public void LoadMechIntoGUI() { txtMechModel.setText( CurMech.GetModel() ); if( CurMech.IsOmnimech() ) { + chkOmnimech.setSelected( true ); LockGUIForOmni(); RefreshOmniVariants(); RefreshOmniChoices(); @@ -13698,20 +13218,20 @@ public void LoadMechIntoGUI() { Additional.SetText( CurMech.GetAdditional() ); quirks = CurMech.GetQuirks(); tblQuirks.setModel( new tbQuirks(quirks) ); - txtManufacturer.setText( CurMech.GetCompany() ); - txtManufacturerLocation.setText( CurMech.GetLocation() ); - txtEngineManufacturer.setText( CurMech.GetEngineManufacturer() ); - txtArmorModel.setText( CurMech.GetArmorModel() ); - txtChassisModel.setText( CurMech.GetChassisModel() ); + txtManufacturer.setText( CommonTools.UnknownToEmpty( CurMech.GetCompany() ) ); + txtManufacturerLocation.setText( CommonTools.UnknownToEmpty( CurMech.GetLocation() ) ); + txtEngineManufacturer.setText( CommonTools.UnknownToEmpty( CurMech.GetEngineManufacturer() ) ); + txtArmorModel.setText( CommonTools.UnknownToEmpty( CurMech.GetArmorModel() ) ); + txtChassisModel.setText( CommonTools.UnknownToEmpty( CurMech.GetChassisModel() ) ); if( CurMech.GetJumpJets().GetNumJJ() > 0 ) { txtJJModel.setEnabled( true ); } txtSource.setText( CurMech.GetSource() ); // omnimechs may have jump jets in one loadout and not another. - txtJJModel.setText( CurMech.GetJJModel() ); - txtCommSystem.setText( CurMech.GetCommSystem() ); - txtTNTSystem.setText( CurMech.GetTandTSystem() ); + txtJJModel.setText( CommonTools.UnknownToEmpty( CurMech.GetJJModel() ) ); + txtCommSystem.setText( CommonTools.UnknownToEmpty( CurMech.GetCommSystem() ) ); + txtTNTSystem.setText( CommonTools.UnknownToEmpty( CurMech.GetTandTSystem() ) ); // see if we should enable the Power Amplifier display if( CurMech.GetEngine().IsNuclear() ) { @@ -14965,12 +14485,13 @@ private void cmbProductionEraActionPerformed(java.awt.event.ActionEvent evt) {// CurMech.SetProductionEra( cmbProductionEra.getSelectedIndex() ); }//GEN-LAST:event_cmbProductionEraActionPerformed -private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddQuirkActionPerformed - dlgQuirks qmanage = new dlgQuirks(this, true, data, quirks); - qmanage.setLocationRelativeTo(this); - qmanage.setVisible(true); - tblQuirks.setModel(new tbQuirks(quirks)); -}//GEN-LAST:event_btnAddQuirkActionPerformed + private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) { + dlgQuirks qmanage = new dlgQuirks(this, true, data, quirks); + qmanage.setLocationRelativeTo(this); + qmanage.setVisible(true); + tblQuirks.setModel(new tbQuirks(quirks)); + CurMech.SetQuirks(quirks); + } private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuReloadEquipmentActionPerformed try { @@ -15180,27 +14701,11 @@ private void setViewToolbar(boolean Visible) private javax.swing.JScrollPane jScrollPane14; private javax.swing.JScrollPane jScrollPane16; private javax.swing.JScrollPane jScrollPane17; - private javax.swing.JScrollPane jScrollPane18; - private javax.swing.JScrollPane jScrollPane19; - private javax.swing.JScrollPane jScrollPane20; - private javax.swing.JScrollPane jScrollPane21; - private javax.swing.JScrollPane jScrollPane22; - private javax.swing.JScrollPane jScrollPane23; - private javax.swing.JScrollPane jScrollPane24; - private javax.swing.JScrollPane jScrollPane8; - private javax.swing.JScrollPane jScrollPane9; - private javax.swing.JSeparator jSeparator1; - private javax.swing.JSeparator jSeparator10; - private javax.swing.JSeparator jSeparator11; - private javax.swing.JSeparator jSeparator12; private javax.swing.JSeparator jSeparator13; private javax.swing.JSeparator jSeparator14; private javax.swing.JSeparator jSeparator15; private javax.swing.JSeparator jSeparator16; private javax.swing.JSeparator jSeparator17; - private javax.swing.JSeparator jSeparator18; - private javax.swing.JSeparator jSeparator19; - private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator20; private javax.swing.JToolBar.Separator jSeparator21; private javax.swing.JToolBar.Separator jSeparator22; @@ -15211,14 +14716,7 @@ private void setViewToolbar(boolean Visible) private javax.swing.JSeparator jSeparator27; private javax.swing.JSeparator jSeparator28; private javax.swing.JSeparator jSeparator29; - private javax.swing.JSeparator jSeparator3; private javax.swing.JSeparator jSeparator30; - private javax.swing.JSeparator jSeparator4; - private javax.swing.JSeparator jSeparator5; - private javax.swing.JSeparator jSeparator6; - private javax.swing.JSeparator jSeparator7; - private javax.swing.JSeparator jSeparator8; - private javax.swing.JSeparator jSeparator9; private javax.swing.JTextArea jTextAreaBFConversion; private javax.swing.JLabel lblAVInLot; private javax.swing.JLabel lblArmorCoverage; @@ -15396,13 +14894,10 @@ private void setViewToolbar(boolean Visible) private javax.swing.JCheckBoxMenuItem mnuViewToolbar; private javax.swing.JPanel onlLoadoutControls; private javax.swing.JPanel pnlAdditionalFluff; - private javax.swing.JPanel pnlAmmunition; private javax.swing.JPanel pnlArmor; private javax.swing.JPanel pnlArmorInfo; private javax.swing.JPanel pnlArmorSetup; - private javax.swing.JPanel pnlArtillery; private javax.swing.JPanel pnlBFStats; - private javax.swing.JPanel pnlBallistic; private javax.swing.JPanel pnlBasicInformation; private javax.swing.JPanel pnlBasicSetup; private javax.swing.JPanel pnlBasicSummary; @@ -15417,10 +14912,8 @@ private void setViewToolbar(boolean Visible) private javax.swing.JPanel pnlCriticals; private javax.swing.JPanel pnlDamageChart; private javax.swing.JPanel pnlDeployment; - private javax.swing.JPanel pnlEnergy; private javax.swing.JPanel pnlEquipInfo; private javax.swing.JPanel pnlEquipment; - private javax.swing.JPanel pnlEquipmentChooser; private javax.swing.JPanel pnlEquipmentToPlace; private javax.swing.JPanel pnlExport; private javax.swing.JPanel pnlFluff; @@ -15439,13 +14932,11 @@ private void setViewToolbar(boolean Visible) private javax.swing.JPanel pnlLTCrits; private javax.swing.JPanel pnlLTRArmorBox; private javax.swing.JPanel pnlManufacturers; - private javax.swing.JPanel pnlMissile; private javax.swing.JPanel pnlMovement; private javax.swing.JPanel pnlNotables; private javax.swing.JPanel pnlOmniInfo; private javax.swing.JPanel pnlOverview; private javax.swing.JPanel pnlPatchworkChoosers; - private javax.swing.JPanel pnlPhysical; private javax.swing.JPanel pnlQuirks; private javax.swing.JPanel pnlRAArmorBox; private javax.swing.JPanel pnlRACrits; @@ -15461,8 +14952,10 @@ private void setViewToolbar(boolean Visible) private javax.swing.JPanel pnlWeaponsManufacturers; private javax.swing.JScrollPane scpQuirkTable; private javax.swing.JScrollPane scpWeaponManufacturers; + private javax.swing.JScrollPane scrEquipToPlace; private javax.swing.JScrollPane scrLACrits; private javax.swing.JScrollPane scrRACrits; + private javax.swing.JScrollPane scrSelectedEquip; private javax.swing.JSpinner spnBoosterMP; private javax.swing.JSpinner spnCTArmor; private javax.swing.JSpinner spnCTRArmor; diff --git a/ssw/src/main/java/ssw/gui/frmMainWide.form b/ssw/src/main/java/ssw/gui/frmMainWide.form index 0e07ebc7..94aa6fea 100644 --- a/ssw/src/main/java/ssw/gui/frmMainWide.form +++ b/ssw/src/main/java/ssw/gui/frmMainWide.form @@ -940,7 +940,7 @@ - + @@ -952,6 +952,7 @@ + @@ -6436,9 +6437,9 @@ - + - + @@ -7998,15 +7999,15 @@ - + - + - + - + @@ -8095,13 +8096,13 @@ - + - + - + diff --git a/ssw/src/main/java/ssw/gui/frmMainWide.java b/ssw/src/main/java/ssw/gui/frmMainWide.java index 527a35a3..b916b727 100644 --- a/ssw/src/main/java/ssw/gui/frmMainWide.java +++ b/ssw/src/main/java/ssw/gui/frmMainWide.java @@ -49,6 +49,8 @@ import visitors.ifVisitor; import javax.swing.*; +import javax.swing.event.ListSelectionListener; +import javax.swing.text.JTextComponent; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.event.*; @@ -58,7 +60,19 @@ import java.util.prefs.Preferences; public class frmMainWide extends javax.swing.JFrame implements java.awt.datatransfer.ClipboardOwner, common.DesignForm, ifMechForm { - + FocusAdapter spinners = new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + if ( e.getSource() instanceof JTextComponent) { + final JTextComponent textComponent = ((JTextComponent)e.getSource()); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + textComponent.selectAll(); + } + }); + } + } + }; String[] Selections = { "", "", "", "", "", "", "", "" }; Mech CurMech; VSetArmorTonnage ArmorTons; @@ -437,6 +451,7 @@ public void actionPerformed(ActionEvent e) { cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); cmbCockpitType.setSelectedItem( SSWConstants.DEFAULT_COCKPIT ); + chkCommandConsole.setSelected( false ); cmbPhysEnhance.setSelectedItem( SSWConstants.DEFAULT_ENHANCEMENT ); cmbHeatSinkType.setSelectedItem( Prefs.get( "NewMech_Heatsinks", "Single Heat Sink" ) ); cmbJumpJetType.setSelectedItem( SSWConstants.DEFAULT_JUMPJET ); @@ -460,7 +475,7 @@ public String getColumnName( int col ) { public Object getValueAt( int row, int col ) { Object o = CurMech.GetLoadout().GetEquipment().get( row ); if( col == 1 ) { - return ((abPlaceable) o).GetManufacturer(); + return CommonTools.UnknownToEmpty( ((abPlaceable) o).GetManufacturer() ); } else { return ((abPlaceable) o).CritName(); } @@ -677,6 +692,7 @@ private void FixWalkMPSpinner() { // reset the spinner model and we're done. spnWalkMP.setModel( new javax.swing.SpinnerNumberModel( CurWalk, 1, MaxWalk, 1) ); + ((JSpinner.DefaultEditor)spnWalkMP.getEditor()).getTextField().addFocusListener(spinners); } private void BuildChassisSelector() { @@ -871,6 +887,7 @@ private void FixJJSpinnerModel() { } spnJumpMP.setModel( new javax.swing.SpinnerNumberModel( current, min, max, 1) ); + ((JSpinner.DefaultEditor)spnJumpMP.getEditor()).getTextField().addFocusListener(spinners); } private void FixHeatSinkSpinnerModel() { @@ -882,6 +899,8 @@ private void FixHeatSinkSpinnerModel() { spnNumberOfHS.setModel( new javax.swing.SpinnerNumberModel( CurMech.GetHeatSinks().GetNumHS(), CurMech.GetEngine().FreeHeatSinks(), 65, 1) ); } + + ((JSpinner.DefaultEditor)spnNumberOfHS.getEditor()).getTextField().addFocusListener(spinners); } private void FixJumpBoosterSpinnerModel() { @@ -1533,6 +1552,10 @@ private void RecalcCockpit() { ifVisitor v = (ifVisitor) CurMech.Lookup( LookupVal ); try { CurMech.Visit( v ); + + if (!CurMech.GetCockpit().CanArmor()) + CurMech.GetCockpit().ArmorComponent(false); + } catch( Exception e ) { v = (ifVisitor) CurMech.Lookup( OldVal ); try { @@ -1716,6 +1739,8 @@ private void RecalcEngine() { CurMech.GetHeatSinks().ReCalculate(); spnNumberOfHS.setModel( new javax.swing.SpinnerNumberModel( CurMech.GetHeatSinks().GetNumHS(), CurMech.GetEngine().FreeHeatSinks(), 65, 1) ); + + ((JSpinner.DefaultEditor)spnNumberOfHS.getEditor()).getTextField().addFocusListener(spinners); } // see if we should enable the Power Amplifier display @@ -1987,15 +2012,7 @@ private void CheckOmnimech() { // now let's ensure that all the omni controls are enabled or disabled // as appropriate - if( chkOmnimech.isEnabled() ) { - if( chkOmnimech.isSelected() ) { - btnLockChassis.setEnabled( true ); - } else { - btnLockChassis.setEnabled( false ); - } - } else { - btnLockChassis.setEnabled( false ); - } + btnLockChassis.setEnabled( chkOmnimech.isEnabled() && chkOmnimech.isSelected() ); } private void SaveOmniFluffInfo() { @@ -2008,23 +2025,7 @@ private void SaveOmniFluffInfo() { CurMech.SetYear( Integer.parseInt( txtProdYear.getText() ), chkYearRestrict.isSelected() ); } catch( Exception e ) { // nothing really to be done, set it to a default. - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3132, false ); - break; - case AvailableCode.ERA_ALL: - CurMech.SetYear( 0, false ); - break; - } + CurMech.SetYear( CommonTools.GetEraDefaultYear( cmbMechEra.getSelectedIndex() ), false ); } } } @@ -2034,7 +2035,7 @@ private void LoadOmniFluffInfo() { cmbMechEra.setSelectedIndex( CurMech.GetEra() ); cmbProductionEra.setSelectedIndex( CurMech.GetProductionEra() ); txtSource.setText( CurMech.GetSource() ); - txtProdYear.setText( "" + CurMech.GetYear() ); + txtProdYear.setText( CurMech.YearWasSpecified() ? "" + CurMech.GetYear() : "" ); BuildTechBaseSelector(); } @@ -2156,7 +2157,7 @@ public void RefreshInfoPane() { txtInfoTonnage.setText( "Tons: " + CurMech.GetCurrentTons() ); txtInfoFreeTons.setText( "Free Tons: " + ( CurMech.GetTonnage() - CurMech.GetCurrentTons() ) ); } - txtInfoMaxHeat.setText( "Max Heat: " + CurMech.GetMaxHeat() ); + txtInfoMaxHeat.setText( "Max Heat: " + String.format( "%1$,.1f", CurMech.GetMaxHeat() ) ); txtInfoHeatDiss.setText( "Heat Dissipation: " + CurMech.GetHeatSinks().TotalDissipation() ); txtInfoFreeCrits.setText( "Free Crits: " + CurMech.GetLoadout().FreeCrits() ); txtInfoUnplaced.setText( "Unplaced Crits: " + CurMech.GetLoadout().UnplacedCrits() ); @@ -2411,6 +2412,19 @@ private void FixArmorSpinners() { spnCTRArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.MECH_LOC_CTR ), 0, a.GetLocationMax( LocationIndex.MECH_LOC_CT ), 1) ); spnLTRArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.MECH_LOC_LTR ), 0, a.GetLocationMax( LocationIndex.MECH_LOC_LT ), 1) ); spnRTRArmor.setModel( new javax.swing.SpinnerNumberModel( a.GetLocationArmor( LocationIndex.MECH_LOC_RTR ), 0, a.GetLocationMax( LocationIndex.MECH_LOC_RT ), 1) ); + + //Setup Spinner focus + ((JSpinner.DefaultEditor)spnHDArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnCTArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnCTRArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnRTArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnRTRArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnLTArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnLTRArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnRAArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnRLArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnLAArmor.getEditor()).getTextField().addFocusListener(spinners); + ((JSpinner.DefaultEditor)spnLLArmor.getEditor()).getTextField().addFocusListener(spinners); } private void SaveSelections() { @@ -2611,23 +2625,7 @@ private void GetNewMech() { CurMech.SetEra( cmbMechEra.getSelectedIndex() ); CurMech.SetProductionEra( cmbProductionEra.getSelectedIndex() ); CurMech.SetRulesLevel( cmbRulesLevel.getSelectedIndex() ); - switch( CurMech.GetEra() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3130, false ); - break; - case AvailableCode.ERA_ALL: - CurMech.SetYear( 0, false ); - break; - } + CurMech.SetYear( CommonTools.GetEraDefaultYear( CurMech.GetEra() ), false ); BuildTechBaseSelector(); cmbTechBase.setSelectedItem( Prefs.get( "NewMech_Techbase", "Inner Sphere" ) ); switch( cmbTechBase.getSelectedIndex() ) { @@ -2672,6 +2670,7 @@ private void GetNewMech() { cmbEngineType.setSelectedItem( SSWConstants.DEFAULT_ENGINE ); cmbGyroType.setSelectedItem( SSWConstants.DEFAULT_GYRO ); cmbCockpitType.setSelectedItem( SSWConstants.DEFAULT_COCKPIT ); + chkCommandConsole.setSelected( false ); cmbPhysEnhance.setSelectedItem( SSWConstants.DEFAULT_ENHANCEMENT ); cmbHeatSinkType.setSelectedItem( Prefs.get( "NewMech_Heatsinks", "Single Heat Sink" ) ); cmbJumpJetType.setSelectedItem( SSWConstants.DEFAULT_JUMPJET ); @@ -3079,23 +3078,14 @@ private void RemoveItemCritTab() { private void SolidifyMech() { // sets some of the basic mech information normally kept in the BFB.GUI and // prepares the mech for saving to file - int year = 0; + int year; CurMech.SetName( txtMechName.getText() ); CurMech.SetModel( txtMechModel.getText() ); if( txtProdYear.getText().isEmpty() ) { - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3132, false ); - break; + year = CommonTools.GetEraDefaultYear( cmbMechEra.getSelectedIndex() ); + if( year != 0 ) { + CurMech.SetYear( year, false ); + txtProdYear.setText( "" + year ); } } else { try{ @@ -3275,7 +3265,6 @@ private void LockGUIForOmni() { private void UnlockGUIFromOmni() { // this should be used anytime a new mech is made or when unlocking // an omnimech. - chkOmnimech.setSelected( false ); chkOmnimech.setEnabled( true ); mnuUnlock.setEnabled( false ); cmbTonnage.setEnabled( true ); @@ -3305,7 +3294,6 @@ private void UnlockGUIFromOmni() { btnEfficientArmor.setEnabled( true ); btnBalanceArmor.setEnabled( true ); cmbJumpJetType.setEnabled( true ); - btnLockChassis.setEnabled( true ); chkFCSAIV.setEnabled( true ); chkFCSAV.setEnabled( true ); chkFCSApollo.setEnabled( true ); @@ -3323,9 +3311,7 @@ private void UnlockGUIFromOmni() { chkHDTurret.setEnabled( true ); chkLTTurret.setEnabled( true ); chkRTTurret.setEnabled( true ); - chkOmnimech.setSelected( false ); - chkOmnimech.setEnabled( true ); - btnLockChassis.setEnabled( false ); + btnLockChassis.setEnabled( chkOmnimech.isSelected() ); spnWalkMP.setEnabled( true ); chkYearRestrict.setEnabled( true ); chkNullSig.setEnabled( true ); @@ -3454,6 +3440,7 @@ private boolean VerifyMech( ActionEvent evt ) { private void ConfigureUtilsMenu( java.awt.Component c ) { // configures the utilities popup menu + boolean rear = LegalRearMount( CurItem ); boolean armor = LegalArmoring( CurItem ) && CommonTools.IsAllowed( abPlaceable.ArmoredAC, CurMech ); boolean cap = LegalCapacitor( CurItem ) && CommonTools.IsAllowed( PPCCapAC, CurMech ); boolean insul = LegalInsulator( CurItem ) && CommonTools.IsAllowed( LIAC, CurMech ); @@ -3461,11 +3448,7 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { boolean caseless = LegalCaseless( CurItem ) && CommonTools.IsAllowed( CaselessAmmoAC, CurMech ); boolean lotchange = LegalLotChange( CurItem ); boolean turreted = LegalTurretMount( CurItem ); - mnuArmorComponent.setEnabled( armor ); - mnuAddCapacitor.setEnabled( cap ); - mnuAddInsulator.setEnabled( insul ); - mnuAddPulseModule.setEnabled(pulseModule); - mnuCaseless.setEnabled( caseless ); + mnuMountRear.setVisible( rear ); mnuArmorComponent.setVisible( armor ); mnuAddCapacitor.setVisible( cap ); mnuAddInsulator.setVisible( insul ); @@ -3473,6 +3456,13 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { mnuCaseless.setVisible( caseless ); mnuSetLotSize.setVisible( lotchange ); mnuTurret.setVisible( turreted ); + if( rear ) { + if( CurItem.IsMountedRear() ) { + mnuMountRear.setText( "Unmount Rear " ); + } else { + mnuMountRear.setText( "Mount Rear " ); + } + } if( armor ) { if( CurItem.IsArmored() ) { mnuArmorComponent.setText( "Unarmor Component" ); @@ -3480,8 +3470,8 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { mnuArmorComponent.setText( "Armor Component" ); } } - if( turreted && ( CurItem instanceof RangedWeapon ) ) { - if( ((RangedWeapon) CurItem).IsTurreted() ) { + if( turreted ) { + if( CurItem.IsTurreted() ) { mnuTurret.setText( "Remove from Turret" ); } else { mnuTurret.setText( "Add to Turret"); @@ -3590,22 +3580,6 @@ private void ConfigureUtilsMenu( java.awt.Component c ) { mnuUnallocateAll.setText( "Unallocate All" ); mnuUnallocateAll.setEnabled( false ); } - if( c == lstHDCrits || c == lstCTCrits || c == lstLTCrits || c == lstRTCrits || c == lstLLCrits || c == lstRLCrits || ( CurMech.IsQuad() && (c == lstRACrits || c == lstLACrits))) { - if( CurItem.CanMountRear() ) { - mnuMountRear.setEnabled( true ); - if( CurItem.IsMountedRear() ) { - mnuMountRear.setText( "Unmount Rear " ); - } else { - mnuMountRear.setText( "Mount Rear " ); - } - } else { - mnuMountRear.setEnabled( false ); - mnuMountRear.setText( "Mount Rear " ); - } - } else { - mnuMountRear.setEnabled( false ); - mnuMountRear.setText( "Mount Rear " ); - } if( CurItem.Contiguous() ) { EquipmentCollection C = CurMech.GetLoadout().GetCollection( CurItem ); if( C == null ) { @@ -3777,57 +3751,19 @@ private void PulseModule() { } private void TurretMount() { - if( CurItem instanceof RangedWeapon ) { - RangedWeapon w = (RangedWeapon) CurItem; - int location = CurMech.GetLoadout().Find( CurItem ); - if( w.IsTurreted() ) { - if( location == LocationIndex.MECH_LOC_HD ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot remove from turret!" ); - return; - } - } else { - if( location == LocationIndex.MECH_LOC_HD ) { - w.AddToTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.AddToTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.AddToTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot add to turret!" ); - return; - } - } - } else if( CurItem instanceof MGArray ) { - MGArray w = (MGArray) CurItem; + if( CurItem.IsTurreted() ) { + CurItem.MountTurret( null ); + } else { int location = CurMech.GetLoadout().Find( CurItem ); - if( w.IsTurreted() ) { - if( location == LocationIndex.MECH_LOC_HD ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.RemoveFromTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot remove from turret!" ); - return; - } + if( location == LocationIndex.MECH_LOC_HD ) { + CurItem.MountTurret( CurMech.GetLoadout().GetHDTurret() ); + } else if( location == LocationIndex.MECH_LOC_LT ) { + CurItem.MountTurret( CurMech.GetLoadout().GetLTTurret() ); + } else if( location == LocationIndex.MECH_LOC_RT ) { + CurItem.MountTurret( CurMech.GetLoadout().GetRTTurret() ); } else { - if( location == LocationIndex.MECH_LOC_HD ) { - w.AddToTurret( CurMech.GetLoadout().GetHDTurret() ); - } else if( location == LocationIndex.MECH_LOC_LT ) { - w.AddToTurret( CurMech.GetLoadout().GetLTTurret() ); - } else if( location == LocationIndex.MECH_LOC_RT ) { - w.AddToTurret( CurMech.GetLoadout().GetRTTurret() ); - } else { - Media.Messager( this, "Cannot add to turret!" ); - return; - } + Media.Messager( this, "Invalid turret location!" ); + return; } } RefreshInfoPane(); @@ -3957,6 +3893,23 @@ public void SetVariableSize() { } } + public boolean LegalRearMount( abPlaceable p ) { + switch( CurMech.GetLoadout().Find( p ) ) { + case LocationIndex.MECH_LOC_HD: + case LocationIndex.MECH_LOC_CT: + case LocationIndex.MECH_LOC_LT: + case LocationIndex.MECH_LOC_RT: + case LocationIndex.MECH_LOC_LL: + case LocationIndex.MECH_LOC_RL: + return CurItem.CanMountRear(); + case LocationIndex.MECH_LOC_LA: + case LocationIndex.MECH_LOC_RA: + return CurMech.IsQuad() && CurItem.CanMountRear(); + default: + return false; + } + } + public boolean LegalArmoring( abPlaceable p ) { // This tells us whether it is legal to armor a particular component if( p.CanArmor() ) { @@ -4012,7 +3965,7 @@ public boolean LegalCaseless( abPlaceable p ) { } public boolean LegalTurretMount( abPlaceable p ) { - if( ! (( p instanceof RangedWeapon ) || ( p instanceof MGArray )) ) { return false; } + if( ! p.CanMountTurret() ) { return false; } int location = CurMech.GetLoadout().Find( p ); if( location == LocationIndex.MECH_LOC_HD ) { if( CurMech.IsOmnimech() ) { @@ -4879,41 +4832,13 @@ private void initComponents() { lblPWRLLoc = new javax.swing.JLabel(); pnlEquipment = new javax.swing.JPanel(); tbpWeaponChooser = new javax.swing.JTabbedPane(); - pnlBallistic = new javax.swing.JPanel(); - jSeparator3 = new javax.swing.JSeparator(); - jScrollPane8 = new javax.swing.JScrollPane(); lstChooseBallistic = new javax.swing.JList(); - jSeparator4 = new javax.swing.JSeparator(); - pnlEnergy = new javax.swing.JPanel(); - jSeparator2 = new javax.swing.JSeparator(); - jScrollPane9 = new javax.swing.JScrollPane(); lstChooseEnergy = new javax.swing.JList(); - jSeparator1 = new javax.swing.JSeparator(); - pnlMissile = new javax.swing.JPanel(); - jSeparator5 = new javax.swing.JSeparator(); - jScrollPane19 = new javax.swing.JScrollPane(); lstChooseMissile = new javax.swing.JList(); - jSeparator6 = new javax.swing.JSeparator(); - pnlPhysical = new javax.swing.JPanel(); - jSeparator8 = new javax.swing.JSeparator(); - jScrollPane20 = new javax.swing.JScrollPane(); lstChoosePhysical = new javax.swing.JList(); - jSeparator7 = new javax.swing.JSeparator(); - pnlEquipmentChooser = new javax.swing.JPanel(); - jSeparator10 = new javax.swing.JSeparator(); - jScrollPane21 = new javax.swing.JScrollPane(); lstChooseEquipment = new javax.swing.JList(); - jSeparator9 = new javax.swing.JSeparator(); - pnlArtillery = new javax.swing.JPanel(); - jSeparator18 = new javax.swing.JSeparator(); - jScrollPane24 = new javax.swing.JScrollPane(); lstChooseArtillery = new javax.swing.JList(); - jSeparator19 = new javax.swing.JSeparator(); - pnlAmmunition = new javax.swing.JPanel(); - jSeparator11 = new javax.swing.JSeparator(); - jScrollPane22 = new javax.swing.JScrollPane(); lstChooseAmmunition = new javax.swing.JList(); - jSeparator12 = new javax.swing.JSeparator(); pnlSpecials = new javax.swing.JPanel(); jLabel16 = new javax.swing.JLabel(); chkUseTC = new javax.swing.JCheckBox(); @@ -5018,7 +4943,7 @@ private void initComponents() { chkRACASE2 = new javax.swing.JCheckBox(); chkRAAES = new javax.swing.JCheckBox(); pnlEquipmentToPlace = new javax.swing.JPanel(); - jScrollPane18 = new javax.swing.JScrollPane(); + scrEquipToPlace = new javax.swing.JScrollPane(); lstCritsToPlace = new javax.swing.JList(); btnRemoveItemCrits = new javax.swing.JButton(); btnAutoAllocate = new javax.swing.JButton(); @@ -5593,7 +5518,7 @@ public void mousePressed( MouseEvent e ) { pnlBasicInformation.add(jSeparator28, new java.awt.GridBagConstraints()); pnlBasicInformation.add(jSeparator29, new java.awt.GridBagConstraints()); - cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages" })); + cmbProductionEra.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Age of War", "Star League", "Early Succession War", "LSW - LosTech", "LSW - Renaissance", "Clan Invasion", "Civil War", "Jihad", "Early Republic", "Late Republic", "Dark Ages", "ilClan" })); cmbProductionEra.setLightWeightPopupEnabled(false); cmbProductionEra.setMaximumSize(new java.awt.Dimension(90, 20)); cmbProductionEra.setMinimumSize(new java.awt.Dimension(90, 20)); @@ -7498,339 +7423,32 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlEquipment.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); - tbpWeaponChooser.setTabPlacement(javax.swing.JTabbedPane.RIGHT); - tbpWeaponChooser.setMaximumSize(new java.awt.Dimension(300, 300)); - tbpWeaponChooser.setMinimumSize(new java.awt.Dimension(300, 300)); - tbpWeaponChooser.setPreferredSize(new java.awt.Dimension(300, 300)); - - pnlBallistic.setLayout(new javax.swing.BoxLayout(pnlBallistic, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator3.setAlignmentX(0.0F); - jSeparator3.setAlignmentY(0.0F); - pnlBallistic.add(jSeparator3); - - jScrollPane8.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane8.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane8.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane8.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseBallistic.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseBallistic.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseBallistic.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseBallistic.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseBallistic.setVisibleRowCount(16); - lstChooseBallistic.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseBallisticValueChanged(evt); - } - }); - MouseListener mlBallistic = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseBallistic.addMouseListener( mlBallistic ); - lstChooseBallistic.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane8.setViewportView(lstChooseBallistic); - - pnlBallistic.add(jScrollPane8); - - jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator4.setAlignmentX(0.0F); - jSeparator4.setAlignmentY(0.0F); - pnlBallistic.add(jSeparator4); - - tbpWeaponChooser.addTab("Ballistic", pnlBallistic); - - pnlEnergy.setLayout(new javax.swing.BoxLayout(pnlEnergy, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator2.setAlignmentX(0.0F); - jSeparator2.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator2); - - jScrollPane9.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane9.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane9.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane9.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEnergy.setModel(new javax.swing.AbstractListModel() { + //region Equipment Tab / Weapons and Equipment Lists + AbstractListModel placeholder = new AbstractListModel() { String[] strings = { "Placeholder" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEnergy.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEnergy.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEnergy.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEnergy.setVisibleRowCount(16); - lstChooseEnergy.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEnergyValueChanged(evt); - } - }); - MouseListener mlEnergy = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } }; - lstChooseEnergy.addMouseListener( mlEnergy ); - lstChooseEnergy.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane9.setViewportView(lstChooseEnergy); - - pnlEnergy.add(jScrollPane9); - - jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator1.setAlignmentX(0.0F); - jSeparator1.setAlignmentY(0.0F); - pnlEnergy.add(jSeparator1); - - tbpWeaponChooser.addTab("Energy", pnlEnergy); - pnlMissile.setLayout(new javax.swing.BoxLayout(pnlMissile, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator5.setAlignmentX(0.0F); - jSeparator5.setAlignmentY(0.0F); - pnlMissile.add(jSeparator5); - - jScrollPane19.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane19.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane19.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane19.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseMissile.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseMissile.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseMissile.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseMissile.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseMissile.setVisibleRowCount(16); - lstChooseMissile.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseMissileValueChanged(evt); - } - }); - MouseListener mlMissile = new MouseAdapter() { + MouseListener mlAddEquip = new MouseAdapter() { public void mouseClicked( MouseEvent e ) { if ( e.getClickCount() == 2 && e.getButton() == 1 ) { btnAddEquipActionPerformed( null ); } } }; - lstChooseMissile.addMouseListener( mlMissile ); - lstChooseMissile.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane19.setViewportView(lstChooseMissile); - - pnlMissile.add(jScrollPane19); - - jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator6.setAlignmentX(0.0F); - jSeparator6.setAlignmentY(0.0F); - pnlMissile.add(jSeparator6); - - tbpWeaponChooser.addTab("Missile", pnlMissile); - pnlPhysical.setLayout(new javax.swing.BoxLayout(pnlPhysical, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator8.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator8.setAlignmentX(0.0F); - jSeparator8.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator8); - - jScrollPane20.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane20.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane20.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane20.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChoosePhysical.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChoosePhysical.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChoosePhysical.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChoosePhysical.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChoosePhysical.setVisibleRowCount(16); - lstChoosePhysical.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChoosePhysicalValueChanged(evt); - } - }); - MouseListener mlPhysical = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChoosePhysical.addMouseListener( mlPhysical ); - lstChoosePhysical.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane20.setViewportView(lstChoosePhysical); - - pnlPhysical.add(jScrollPane20); - - jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator7.setAlignmentX(0.0F); - jSeparator7.setAlignmentY(0.0F); - pnlPhysical.add(jSeparator7); - - tbpWeaponChooser.addTab("Physical", pnlPhysical); - - pnlEquipmentChooser.setLayout(new javax.swing.BoxLayout(pnlEquipmentChooser, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator10.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator10.setAlignmentX(0.0F); - jSeparator10.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator10); - - jScrollPane21.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane21.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane21.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane21.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseEquipment.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseEquipment.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseEquipment.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseEquipment.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseEquipment.setVisibleRowCount(16); - lstChooseEquipment.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseEquipmentValueChanged(evt); - } - }); - MouseListener mlEquipment = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseEquipment.addMouseListener( mlEquipment ); - lstChooseEquipment.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane21.setViewportView(lstChooseEquipment); - - pnlEquipmentChooser.add(jScrollPane21); - - jSeparator9.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator9.setAlignmentX(0.0F); - jSeparator9.setAlignmentY(0.0F); - pnlEquipmentChooser.add(jSeparator9); - - tbpWeaponChooser.addTab("Equipment", pnlEquipmentChooser); - - pnlArtillery.setLayout(new javax.swing.BoxLayout(pnlArtillery, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator18.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator18.setAlignmentX(0.0F); - jSeparator18.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator18); - - jScrollPane24.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane24.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane24.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane24.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseArtillery.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseArtillery.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseArtillery.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseArtillery.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseArtillery.setVisibleRowCount(16); - lstChooseArtillery.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseArtilleryValueChanged(evt); - } - }); - MouseListener mlArtillery = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseArtillery.addMouseListener( mlArtillery ); - lstChooseArtillery.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane24.setViewportView(lstChooseArtillery); - - pnlArtillery.add(jScrollPane24); - - jSeparator19.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator19.setAlignmentX(0.0F); - jSeparator19.setAlignmentY(0.0F); - pnlArtillery.add(jSeparator19); - - tbpWeaponChooser.addTab("Artillery", pnlArtillery); - - pnlAmmunition.setLayout(new javax.swing.BoxLayout(pnlAmmunition, javax.swing.BoxLayout.Y_AXIS)); - - jSeparator11.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator11.setAlignmentX(0.0F); - jSeparator11.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator11); - - jScrollPane22.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane22.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - jScrollPane22.setMaximumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setMinimumSize(new java.awt.Dimension(200, 260)); - jScrollPane22.setPreferredSize(new java.awt.Dimension(200, 260)); - - lstChooseAmmunition.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Placeholder" }; - public int getSize() { return strings.length; } - public Object getElementAt(int i) { return strings[i]; } - }); - lstChooseAmmunition.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - lstChooseAmmunition.setMaximumSize(new java.awt.Dimension(180, 10000)); - lstChooseAmmunition.setMinimumSize(new java.awt.Dimension(180, 100)); - lstChooseAmmunition.setVisibleRowCount(16); - lstChooseAmmunition.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - lstChooseAmmunitionValueChanged(evt); - } - }); - MouseListener mlAmmo = new MouseAdapter() { - public void mouseClicked( MouseEvent e ) { - if ( e.getClickCount() == 2 && e.getButton() == 1 ) { - btnAddEquipActionPerformed( null ); - } - } - }; - lstChooseAmmunition.addMouseListener( mlAmmo ); - lstChooseAmmunition.setCellRenderer( new ssw.gui.EquipmentListRenderer( this ) ); - jScrollPane22.setViewportView(lstChooseAmmunition); - - pnlAmmunition.add(jScrollPane22); - - jSeparator12.setOrientation(javax.swing.SwingConstants.VERTICAL); - jSeparator12.setAlignmentX(0.0F); - jSeparator12.setAlignmentY(0.0F); - pnlAmmunition.add(jSeparator12); - - tbpWeaponChooser.addTab("Ammunition", pnlAmmunition); + tbpWeaponChooser.setTabPlacement(javax.swing.JTabbedPane.RIGHT); + tbpWeaponChooser.setMaximumSize(new java.awt.Dimension(300, 300)); + tbpWeaponChooser.setMinimumSize(new java.awt.Dimension(300, 300)); + tbpWeaponChooser.setPreferredSize(new java.awt.Dimension(300, 300)); + tbpWeaponChooser.addTab("Ballistic", EquipmentLocation(lstChooseBallistic, this::lstChooseBallisticValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Energy", EquipmentLocation(lstChooseEnergy, this::lstChooseEnergyValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Missile", EquipmentLocation(lstChooseMissile, this::lstChooseMissileValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Physical", EquipmentLocation(lstChoosePhysical, this::lstChoosePhysicalValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Equipment", EquipmentLocation(lstChooseEquipment, this::lstChooseEquipmentValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Artillery", EquipmentLocation(lstChooseArtillery, this::lstChooseArtilleryValueChanged, mlAddEquip, placeholder)); + tbpWeaponChooser.addTab("Ammunition", EquipmentLocation(lstChooseAmmunition, this::lstChooseAmmunitionValueChanged, mlAddEquip, placeholder)); pnlEquipment.add(tbpWeaponChooser, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1)); @@ -9099,7 +8717,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pnlEquipmentToPlace.setMinimumSize(new java.awt.Dimension(146, 330)); pnlEquipmentToPlace.setLayout(new javax.swing.BoxLayout(pnlEquipmentToPlace, javax.swing.BoxLayout.PAGE_AXIS)); - jScrollPane18.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrEquipToPlace.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); lstCritsToPlace.setFont( PrintConsts.BaseCritFont ); lstCritsToPlace.setModel(new javax.swing.AbstractListModel() { @@ -9174,9 +8792,9 @@ public void keyPressed(java.awt.event.KeyEvent evt) { lstCritsToPlaceKeyPressed(evt); } }); - jScrollPane18.setViewportView(lstCritsToPlace); + scrEquipToPlace.setViewportView(lstCritsToPlace); - pnlEquipmentToPlace.add(jScrollPane18); + pnlEquipmentToPlace.add(scrEquipToPlace); btnRemoveItemCrits.setText("Remove Item"); btnRemoveItemCrits.setEnabled(false); @@ -9334,7 +8952,7 @@ public boolean isCellEditable(int rowIndex, int columnIndex) { tblQuirks.getTableHeader().setReorderingAllowed(false); scpQuirkTable.setViewportView(tblQuirks); - btnAddQuirk.setText("Add Quirk"); + btnAddQuirk.setText("Manage Quirks"); btnAddQuirk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAddQuirkActionPerformed(evt); @@ -10100,10 +9718,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtInfoMaxHeat.setEditable(false); txtInfoMaxHeat.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N txtInfoMaxHeat.setHorizontalAlignment(javax.swing.JTextField.CENTER); - txtInfoMaxHeat.setText("Max Heat: 000"); - txtInfoMaxHeat.setMaximumSize(new java.awt.Dimension(77, 20)); - txtInfoMaxHeat.setMinimumSize(new java.awt.Dimension(77, 20)); - txtInfoMaxHeat.setPreferredSize(new java.awt.Dimension(77, 20)); + txtInfoMaxHeat.setText("Max Heat: 00.0"); + txtInfoMaxHeat.setMaximumSize(new java.awt.Dimension(87, 20)); + txtInfoMaxHeat.setMinimumSize(new java.awt.Dimension(87, 20)); + txtInfoMaxHeat.setPreferredSize(new java.awt.Dimension(87, 20)); pnlInfoPanel.add(txtInfoMaxHeat); txtInfoHeatDiss.setEditable(false); @@ -10146,9 +9764,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { txtInfoCost.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N txtInfoCost.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtInfoCost.setText("Cost: 000,000,000"); - txtInfoCost.setMaximumSize(new java.awt.Dimension(125, 20)); - txtInfoCost.setMinimumSize(new java.awt.Dimension(125, 20)); - txtInfoCost.setPreferredSize(new java.awt.Dimension(125, 20)); + txtInfoCost.setMaximumSize(new java.awt.Dimension(115, 20)); + txtInfoCost.setMinimumSize(new java.awt.Dimension(115, 20)); + txtInfoCost.setPreferredSize(new java.awt.Dimension(115, 20)); pnlInfoPanel.add(txtInfoCost); txtChatInfo.setBackground(new java.awt.Color(238, 238, 238)); @@ -10173,7 +9791,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - mnuNewMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuNewMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK)); mnuNewMech.setText("New Mech"); mnuNewMech.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10182,7 +9800,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); mnuFile.add(mnuNewMech); - mnuLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK)); mnuLoad.setText("Load Mech"); mnuLoad.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10191,7 +9809,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); mnuFile.add(mnuLoad); - mnuOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK)); mnuOpen.setText("Open"); mnuOpen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10221,7 +9839,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuFile.add(mnuImport); mnuFile.add(jSeparator16); - mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK)); mnuSave.setText("Save Mech"); mnuSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10230,7 +9848,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); mnuFile.add(mnuSave); - mnuSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); + mnuSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); mnuSaveAs.setText("Save Mech As..."); mnuSaveAs.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10286,7 +9904,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuPrint.setText("Print"); - mnuPrintCurrentMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + mnuPrintCurrentMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK)); mnuPrintCurrentMech.setText("Current Mech"); mnuPrintCurrentMech.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10295,7 +9913,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); mnuPrint.add(mnuPrintCurrentMech); - mnuPrintSavedMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.SHIFT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); + mnuPrintSavedMech.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); mnuPrintSavedMech.setText("Saved Mech"); mnuPrintSavedMech.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10304,7 +9922,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); mnuPrint.add(mnuPrintSavedMech); - mnuPrintBatch.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); + mnuPrintBatch.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); mnuPrintBatch.setText("Batch Print Mechs"); mnuPrintBatch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10315,7 +9933,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuFile.add(mnuPrint); - mnuPrintPreview.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_DOWN_MASK | java.awt.event.InputEvent.CTRL_DOWN_MASK)); + mnuPrintPreview.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK)); mnuPrintPreview.setText("Print Preview"); mnuPrintPreview.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10325,7 +9943,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuFile.add(mnuPrintPreview); mnuFile.add(jSeparator17); - mnuExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK)); mnuExit.setText("Exit"); mnuExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10338,7 +9956,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuClearFluff.setText("Tools"); - mnuSummary.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuSummary.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.ALT_MASK)); mnuSummary.setText("Show Summary"); mnuSummary.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10373,7 +9991,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mnuClearFluff.add(mnuBFB); mnuClearFluff.add(jSeparator27); - mnuOptions.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuOptions.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK)); mnuOptions.setText("Preferences"); mnuOptions.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -10382,7 +10000,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); mnuClearFluff.add(mnuOptions); - mnuViewToolbar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_DOWN_MASK)); + mnuViewToolbar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK)); mnuViewToolbar.setSelected(true); mnuViewToolbar.setText("View Toolbar"); mnuViewToolbar.addActionListener(new java.awt.event.ActionListener() { @@ -10453,6 +10071,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pack(); }// //GEN-END:initComponents + private JPanel EquipmentLocation(JList list, ListSelectionListener selection, MouseListener listener, AbstractListModel display) { + JPanel panel = new JPanel(); + list.setModel(display); + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + list.addListSelectionListener(selection); + list.addMouseListener( listener ); + list.setCellRenderer( new EquipmentListRenderer( this ) ); + JScrollPane pane = new JScrollPane(); + pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + pane.setViewportView(list); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(pane); + return panel; + } + private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed if( CurMech.HasChanged() ) { int choice = javax.swing.JOptionPane.showConfirmDialog( this, @@ -10878,7 +10512,7 @@ public void LoadMechIntoGUI() { } } chkYearRestrict.setSelected( CurMech.IsYearRestricted() ); - txtProdYear.setText( "" + CurMech.GetYear() ); + txtProdYear.setText( CurMech.YearWasSpecified() ? "" + CurMech.GetYear() : "" ); cmbMechEra.setEnabled( true ); cmbProductionEra.setEnabled( true ); cmbTechBase.setEnabled( true ); @@ -10917,6 +10551,7 @@ public void LoadMechIntoGUI() { txtMechModel.setText( CurMech.GetModel() ); if( CurMech.IsOmnimech() ) { + chkOmnimech.setSelected( true ); LockGUIForOmni(); RefreshOmniVariants(); RefreshOmniChoices(); @@ -10989,20 +10624,20 @@ public void LoadMechIntoGUI() { Additional.SetText( CurMech.GetAdditional() ); quirks = CurMech.GetQuirks(); tblQuirks.setModel(new tbQuirks(quirks)); - txtManufacturer.setText( CurMech.GetCompany() ); - txtManufacturerLocation.setText( CurMech.GetLocation() ); - txtEngineManufacturer.setText( CurMech.GetEngineManufacturer() ); - txtArmorModel.setText( CurMech.GetArmorModel() ); - txtChassisModel.setText( CurMech.GetChassisModel() ); + txtManufacturer.setText( CommonTools.UnknownToEmpty( CurMech.GetCompany() ) ); + txtManufacturerLocation.setText( CommonTools.UnknownToEmpty( CurMech.GetLocation() ) ); + txtEngineManufacturer.setText( CommonTools.UnknownToEmpty( CurMech.GetEngineManufacturer() ) ); + txtArmorModel.setText( CommonTools.UnknownToEmpty( CurMech.GetArmorModel() ) ); + txtChassisModel.setText( CommonTools.UnknownToEmpty( CurMech.GetChassisModel() ) ); if( CurMech.GetJumpJets().GetNumJJ() > 0 ) { txtJJModel.setEnabled( true ); } txtSource.setText( CurMech.GetSource() ); // omnimechs may have jump jets in one loadout and not another. - txtJJModel.setText( CurMech.GetJJModel() ); - txtCommSystem.setText( CurMech.GetCommSystem() ); - txtTNTSystem.setText( CurMech.GetTandTSystem() ); + txtJJModel.setText( CommonTools.UnknownToEmpty( CurMech.GetJJModel() ) ); + txtCommSystem.setText( CommonTools.UnknownToEmpty( CurMech.GetCommSystem() ) ); + txtTNTSystem.setText( CommonTools.UnknownToEmpty( CurMech.GetTandTSystem() ) ); // see if we should enable the Power Amplifier display if( CurMech.GetEngine().IsNuclear() ) { @@ -11331,7 +10966,7 @@ private void btnExportMTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN- } String filename = ""; - IO.MTFWriter mtfw = new IO.MTFWriter( CurMech ); + IO.MTFWriter mtfw = new IO.MTFWriter( CurMech, SSWConstants.AppDescription + " " + SSWConstants.GetVersion() ); try { filename = savemech.getCanonicalPath(); mtfw.WriteMTF( filename ); @@ -12267,8 +11902,8 @@ private void btnAddEquipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F if( a != null ) { try { CurMech.GetLoadout().CheckExclusions( a ); - if( a instanceof Equipment ) { - ((Equipment) a).Validate(CurMech); + if( a instanceof ifEquipment ) { + ((ifEquipment) a).Validate(CurMech); } } catch( Exception e ) { Media.Messager( e.getMessage() ); @@ -13720,7 +13355,6 @@ private void btnLockChassisActionPerformed(java.awt.event.ActionEvent evt) {//GE // make it an omni CurMech.SetOmnimech( VariantName ); - chkOmnimech.setEnabled( false ); FixTransferHandlers(); SetLoadoutArrays(); FixJJSpinnerModel(); @@ -14017,11 +13651,7 @@ private void cmbMechTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F }//GEN-LAST:event_cmbMechTypeActionPerformed private void chkOmnimechActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkOmnimechActionPerformed - if( chkOmnimech.isSelected() ) { - btnLockChassis.setEnabled( true ); - } else { - btnLockChassis.setEnabled( false ); - } + btnLockChassis.setEnabled( chkOmnimech.isSelected() ); }//GEN-LAST:event_chkOmnimechActionPerformed private void cmbPhysEnhanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbPhysEnhanceActionPerformed @@ -14379,6 +14009,7 @@ private void cmbRulesLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN FixWalkMPSpinner(); FixJJSpinnerModel(); RefreshEquipment(); + CheckOmnimech(); // now reset the combo boxes to the closest choices we previously selected LoadSelections(); @@ -14495,23 +14126,7 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G cmbTechBase.setEnabled( true ); txtProdYear.setEnabled( true ); CurMech.SetYearRestricted( false ); - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - CurMech.SetYear( 2750, false ); - break; - case AvailableCode.ERA_SUCCESSION: - CurMech.SetYear( 3025, false ); - break; - case AvailableCode.ERA_CLAN_INVASION: - CurMech.SetYear( 3070, false ); - break; - case AvailableCode.ERA_DARK_AGES: - CurMech.SetYear( 3132, false ); - break; - case AvailableCode.ERA_ALL: - CurMech.SetYear( 0, false ); - break; - } + CurMech.SetYear( CommonTools.GetEraDefaultYear( cmbMechEra.getSelectedIndex() ), false ); } else { // ensure we have a good year. try{ @@ -14524,47 +14139,15 @@ private void chkYearRestrictActionPerformed(java.awt.event.ActionEvent evt) {//G } // ensure the year is between the era years. - switch ( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - // Star League era - if( year < 2443 || year > 2800 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_SUCCESSION: - // Succession Wars era - if( year < 2801 || year > 3050 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_CLAN_INVASION: - // Clan Invasion Era - if( year < 3051 || year > 3131 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_DARK_AGES: - // Clan Invasion Era - if( year < 3132 ) { - Media.Messager( this, "The year does not fall within this era." ); - txtProdYear.setText( "" ); - chkYearRestrict.setSelected( false ); - return; - } - break; - case AvailableCode.ERA_ALL: - // all era + if( cmbMechEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CommonTools.IsYearInEra( year, cmbMechEra.getSelectedIndex() ) ) { + Media.Messager( this, "The year does not fall within this era." ); + txtProdYear.setText( "" ); chkYearRestrict.setSelected( false ); - chkYearRestrict.setEnabled( false ); + } + } else { + chkYearRestrict.setSelected( false ); + chkYearRestrict.setEnabled( false ); } // we know we have a good year, lock it in. @@ -14633,42 +14216,13 @@ private void cmbMechEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI int tbsave = cmbTechBase.getSelectedIndex(); // change the year range and tech base options - switch( cmbMechEra.getSelectedIndex() ) { - case AvailableCode.ERA_STAR_LEAGUE: - lblEraYears.setText( "2443 ~ 2800" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_STAR_LEAGUE ); - CurMech.SetYear( 2750, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_SUCCESSION: - lblEraYears.setText( "2801 ~ 3050" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_SUCCESSION ); - CurMech.SetYear( 3025, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_CLAN_INVASION: - lblEraYears.setText( "3051 ~ 3131" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_CLAN_INVASION ); - CurMech.SetYear( 3075, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_DARK_AGES: - lblEraYears.setText( "3132 on" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_DARK_AGES ); - CurMech.SetYear( 3132, false ); - if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } - break; - case AvailableCode.ERA_ALL: - lblEraYears.setText( "Any" ); - txtProdYear.setText( "" ); - CurMech.SetEra( AvailableCode.ERA_ALL ); - CurMech.SetYear( 0, false ); - chkYearRestrict.setEnabled( false ); - break; + lblEraYears.setText( CommonTools.GetEraYearRange( cmbMechEra.getSelectedIndex() ) ); + txtProdYear.setText( "" ); + CurMech.SetEra( cmbMechEra.getSelectedIndex() ); + if( cmbMechEra.getSelectedIndex() != AvailableCode.ERA_ALL ) { + if( ! CurMech.IsOmnimech() ) { chkYearRestrict.setEnabled( true ); } + } else { + chkYearRestrict.setEnabled( false ); } if( CurMech.IsOmnimech() ) { @@ -14760,16 +14314,17 @@ private void chkBoobyTrapActionPerformed(java.awt.event.ActionEvent evt) {//GEN- RefreshInfoPane(); }//GEN-LAST:event_chkBoobyTrapActionPerformed -private void cmbProductionEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbProductionEraActionPerformed - CurMech.SetProductionEra( cmbProductionEra.getSelectedIndex() ); -}//GEN-LAST:event_cmbProductionEraActionPerformed + private void cmbProductionEraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbProductionEraActionPerformed + CurMech.SetProductionEra( cmbProductionEra.getSelectedIndex() ); + }//GEN-LAST:event_cmbProductionEraActionPerformed - private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddQuirkActionPerformed + private void btnAddQuirkActionPerformed(java.awt.event.ActionEvent evt) { dlgQuirks qmanage = new dlgQuirks(this, true, data, quirks); qmanage.setLocationRelativeTo(this); qmanage.setVisible(true); tblQuirks.setModel(new tbQuirks(quirks)); - }//GEN-LAST:event_btnAddQuirkActionPerformed + CurMech.SetQuirks(quirks); + } private void mnuReloadEquipmentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuReloadEquipmentActionPerformed try { @@ -14978,26 +14533,11 @@ private void setViewToolbar(boolean Visible) private javax.swing.JScrollPane jScrollPane14; private javax.swing.JScrollPane jScrollPane16; private javax.swing.JScrollPane jScrollPane17; - private javax.swing.JScrollPane jScrollPane18; - private javax.swing.JScrollPane jScrollPane19; - private javax.swing.JScrollPane jScrollPane20; - private javax.swing.JScrollPane jScrollPane21; - private javax.swing.JScrollPane jScrollPane22; - private javax.swing.JScrollPane jScrollPane24; - private javax.swing.JScrollPane jScrollPane8; - private javax.swing.JScrollPane jScrollPane9; - private javax.swing.JSeparator jSeparator1; - private javax.swing.JSeparator jSeparator10; - private javax.swing.JSeparator jSeparator11; - private javax.swing.JSeparator jSeparator12; private javax.swing.JSeparator jSeparator13; private javax.swing.JSeparator jSeparator14; private javax.swing.JSeparator jSeparator15; private javax.swing.JSeparator jSeparator16; private javax.swing.JSeparator jSeparator17; - private javax.swing.JSeparator jSeparator18; - private javax.swing.JSeparator jSeparator19; - private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator20; private javax.swing.JToolBar.Separator jSeparator21; private javax.swing.JToolBar.Separator jSeparator22; @@ -15008,14 +14548,7 @@ private void setViewToolbar(boolean Visible) private javax.swing.JSeparator jSeparator27; private javax.swing.JSeparator jSeparator28; private javax.swing.JSeparator jSeparator29; - private javax.swing.JSeparator jSeparator3; private javax.swing.JSeparator jSeparator30; - private javax.swing.JSeparator jSeparator4; - private javax.swing.JSeparator jSeparator5; - private javax.swing.JSeparator jSeparator6; - private javax.swing.JSeparator jSeparator7; - private javax.swing.JSeparator jSeparator8; - private javax.swing.JSeparator jSeparator9; private javax.swing.JTextArea jTextAreaBFConversion; private javax.swing.JLabel lblAVInLot; private javax.swing.JLabel lblArmorCoverage; @@ -15191,13 +14724,10 @@ private void setViewToolbar(boolean Visible) private javax.swing.JMenuItem mnuUnlock; private javax.swing.JCheckBoxMenuItem mnuViewToolbar; private javax.swing.JPanel pnlAdditionalFluff; - private javax.swing.JPanel pnlAmmunition; private javax.swing.JPanel pnlArmor; private javax.swing.JPanel pnlArmorInfo; private javax.swing.JPanel pnlArmorSetup; - private javax.swing.JPanel pnlArtillery; private javax.swing.JPanel pnlBFStats; - private javax.swing.JPanel pnlBallistic; private javax.swing.JPanel pnlBasicInformation; private javax.swing.JPanel pnlBasicSetup; private javax.swing.JPanel pnlBasicSummary; @@ -15210,10 +14740,8 @@ private void setViewToolbar(boolean Visible) private javax.swing.JPanel pnlControls; private javax.swing.JPanel pnlDamageChart; private javax.swing.JPanel pnlDeployment; - private javax.swing.JPanel pnlEnergy; private javax.swing.JPanel pnlEquipInfo; private javax.swing.JPanel pnlEquipment; - private javax.swing.JPanel pnlEquipmentChooser; private javax.swing.JPanel pnlEquipmentToPlace; private javax.swing.JPanel pnlExport; private javax.swing.JPanel pnlFluff; @@ -15232,13 +14760,11 @@ private void setViewToolbar(boolean Visible) private javax.swing.JPanel pnlLTCrits; private javax.swing.JPanel pnlLTRArmorBox; private javax.swing.JPanel pnlManufacturers; - private javax.swing.JPanel pnlMissile; private javax.swing.JPanel pnlMovement; private javax.swing.JPanel pnlNotables; private javax.swing.JPanel pnlOmniInfo; private javax.swing.JPanel pnlOverview; private javax.swing.JPanel pnlPatchworkChoosers; - private javax.swing.JPanel pnlPhysical; private javax.swing.JPanel pnlQuirks; private javax.swing.JPanel pnlRAArmorBox; private javax.swing.JPanel pnlRACrits; @@ -15253,6 +14779,7 @@ private void setViewToolbar(boolean Visible) private javax.swing.JPanel pnlWeaponsManufacturers; private javax.swing.JScrollPane scpQuirkTable; private javax.swing.JScrollPane scpWeaponManufacturers; + private javax.swing.JScrollPane scrEquipToPlace; private javax.swing.JScrollPane scrLACrits; private javax.swing.JScrollPane scrRACrits; private javax.swing.JSpinner spnBoosterMP; diff --git a/ssw/src/main/java/ssw/gui/thHDTransferHandler.java b/ssw/src/main/java/ssw/gui/thHDTransferHandler.java index 8cc988c6..d1a56454 100644 --- a/ssw/src/main/java/ssw/gui/thHDTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thHDTransferHandler.java @@ -129,6 +129,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { LocationDragDatagram DropItem = null; boolean rear = false; + boolean turreted = false; // get the item data try { DropItem = (LocationDragDatagram) info.getTransferable().getTransferData( new DataFlavor( LocationDragDatagram.class, "Location Drag Datagram" ) ); @@ -149,6 +150,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // from another location a = CurMech.GetLoadout().GetCrits( DropItem.Location )[DropItem.SourceIndex]; rear = a.IsMountedRear(); + turreted = a.IsTurreted(); if( a.CanSplit() && a.Contiguous() ) { CurMech.GetLoadout().UnallocateAll( a, false ); } else { @@ -170,6 +172,9 @@ public boolean importData( TransferHandler.TransferSupport info ) { CurMech.GetLoadout().RemoveFromQueue( a ); } a.MountRear( rear ); + if( turreted ) { + a.MountTurret( CurMech.GetLoadout().GetHDTurret() ); + } Parent.RefreshSummary(); Parent.RefreshInfoPane(); return true; diff --git a/ssw/src/main/java/ssw/gui/thLTTransferHandler.java b/ssw/src/main/java/ssw/gui/thLTTransferHandler.java index 634b7054..760f1a68 100644 --- a/ssw/src/main/java/ssw/gui/thLTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thLTTransferHandler.java @@ -183,6 +183,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { LocationDragDatagram DropItem = null; boolean rear = false; + boolean turreted = false; // get the item data try { DropItem = (LocationDragDatagram) info.getTransferable().getTransferData( new DataFlavor( LocationDragDatagram.class, "Location Drag Datagram" ) ); @@ -204,6 +205,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // from another location a = CurMech.GetLoadout().GetCrits( DropItem.Location )[DropItem.SourceIndex]; rear = a.IsMountedRear(); + turreted = a.IsTurreted(); if( a.CanSplit() && a.Contiguous() ) { // find all locations before unallocating v = CurMech.GetLoadout().FindSplitIndex( a ); @@ -269,6 +271,9 @@ public boolean importData( TransferHandler.TransferSupport info ) { CurMech.GetLoadout().RemoveFromQueue( a ); } a.MountRear( rear ); + if( turreted ) { + a.MountTurret( CurMech.GetLoadout().GetLTTurret() ); + } if( a instanceof VehicularGrenadeLauncher ) { // reset the arc as it may not be appropriate ((VehicularGrenadeLauncher ) a).SetArcFore(); diff --git a/ssw/src/main/java/ssw/gui/thRTTransferHandler.java b/ssw/src/main/java/ssw/gui/thRTTransferHandler.java index 943e61ff..c40e598d 100644 --- a/ssw/src/main/java/ssw/gui/thRTTransferHandler.java +++ b/ssw/src/main/java/ssw/gui/thRTTransferHandler.java @@ -183,6 +183,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { LocationDragDatagram DropItem = null; boolean rear = false; + boolean turreted = false; // get the item data try { DropItem = (LocationDragDatagram) info.getTransferable().getTransferData( new DataFlavor( LocationDragDatagram.class, "Location Drag Datagram" ) ); @@ -204,6 +205,7 @@ public boolean importData( TransferHandler.TransferSupport info ) { // from another location a = CurMech.GetLoadout().GetCrits( DropItem.Location )[DropItem.SourceIndex]; rear = a.IsMountedRear(); + turreted = a.IsTurreted(); if( a.CanSplit() && a.Contiguous() ) { // find all locations before unallocating v = CurMech.GetLoadout().FindSplitIndex( a ); @@ -269,6 +271,9 @@ public boolean importData( TransferHandler.TransferSupport info ) { CurMech.GetLoadout().RemoveFromQueue( a ); } a.MountRear( rear ); + if( turreted ) { + a.MountTurret( CurMech.GetLoadout().GetRTTurret() ); + } if( a instanceof VehicularGrenadeLauncher ) { // reset the arc as it may not be appropriate ((VehicularGrenadeLauncher ) a).SetArcFore(); diff --git a/sswlib/src/main/java/IO/MTFWriter.java b/sswlib/src/main/java/IO/MTFWriter.java index aa782952..1ba9eb33 100644 --- a/sswlib/src/main/java/IO/MTFWriter.java +++ b/sswlib/src/main/java/IO/MTFWriter.java @@ -42,18 +42,13 @@ public class MTFWriter { private CombatVehicle CurVee; private String Prepend = ""; private boolean mixed = false; + private String Version = ""; public MTFWriter( ) { - } - public MTFWriter( Mech m ) { - CurMech = m; - } - - public MTFWriter( CombatVehicle v ) { - CurVee = v; - } + public MTFWriter( Mech m, String version ) { CurMech = m; Version = version; } + public MTFWriter( CombatVehicle v, String version ) { CurVee = v; Version = version; } public void WriteMechMTF( String filename ) throws IOException { BufferedWriter FR = new BufferedWriter( new FileWriter( filename ) ); @@ -72,9 +67,10 @@ public void WriteMechMTF( String filename ) throws IOException { mixed = true; break; } - // first block for vesioning and name FR.write( "Version:1.1" ); FR.newLine(); + FR.write( "Generator:" + Version ); + FR.newLine(); FR.write( CurMech.GetName() ); FR.newLine(); if( CurMech.IsOmnimech() ) { @@ -364,7 +360,6 @@ public void WriteMechMTF( String filename ) throws IOException { public void WriteVeeMTF( String filename ) throws IOException { BufferedWriter FR = new BufferedWriter( new FileWriter( filename ) ); - // get the prepend string for stuff that needs it switch( CurVee.GetLoadout().GetTechBase() ) { case AvailableCode.TECH_INNER_SPHERE: Prepend = "IS"; @@ -378,8 +373,7 @@ public void WriteVeeMTF( String filename ) throws IOException { mixed = true; break; } - // first block for vesioning and name - FR.write( "Version:1.1" ); + FR.write( "Generator:" + Version ); FR.newLine(); FR.write( CurVee.GetName() ); FR.newLine(); @@ -393,8 +387,6 @@ public void WriteVeeMTF( String filename ) throws IOException { FR.write( CurVee.GetModel() ); } FR.newLine(); - - // second block handles general mech stuff FR.newLine(); FR.write( "Config:" + CurVee.getCurConfig().GetMotiveLookupName() ); FR.newLine(); @@ -419,8 +411,6 @@ public void WriteVeeMTF( String filename ) throws IOException { FR.newLine(); FR.write( "Rules Level:" + CurVee.GetMegaMekLevel() ); FR.newLine(); - - // third block for mech specifics FR.newLine(); FR.write( "Mass:" + CurVee.GetTonnage() ); FR.newLine(); @@ -471,6 +461,8 @@ public void WriteVeeMTF( String filename ) throws IOException { } FR.write( "Cruise MP:" + CurVee.getCruiseMP() ); FR.newLine(); + FR.write( "Flank MP:" + CurVee.getFlankMP() ); + FR.newLine(); FR.write( "Jump MP:" + CurVee.GetJumpJets().GetNumJJ() ); FR.newLine(); @@ -486,27 +478,37 @@ public void WriteVeeMTF( String filename ) throws IOException { FR.write( "Armor:" + CurVee.GetArmor().MegaMekName( false ) ); } FR.newLine(); - FR.write( "LA Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LA) ); - FR.newLine(); - FR.write( "RA Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RA) ); - FR.newLine(); - FR.write( "LT Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LT) ); - FR.newLine(); - FR.write( "RT Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RT) ); - FR.newLine(); - FR.write( "CT Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CT) ); - FR.newLine(); - FR.write( "HD Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_HD) ); + FR.write( "Front Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_FRONT) ); FR.newLine(); - FR.write( "LL Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LL) ); + FR.write( "Left Side Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_LEFT) ); FR.newLine(); - FR.write( "RL Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RL) ); + FR.write( "Right Side Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_RIGHT) ); FR.newLine(); - FR.write( "RTL Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_LTR) ); + FR.write( "Body Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_BODY) ); FR.newLine(); - FR.write( "RTR Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_RTR) ); - FR.newLine(); - FR.write( "RTC Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.MECH_LOC_CTR) ); + if (CurVee.getCurConfig().IsVTOL()) { + FR.write("Rotor Armor:" + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_ROTOR)); + FR.newLine(); + } + if (CurVee.isHasSponsonTurret()) { + FR.write("Left Sponson Armor:" + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_SPONSON_LEFT)); + FR.newLine(); + FR.write( "Right Sponson Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_SPONSON_RIGHT) ); + FR.newLine(); + } + if (CurVee.isHasTurret1() && !CurVee.isHasTurret2()) { + FR.write("Turret Armor:" + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_TURRET1)); + FR.newLine(); + } + if (CurVee.isHasTurret1() && CurVee.isHasTurret2()) { + FR.write("Turret 1 Armor:" + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_TURRET1)); + FR.newLine(); + } + if (CurVee.isHasTurret2()) { + FR.write("Turret 2 Armor:" + CurVee.GetArmor().GetLocationArmor(LocationIndex.CV_LOC_TURRET2)); + FR.newLine(); + } + FR.write( "Rear Armor:" + CurVee.GetArmor().GetLocationArmor( LocationIndex.CV_LOC_REAR) ); FR.newLine(); // sixth block for weapon information. Get the loadout directly as this @@ -550,9 +552,9 @@ public void WriteVeeMTF( String filename ) throws IOException { } // now that we have the amount, add the line in if( ammoamount > 0 ) { - FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.MechLocs[l.Find( p )] + rear + ", Ammo:" + ammoamount ); + FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.CVLocs[l.Find( p )] + rear + ", Ammo:" + ammoamount ); } else { - FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.MechLocs[l.Find( p )] + rear ); + FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.CVLocs[l.Find( p )] + rear ); } } else { // check for a rear-facing weapon @@ -561,24 +563,24 @@ public void WriteVeeMTF( String filename ) throws IOException { rear = " (R)"; } // no ammo checking needed - FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.MechLocs[l.Find( p )] + rear ); + FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.CVLocs[l.Find( p )] + rear ); } FR.newLine(); } else { // not a weapon so no ammo checking. Add it to the file - FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.MechLocs[l.Find( p )] ); + FR.write( "1 " + GetMMName( p ) + ", " + LocationIndex.CVLocs[l.Find( p )] ); FR.newLine(); } // format is: // "1 , , Ammo: } - // all done FR.close(); } public void WriteMTF( String filename ) throws IOException { + if (CurMech != null) { WriteMechMTF(filename); return; diff --git a/sswlib/src/main/java/Print/PrintConsts.java b/sswlib/src/main/java/Print/PrintConsts.java index 3d909a41..c74d64f3 100644 --- a/sswlib/src/main/java/Print/PrintConsts.java +++ b/sswlib/src/main/java/Print/PrintConsts.java @@ -448,6 +448,18 @@ private static ArrayList HandleLocation( CombatVehicle CurUnit, i // ATM, MML, Artemis, TC, etc PlaceableInfo factory = new PlaceableInfo(MiniConvRate, common.Constants.Vehicle); if ( p.Item instanceof ifWeapon ) { + //TODO: Why did I have to do this? It works fine for Mechs but didn't here + if (p.Item instanceof MGArray) { + MGArray temp =((MGArray) p.Item); + p.damage = temp.GetDamageShort() + ""; + p.rShort = temp.GetRangeShort() + ""; + p.rMed = temp.GetRangeMedium() + ""; + p.rLong = temp.GetRangeLong() + ""; + if( temp.GetSpecials().equals( "-" ) ) + p.damage += " [" + temp.GetType() + "]"; + else + p.specials = ("[" + temp.GetType() + ", " + temp.GetSpecials() + "]").replace(", -", ""); + } if( ((ifWeapon) p.Item).GetWeaponClass() == ifWeapon.W_MISSILE ) { if ( ((ifWeapon) p.Item).CritName().contains("ATM") ) { ArrayList t = new ArrayList(); diff --git a/sswlib/src/main/java/Print/PrintMech.java b/sswlib/src/main/java/Print/PrintMech.java index 8eea5c96..c0700074 100644 --- a/sswlib/src/main/java/Print/PrintMech.java +++ b/sswlib/src/main/java/Print/PrintMech.java @@ -553,7 +553,7 @@ private void DrawMechData( Graphics2D graphics ) { graphics.drawString( String.format( "%1$,d", CurMech.GetCurrentBV() ), p[PrintConsts.BV2].x, p[PrintConsts.BV2].y ); else graphics.drawString( String.format( "%1$,.0f (Base: %2$,d)", BV, CurMech.GetCurrentBV() ), p[PrintConsts.BV2].x, p[PrintConsts.BV2].y ); - graphics.drawString( "Weapon Heat (" + CurMech.GetWeaponHeat(false, false, true, false) + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y-7 ); + graphics.drawString( String.format( "Weapon Heat (%1$,.1f)", CurMech.GetWeaponHeat() ), p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y-7 ); graphics.drawString( "Dissipation (" + CurMech.GetHeatSinks().TotalDissipation() + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y+1 ); //graphics.drawString( "Weapon Heat (" + CurMech.GetWeaponHeat(false, false, true, false) + ")", p[PrintConsts.MAX_HEAT].x-1, p[PrintConsts.MAX_HEAT].y ); graphics.setFont( PrintConsts.SmallFont ); diff --git a/sswlib/src/main/java/Print/PrintVehicle.java b/sswlib/src/main/java/Print/PrintVehicle.java index a18f7fdb..66a61d20 100644 --- a/sswlib/src/main/java/Print/PrintVehicle.java +++ b/sswlib/src/main/java/Print/PrintVehicle.java @@ -56,7 +56,8 @@ public class PrintVehicle implements Printable { TRO = false, printMech = false, printLogo = false, - makeAmmoGeneric = false; + makeAmmoGeneric = false, + UseMiniRate = false; private String PilotName = "", GroupName = "", currentAmmoFormat = ""; @@ -110,8 +111,9 @@ public void SetOptions( boolean charts, boolean PrintP, double UseBV ) { PrintPilot = PrintP; } - public void SetMiniConversion( int conv ) { + public void SetMiniConversion( int conv, Boolean useMini ) { MiniConvRate = conv; + UseMiniRate = useMini; } public void setMechwarrior(String name) { @@ -168,7 +170,7 @@ public void setTRO(boolean TRO) { this.TRO = TRO; setCanon(true); setCharts(false); - SetMiniConversion(1); + SetMiniConversion(1, false); setPrintPilot(false); currentAmmoFormat = Prefs.get( "AmmoNamePrintFormat", "" ); Prefs.put( "AmmoNamePrintFormat", "Ammo (%P) %L" ); @@ -295,6 +297,14 @@ private void DrawMechData( Graphics2D graphics ) { // graphics.drawString("+2", p[7].x, p[7].y-15); // graphics.drawString("+4", p[8].x, p[8].y-15); // } + + //Coverup the (hexes) above the ranges if we are not using traditional measurements + if (UseMiniRate) + { + graphics.setColor(Color.white); + graphics.fillRect(p[6].x-5, p[6].y-28, 30, 10); + graphics.setColor(Color.black); + } graphics.setFont( PrintConsts.ReallySmallFont ); if (TotalItemLines() > 15) { graphics.setFont( PrintConsts.TinyFont ); } @@ -345,7 +355,7 @@ private void DrawMechData( Graphics2D graphics ) { if ( !TRO ) { if ( AmmoList.size() > 0 ) { offset += 2; - graphics.drawString("Ammunition Type" + ( CurVee.GetLoadout().HasISCASE() ? " [CASE]":"" ), p[0].x, p[0].y + offset); + graphics.drawString("Ammunition Type" + ( CurVee.GetLoadout().HasCase() ? " [CASE]":"" ), p[0].x, p[0].y + offset); graphics.drawString("Rounds", p[3].x-30, p[3].y + offset); offset += 2; graphics.drawLine(p[0].x, p[0].y + offset, p[8].x + 8, p[8].y + offset); @@ -383,8 +393,23 @@ private void DrawMechData( Graphics2D graphics ) { // have to hack the movement to print the correct stuff here. graphics.setFont( PrintConsts.Small8Font ); - graphics.drawString( ( CurVee.getCruiseMP() * MiniConvRate ) + "", p[PrintConsts.WALKMP].x, p[PrintConsts.WALKMP].y ); - graphics.drawString( CurVee.getFlankMP( MiniConvRate ) + "", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + //graphics.drawString( ( CurVee.getCruiseMP() * MiniConvRate ) + "", p[PrintConsts.WALKMP].x, p[PrintConsts.WALKMP].y ); + //graphics.drawString( CurVee.getFlankMP( MiniConvRate ) + "", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + + if( CurVee.GetAdjustedCruiseMP( false, true ) != CurVee.getCruiseMP() ) { + graphics.drawString( ( CurVee.getCruiseMP() * MiniConvRate ) + " (" + ( CurVee.GetAdjustedCruiseMP( false, true ) * MiniConvRate ) + ")", p[PrintConsts.WALKMP].x, p[PrintConsts.WALKMP].y ); + } else { + graphics.drawString( ( CurVee.getCruiseMP() * MiniConvRate ) + "", p[PrintConsts.WALKMP].x, p[PrintConsts.WALKMP].y ); + } + if( CurVee.GetAdjustedFlankMP( false, true ) != CurVee.getFlankMP() ) { + if( CurVee.GetAdjustedFlankMP( false, true ) < CurVee.getFlankMP() ) { + graphics.drawString( CurVee.GetAdjustedFlankMP( false, true, MiniConvRate ) + "", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + } else { + graphics.drawString( CurVee.getFlankMP( MiniConvRate ) + " (" + CurVee.GetAdjustedFlankMP( false, true, MiniConvRate ) + ")", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + } + } else { + graphics.drawString( CurVee.getFlankMP( MiniConvRate ) + "", p[PrintConsts.RUNMP].x, p[PrintConsts.RUNMP].y ); + } // Movement and Engine if ( !CurVee.IsVTOL() ) { diff --git a/sswlib/src/main/java/Print/preview/dlgPreview.java b/sswlib/src/main/java/Print/preview/dlgPreview.java index ac84db43..32309889 100644 --- a/sswlib/src/main/java/Print/preview/dlgPreview.java +++ b/sswlib/src/main/java/Print/preview/dlgPreview.java @@ -479,7 +479,7 @@ private void PrinterSetup() { pv.setPrintPilot(chkPrintGroup.isSelected()); if ( cmbPaperSize.getSelectedIndex() == 2 ) pv.setA4(); if ( chkPrintGroup.isSelected() ) pv.setGroupName( g.getName() + " [" + g.getForce().ForceName + "]" ); - if ( chkUseHexConversion.isSelected() ) pv.SetMiniConversion(cmbHexConvFactor.getSelectedIndex()+1); + if ( chkUseHexConversion.isSelected() ) {pv.SetMiniConversion(cmbHexConvFactor.getSelectedIndex()+1, true);} else {pv.SetMiniConversion(1, false);}; if ( chkLogo.isSelected() ) pv.setLogoImage(imageTracker.getImage(g.getLogo())); if ( cmbRSType.getSelectedIndex() == 1 ) pv.setTRO(true); printer.Append( pageSize, pv); diff --git a/sswlib/src/main/java/battleforce/BattleForceTools.java b/sswlib/src/main/java/battleforce/BattleForceTools.java index f81fb2e6..859364c5 100644 --- a/sswlib/src/main/java/battleforce/BattleForceTools.java +++ b/sswlib/src/main/java/battleforce/BattleForceTools.java @@ -168,7 +168,7 @@ public static String GetMovementString( ifBattleforce b ){ // at least 10 turns. If not, reduce the damage by 25%. if ( w.HasAmmo() && ! w.IsOneShot() ) { - if ( (b.GetAmmoCount( w.GetAmmoIndex() ) / b.GetWeaponCount(w.GetAmmoIndex()) ) < 10 ) + if ((b.GetWeaponCount(w.GetAmmoIndex()) == 0) || (b.GetAmmoCount( w.GetAmmoIndex() ) / b.GetWeaponCount(w.GetAmmoIndex()) < 10) ) { retval[BFConstants.BF_SHORT] *= 0.75; retval[BFConstants.BF_MEDIUM] *= 0.75; diff --git a/sswlib/src/main/java/common/CommonTools.java b/sswlib/src/main/java/common/CommonTools.java index 7cbeb69b..c95f5abb 100644 --- a/sswlib/src/main/java/common/CommonTools.java +++ b/sswlib/src/main/java/common/CommonTools.java @@ -103,6 +103,56 @@ public static String DecodeEra( int era ) { } } + public static int GetEraDefaultYear( int era ) { + switch( era ) { + case AvailableCode.ERA_STAR_LEAGUE: + return 2750; + case AvailableCode.ERA_SUCCESSION: + return 3025; + case AvailableCode.ERA_CLAN_INVASION: + return 3070; + case AvailableCode.ERA_DARK_AGES: + return 3132; + default: + return 0; + } + } + + public static String GetEraYearRange( int era ) { + switch( era ) { + case AvailableCode.ERA_STAR_LEAGUE: + return "2443 ~ 2800"; + case AvailableCode.ERA_SUCCESSION: + return "2801 ~ 3050"; + case AvailableCode.ERA_CLAN_INVASION: + return "3051 ~ 3131"; + case AvailableCode.ERA_DARK_AGES: + return "3132 on"; + default: + return "Any"; + } + } + + public static boolean IsYearInEra( int year, int era ) { + switch ( era ) { + case AvailableCode.ERA_STAR_LEAGUE: + // Star League era + return year >= 2443 && year <= 2800; + case AvailableCode.ERA_SUCCESSION: + // Succession Wars era + return year >= 2801 && year <= 3050; + case AvailableCode.ERA_CLAN_INVASION: + // Clan Invasion Era + return year >= 3051 && year <= 3131; + case AvailableCode.ERA_DARK_AGES: + // Clan Invasion Era + return year >= 3132; + default: + // all era + return true; + } + } + public static String GetRulesLevelString( int level ) { switch( level ) { case AvailableCode.RULES_INTRODUCTORY: @@ -135,6 +185,17 @@ public static String GetTechbaseString( int tech ) { } } + public static int GetTechbaseValue( String tech ) { + switch( tech ) { + case "Clan": + return AvailableCode.TECH_CLAN; + case "Mixed": + return AvailableCode.TECH_BOTH; + default: + return AvailableCode.TECH_INNER_SPHERE; + } + } + public static String GetAggregateReportBV( abPlaceable p ) { // since an item may have both offensive and defensive BV, this gives us // an aggregate battle value string for reporting @@ -853,4 +914,13 @@ public static String shortenPath( String path, int maxlength ) { } return newPath; } + + public static String UnknownToEmpty( String str ) { + if( str == null || str.isEmpty() + || str.equalsIgnoreCase( "Unknown" ) + || str.equalsIgnoreCase( "None" ) ) { + return ""; + } + return str; + } } diff --git a/sswlib/src/main/java/common/EquipmentFactory.java b/sswlib/src/main/java/common/EquipmentFactory.java index b33e7207..0a713bff 100644 --- a/sswlib/src/main/java/common/EquipmentFactory.java +++ b/sswlib/src/main/java/common/EquipmentFactory.java @@ -122,6 +122,7 @@ public EquipmentFactory( ArrayList rweapons, ArrayList pweapons, ArrayList equip Equipment.add( new ModularArmor() ); Equipment.add( new EquipmentProtoSuccWarsDoubleHeatSink()); Equipment.add( new EquipmentProtoStarLeagueDoubleHeatSink()); + Equipment.add( new LiftHoist(m)); BuildPhysicals( m ); if (( m.GetUnitType() == AvailableCode.UNIT_BATTLEMECH ) && ( m instanceof Mech) ) { PhysicalWeapons.add( new Talons( (Mech) m ) ); @@ -130,6 +131,7 @@ public EquipmentFactory( ArrayList rweapons, ArrayList pweapons, ArrayList equip } if ( m instanceof CombatVehicle ) { Equipment.add( new Hitch() ); + Equipment.add( new ArmoredMotiveSystem(((CombatVehicle) m).GetLoadout())); } BuildMGArrays(); } @@ -141,6 +143,10 @@ public abPlaceable GetCopy( abPlaceable p, ifUnit m ) { retval = new ExtendedFuelTank( (Mech) m ); } else if( p instanceof DroneOperatingSystem ) { retval = new DroneOperatingSystem( (Mech) m ); + } else if (p instanceof LiftHoist) { + retval = new LiftHoist(m); + } else if (p instanceof ArmoredMotiveSystem) { + retval = new ArmoredMotiveSystem(((CombatVehicle)m).GetLoadout()); } else if( p instanceof Equipment ) { retval = ((Equipment) p).Clone(); } else if( p instanceof ModularArmor ) { @@ -558,7 +564,7 @@ public final void BuildMGArrays() { a.SetCLFactions( "", "", "CSF", "" ); a.SetPBMAllowed( true ); a.SetPIMAllowed( true ); - a.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + a.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); // MGA light machine gun addBW = GetRangedWeaponByName( "(IS) Light Machine Gun", null ); @@ -611,7 +617,7 @@ public final void BuildMGArrays() { a.SetCLFactions( "--", "--", "CDS", "--" ); a.SetPBMAllowed( true ); a.SetPIMAllowed( true ); - a.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + a.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); // LMGA light machine gun addBW = GetRangedWeaponByName( "(CL) Light Machine Gun", null ); diff --git a/sswlib/src/main/java/common/Utils.java b/sswlib/src/main/java/common/Utils.java index 69a8178d..1cc1b86b 100644 --- a/sswlib/src/main/java/common/Utils.java +++ b/sswlib/src/main/java/common/Utils.java @@ -1,7 +1,9 @@ package common; +import java.awt.*; +import java.awt.event.ActionListener; import java.io.File; -import javax.swing.ImageIcon; +import javax.swing.*; /* Utils.java is used by FileChooserDemo2.java. */ public class Utils { @@ -36,4 +38,69 @@ public static ImageIcon createImageIcon(String path) { return null; } } + + public static GridBagConstraints gridBag(int x, int y) { + return new GridBagConstraints(x, y, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, 1, new Insets(0, 0, 0, 0), 0, 0); + } + + public static GridBagConstraints gridBag(int x, int y, Insets inset) { + return new GridBagConstraints(x, y, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, 1, inset, 0, 0); + } + + public static GridBagConstraints gridBag(int x, int y, int width, int height) { + return new GridBagConstraints(x, y, width, height, 1.0, 1.0, GridBagConstraints.WEST, 1, new Insets(0, 0, 0, 0), 0, 0); + } + + public static GridBagConstraints gridBag(int x, int y, int width, int anchor, Insets inset) { + return new GridBagConstraints(x, y, width, 1, 1.0, 1.0, anchor, 1, inset, 0, 0); + } + + /* Returns a separator with etched border */ + public static JSeparator etchedSeparator() { + JSeparator sep = new JSeparator(); + sep.setBorder(BorderFactory.createEtchedBorder()); + return sep; + } + + public static JSeparator vertSeparator() { + JSeparator bar = new JSeparator(); + bar.setOrientation(SwingConstants.VERTICAL); + return bar; + } + + public static JButton imageButton(String toolTip, ActionListener listener, ImageIcon icon) { + JButton button = new JButton(); + button.setIcon(icon); + button.setToolTipText(toolTip); + button.setFocusable(false); + button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + button.addActionListener(listener); + return button; + } + + public static JLabel alignedLabel(String label, int alignment) { + JLabel lbl = new JLabel(label); + lbl.setHorizontalAlignment(alignment); + return lbl; + } + + public static JTextField summaryField(String label) { + JTextField txt = new JTextField(label); + txt.setEditable(false); + txt.setHorizontalAlignment(SwingConstants.CENTER); + return txt; + } + + public static JMenuItem menuItem(String label, ActionListener listener) { + JMenuItem item = new JMenuItem(label); + item.addActionListener(listener); + return item; + } + + public static JMenuItem menuItem(String label, ActionListener listener, KeyStroke keys) { + JMenuItem item = menuItem(label, listener); + item.setAccelerator(keys); + return item; + } } diff --git a/sswlib/src/main/java/components/Ammunition.java b/sswlib/src/main/java/components/Ammunition.java index 8daa18d0..d06947b7 100644 --- a/sswlib/src/main/java/components/Ammunition.java +++ b/sswlib/src/main/java/components/Ammunition.java @@ -325,6 +325,12 @@ public boolean CanArmor() { return false; } + @Override + public boolean CanMountTurret() { + // Ammunition can never be mounted in a turret + return false; + } + public Ammunition Clone() { return new Ammunition( this ); } diff --git a/sswlib/src/main/java/components/ArmoredMotiveSystem.java b/sswlib/src/main/java/components/ArmoredMotiveSystem.java new file mode 100644 index 00000000..dd176f29 --- /dev/null +++ b/sswlib/src/main/java/components/ArmoredMotiveSystem.java @@ -0,0 +1,110 @@ +package components; + +import common.CommonTools; +import common.EquipmentFactory; + +public class ArmoredMotiveSystem extends Equipment { + private ifCVLoadout Owner; + private AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); + public ArmoredMotiveSystem(ifCVLoadout l) { + AC.SetISCodes('E', 'X', 'X', 'F', 'E'); + AC.SetISDates( 3069, 3071, true, 0, 0, 0, false, false ); + AC.SetISFactions( "FWL", "FWL", "", "" ); + AC.SetCLCodes( 'F', 'X', 'X', 'F', 'E' ); + AC.SetCLDates( 3054, 3057, true, 0, 0, 0, false, false ); + AC.SetCLFactions( "CHH", "CHH", "", "" ); + AC.SetPBMAllowed( false ); + AC.SetPIMAllowed( false ); + AC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + + Owner = l; + } + @Override + public String ActualName() { + return "Armored Motive System"; + } + + @Override + public String LookupName() { + return "Armored Motive System"; + } + + @Override + public String CritName() { + return "Armored Motive System"; + } + + @Override + public String ChatName() { + return "ArmMotSys"; + } + + @Override + public String MegaMekName(boolean UseRear) { + return (IsClan() ? "CL" : "IS") + "ArmoredMotiveSystem"; + } + + @Override + public String BookReference() { + return "Tactical Operations"; + } + + @Override + public int NumCrits() { + return 0; + } + + @Override + public int NumCVSpaces() { + return 0; + } + + @Override + public double GetTonnage() { + return CommonTools.RoundHalfUp(Owner.GetOwner().GetTonnage() * (IsClan() ? .1 : .15)); + } + + @Override + public double GetCost() { + return 100000 * GetTonnage(); + } + + @Override + public double GetOffensiveBV() { + return 0; + } + + @Override + public double GetCurOffensiveBV(boolean UseRear, boolean UseTC, boolean UseAES) { + return 0; + } + + @Override + public double GetCurOffensiveBV(boolean UseRear, boolean UseTC, boolean UseAES, boolean UseRobotic) { + return 0; + } + + @Override + public double GetDefensiveBV() { + return 0; + } + + @Override + public AvailableCode GetAvailability() { + return AC; + } + + public void SetClan(boolean b ) { super.SetCurrentTech(b ? AvailableCode.TECH_CLAN : AvailableCode.TECH_INNER_SPHERE); } + + public boolean IsClan() { return (super.GetCurrentTech() == AvailableCode.TECH_CLAN); } + + @Override + public boolean CoreComponent() { + return true; + } + + @Override + public String GetEquipmentType() { + return "Armored Motive System"; + } +} diff --git a/sswlib/src/main/java/components/AvailableCode.java b/sswlib/src/main/java/components/AvailableCode.java index 3ade4852..9fa0653f 100644 --- a/sswlib/src/main/java/components/AvailableCode.java +++ b/sswlib/src/main/java/components/AvailableCode.java @@ -128,10 +128,10 @@ public void SetCodes( char istech, char isSL, char isSW, char isCI, char isDA, c IS_SW = isSW; IS_CI = isCI; IS_DA = isDA; - CL_TechRating = istech; - CL_SL = isSL; - CL_SW = isSW; - CL_CI = isCI; + CL_TechRating = cltech; + CL_SL = clSL; + CL_SW = clSW; + CL_CI = clCI; CL_DA = clDA; } diff --git a/sswlib/src/main/java/components/BipedLoadout.java b/sswlib/src/main/java/components/BipedLoadout.java index 59665b3e..58a39b8a 100644 --- a/sswlib/src/main/java/components/BipedLoadout.java +++ b/sswlib/src/main/java/components/BipedLoadout.java @@ -2221,17 +2221,6 @@ public boolean UnallocateAll( abPlaceable p, boolean override ) { if( ((RangedWeapon) p).IsUsingPulseModule() ) { UnallocateAll( ((RangedWeapon) p).GetPulseModule(), true ); } - if( ((RangedWeapon) p).IsTurreted() ) { - if( ((RangedWeapon) p).GetTurret() == HDTurret ) { - ((RangedWeapon) p).RemoveFromTurret( HDTurret ); - } - if( ((RangedWeapon) p).GetTurret() == LTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( LTTurret ); - } - if( ((RangedWeapon) p).GetTurret() == RTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( RTTurret ); - } - } } // if the item is an MG Array, check for it's MGs and unallocate @@ -2241,6 +2230,10 @@ public boolean UnallocateAll( abPlaceable p, boolean override ) { } } + if( p.IsTurreted() ) { + p.MountTurret( null ); + } + Owner.SetChanged( true ); // everything worked out fine @@ -2339,17 +2332,6 @@ public void UnallocateByIndex( int SIndex, abPlaceable[] a ) { if( ((RangedWeapon) p).IsUsingPulseModule() ) { UnallocateAll( ((RangedWeapon) p).GetPulseModule(), true ); } - if( ((RangedWeapon) p).IsTurreted() ) { - if( ((RangedWeapon) p).GetTurret() == HDTurret ) { - ((RangedWeapon) p).RemoveFromTurret( HDTurret ); - } - if( ((RangedWeapon) p).GetTurret() == LTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( LTTurret ); - } - if( ((RangedWeapon) p).GetTurret() == RTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( RTTurret ); - } - } } // if the item is an MG Array, check for it's MGs and unallocate @@ -2359,6 +2341,10 @@ public void UnallocateByIndex( int SIndex, abPlaceable[] a ) { } } + if( p.IsTurreted() ) { + p.MountTurret( null ); + } + Owner.SetChanged( true ); } @@ -2422,6 +2408,11 @@ public void AutoAllocate( EquipmentCollection e ) { while( ! Placed ) { try { switch( Loc ) { + case LocationIndex.MECH_LOC_HD: + AddToHD( p, FirstFree( HDCrits ) ); + Loc++; + Placed = true; + break; case LocationIndex.MECH_LOC_CT: AddToCT( p, FirstFree( CTCrits ) ); Loc++; @@ -2458,7 +2449,7 @@ public void AutoAllocate( EquipmentCollection e ) { Placed = true; break; default: - Loc = LocationIndex.MECH_LOC_CT; + Loc = LocationIndex.MECH_LOC_HD; DefCount++; } } catch( Exception x ) { @@ -3172,6 +3163,25 @@ public boolean IsAllocated( abPlaceable p ) { // Private Methods private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exception { + class RemoveEntry { + abPlaceable p; + boolean rear; + ifTurret turret; + + RemoveEntry( int AddInLoc, int i ) { + // we've already ensured that it is not location locked + // above, so put the item back into the queue. + p = Loc[i]; + rear = p.IsMountedRear(); + turret = p.GetTurret(); + if( p.CanSplit() && p.Contiguous() ) { + UnallocateAll( Loc[i], false ); + } else { + UnallocateByIndex( AddInLoc, Loc ); + } + } + } + // Adds the specified placeable to the given location at the specified // stating index. Throws Exceptions with error messages if things went // wrong. @@ -3179,14 +3189,16 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc if (p instanceof Equipment) { ((Equipment) p).ValidateMaxPerLocation(Loc); } + + // TODO: this snapshot thing doesn't work (see its usage below), commented out for now // Let's get a snapshot of the location so we can reset it if we have to. - abPlaceable SnapShot[] = Loc.clone(); + //abPlaceable SnapShot[] = Loc.clone(); // we have to accomodate for Artemis IV systems boolean AddIn = false; boolean ArrayGood = false; int AddInSize = 1; - ArrayList removed = new ArrayList(), rears = new ArrayList(); + ArrayList removed = new ArrayList<>(); // check for generic placement if( SIndex == -1 ) { @@ -3299,17 +3311,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc for( i = SIndex; i < ( p.NumCrits() + SIndex ); i++ ) { // is there a non-location locked item there? if( Loc[i] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( i, Loc ); - } + removed.add( new RemoveEntry( i, i ) ); } // finally, allocate the item slot Loc[i] = p; @@ -3320,17 +3322,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc if( p instanceof RangedWeapon ) { if( ((RangedWeapon) p).IsUsingFCS() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } for( int j = AddInLoc; j < AddInSize + AddInLoc; j++ ) { Loc[j] = (abPlaceable) ((RangedWeapon) p).GetFCS(); @@ -3338,49 +3330,19 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc } if( ((RangedWeapon) p).IsUsingCapacitor() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetCapacitor(); } if( ((RangedWeapon) p).IsUsingInsulator() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetInsulator(); } if( ((RangedWeapon) p).IsUsingPulseModule() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetPulseModule(); } @@ -3390,16 +3352,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc if( p instanceof MGArray ) { for( i = 0; i < ((MGArray) p).GetNumMGs(); i++ ) { if( Loc[MGLocs[i]] != NoItem ) { - // we know it's not location locked, so kick it out - if( Loc[MGLocs[i]].CanSplit() && Loc[MGLocs[i]].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[MGLocs[i]], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( MGLocs[i], Loc ); - } + removed.add( new RemoveEntry( MGLocs[i], i ) ); } Loc[MGLocs[i]] = ((MGArray) p).GetMGs()[i]; } @@ -3417,16 +3370,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc // if there is an item there, put it back in the queue if( Loc[SIndex] != NoItem ) { - // put the item back into the queue - if( Loc[SIndex].CanSplit() && Loc[SIndex].Contiguous() ) { - removed.add( Loc[SIndex] ); - rears.add( new Boolean( Loc[SIndex].IsMountedRear() ) ); - UnallocateAll( Loc[SIndex], false ); - } else { - removed.add( Loc[SIndex] ); - rears.add( new Boolean( Loc[SIndex].IsMountedRear() ) ); - UnallocateByIndex( SIndex, Loc ); - } + removed.add( new RemoveEntry( SIndex, SIndex ) ); } // now allocate the item. @@ -3441,16 +3385,18 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc } // now that allocation is finished, add in the removed items if possible - for( int i = 0; i < removed.size(); i++ ) { + for( RemoveEntry remove : removed ) { // no error handling here since the items are already in the queue try { - Allocate( (abPlaceable) removed.get( i ), -1, Loc ); - ((abPlaceable) removed.get( i )).MountRear( ((Boolean) rears.get( i ))); + Allocate( remove.p, -1, Loc ); + remove.p.MountRear( remove.rear ); + remove.p.MountTurret( remove.turret ); } catch( Exception e1 ) { } } } catch ( ArrayIndexOutOfBoundsException e ) { + // TODO: Following snapshot thing actually does nothing // reset the location - Loc = SnapShot; + //Loc = SnapShot; // tell the user what happened. if( p instanceof RangedWeapon ) { @@ -3682,7 +3628,7 @@ public ifMechLoadout Clone() { clone.SetRulesLevel( RulesLevel ); clone.SetTechBase( TechBase ); clone.SetEra( Era ); - clone.SetYear( Year, false ); + clone.SetYear( Year, YearSpecified ); clone.SetHDCrits( HDCrits.clone() ); clone.SetCTCrits( CTCrits.clone() ); clone.SetLTCrits( LTCrits.clone() ); @@ -4917,13 +4863,9 @@ public boolean CanUseRTTurret() { private void ClearTurretWeapons( MechTurret t ) { for( int i = 0; i < NonCore.size(); i++ ) { - if( NonCore.get( i ) instanceof RangedWeapon ) { - RangedWeapon w = (RangedWeapon) NonCore.get( i ); - if( w.IsTurreted() ) { - if( w.GetTurret() == t ) { - w.RemoveFromTurret( t ); - } - } + abPlaceable p = (abPlaceable) NonCore.get( i ); + if( p.GetTurret() == t ) { + p.MountTurret( null ); } } } diff --git a/sswlib/src/main/java/components/CASE.java b/sswlib/src/main/java/components/CASE.java index 2019597f..3945f6b2 100644 --- a/sswlib/src/main/java/components/CASE.java +++ b/sswlib/src/main/java/components/CASE.java @@ -28,10 +28,9 @@ package components; -public class CASE extends abPlaceable { +public class CASE extends Equipment { // A simple class for Inner Sphere CASE. private AvailableCode AC = new AvailableCode( AvailableCode.TECH_INNER_SPHERE ); - private boolean IsClan = false; public CASE() { AC.SetISCodes( 'E', 'C', 'F', 'D', 'C' ); @@ -72,9 +71,7 @@ public String ChatName() { return "CASE"; } - public String MegaMekName( boolean UseRear ) { - return "ISCASE"; - } + public String MegaMekName( boolean UseRear ) { return (IsClan() ? "CL" : "IS") + "CASE"; } public String BookReference() { return "Tech Manual"; @@ -86,12 +83,12 @@ public int NumCrits() { @Override public int NumCVSpaces() { - if ( IsClan ) return 0; + if ( IsClan() ) return 0; return 1; } public double GetTonnage() { - if ( IsClan ) return 0; + if ( IsClan() ) return 0; return 0.5; } @@ -133,10 +130,16 @@ public AvailableCode GetAvailability() { @Override public String toString() { - return "C.A.S.E."; + return "CASE"; } - - public void SetClan(boolean b ) { - IsClan = b; + + public void SetClan(boolean b ) { super.SetCurrentTech(b ? AvailableCode.TECH_CLAN : AvailableCode.TECH_INNER_SPHERE); } + + public boolean IsClan() { return (super.GetCurrentTech() == AvailableCode.TECH_CLAN); } + + @Override + public String GetEquipmentType() { + return "CASE"; } + } diff --git a/sswlib/src/main/java/components/CVArmor.java b/sswlib/src/main/java/components/CVArmor.java index d837d336..c519046a 100644 --- a/sswlib/src/main/java/components/CVArmor.java +++ b/sswlib/src/main/java/components/CVArmor.java @@ -41,7 +41,8 @@ public class CVArmor extends abPlaceable { // Declares private CombatVehicle Owner; - private int[] ArmorPoints = { 0, 0, 0, 0, 0, 0, 0, 0 }; + private int Placed = 0; + private int[] ArmorPoints = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; private int[] MaxArmor = { 390, 390, 390, 390, 390, 390, 2, 390 }; private ifArmor Industrial = new stArmorIN(), Standard = new stArmorMS(), @@ -1000,7 +1001,7 @@ public ifState[] GetStates() { @Override public double GetCost() { - if( Owner.GetYear() < 2450 ) { + if( Owner.YearWasSpecified() && Owner.GetYear() < 2450 ) { return GetTonnage() * Config.GetCostMult() * 2.0; } else { return GetTonnage() * Config.GetCostMult(); @@ -1029,7 +1030,9 @@ public int GetBAR() { } @Override - public void ResetPlaced() { return; } + public void ResetPlaced() { + Placed = 0; + } @Override public boolean Contiguous() { @@ -1068,6 +1071,17 @@ public MechModifier GetMechModifier() { @Override public String toString() { + if( Config.NumCrits() > 0 ) { + if( Config.NumCrits() > Placed ) { + if( Config.IsStealth() ) { + return Config.CritName(); + } else { + return Config.CritName() + " (" + ( Config.NumCrits() - Placed ) + ")"; + } + } else { + return Config.CritName(); + } + } return Config.CritName(); } diff --git a/sswlib/src/main/java/components/CVJumpJetFactory.java b/sswlib/src/main/java/components/CVJumpJetFactory.java index c7eb5d7a..c7c1181a 100644 --- a/sswlib/src/main/java/components/CVJumpJetFactory.java +++ b/sswlib/src/main/java/components/CVJumpJetFactory.java @@ -94,6 +94,10 @@ public boolean IsUMU() { return CurConfig.IsUMU(); } + public boolean IsProto() { + return CurConfig.IsProto(); + } + public int GetNumJJ() { return NumJJ; } diff --git a/sswlib/src/main/java/components/CVLoadout.java b/sswlib/src/main/java/components/CVLoadout.java index ca39b21b..5052ce5f 100644 --- a/sswlib/src/main/java/components/CVLoadout.java +++ b/sswlib/src/main/java/components/CVLoadout.java @@ -45,6 +45,8 @@ public class CVLoadout implements ifCVLoadout, ifLoadout { private CVJumpJetFactory Jumps; private TargetingComputer CurTC = new TargetingComputer( this, false ); private Supercharger SCharger = new Supercharger( this ); + private VTOLBooster VBooster = new VTOLBooster(this); + private ArmoredMotiveSystem AMotiveS = new ArmoredMotiveSystem(this); private String Name = Constants.BASELOADOUT_NAME, Source = ""; private ArrayList Queue = new ArrayList(), @@ -71,7 +73,9 @@ public class CVLoadout implements ifCVLoadout, ifLoadout { UsingCASE = false, UsingSupercharger = false, YearSpecified = false, - YearRestricted = false; + YearRestricted = false, + UsingVTOLBooster = false, + UsingArmoredMotiveSystem = false; private Turret Turret1 = new Turret(this, false), Turret2 = new Turret(this, false); private SponsonTurret SponsonTurretLeft = new SponsonTurret(this, false), @@ -258,6 +262,10 @@ public void FullUnallocate() { public void ClearLoadout() { FullUnallocate(); + + //Clear out any flags during the clearout as this is used for Tech changes + UsingSupercharger = false; + UsingVTOLBooster = false; Owner.SetChanged( true ); } @@ -311,7 +319,7 @@ public void AddTo(abPlaceable p, int Loc) throws Exception { //Ammo only ever goes in the Body if ( p instanceof Ammunition ) Loc = LocationIndex.CV_LOC_BODY; //Quite a bit of equipment can only go in the body - if ( p instanceof Equipment ) { + if ( p instanceof Equipment && Loc != LocationIndex.CV_LOC_BODY) { if ( !((Equipment)p).CanAllocCVFront() && !((Equipment)p).CanAllocCVSide() && !((Equipment)p).CanAllocCVRear() && !((Equipment)p).CanAllocCVTurret() ) Loc = LocationIndex.CV_LOC_BODY; // Check max items allowed for that location @@ -356,15 +364,9 @@ public void AddTo(abPlaceable p, int Loc) throws Exception { throw new Exception(p.ActualName() + " cannot be allocated to the Side."); break; case LocationIndex.CV_LOC_TURRET1: - if ( p.CanAllocCVTurret() ) { + if ( p.CanAllocCVTurret() ) Turret1Items.add(p); - if ( Owner.IsOmni() ) { - if ( Turret1.GetTonnage() > Turret1.GetMaxTonnage() ) { - Turret1Items.remove(p); - throw new Exception("Turret is out of space"); - } - } - } else + else throw new Exception(p.ActualName() + " cannot be allocated to the Turret."); break; @@ -398,8 +400,7 @@ public void AddTo(abPlaceable p, int Loc) throws Exception { RefreshHeatSinks(); } - private boolean HasHitch(ArrayList items) - { + private boolean HasHitch(ArrayList items) { for( int i = 0; i < items.size(); ++i ) { abPlaceable currentItem = (abPlaceable) items.get( i ); if (currentItem instanceof Hitch) @@ -407,6 +408,7 @@ private boolean HasHitch(ArrayList items) } return false; } + public void RefreshHeatSinks() { if (GetHeatSinks().GetNumHS() != GetTotalHeat()) GetHeatSinks().SetNumHS(GetTotalHeat()); @@ -553,60 +555,42 @@ public ArrayList GetSponsonTurretRightItems() { public abPlaceable[] GetItems(int Loc) { switch(Loc) { - case LocationIndex.CV_LOC_BODY: - return BodyItems.toArray(new abPlaceable[BodyItems.size()]); - case LocationIndex.CV_LOC_FRONT: - return FrontItems.toArray(new abPlaceable[FrontItems.size()]); - case LocationIndex.CV_LOC_LEFT: - return LeftItems.toArray(new abPlaceable[LeftItems.size()]); - case LocationIndex.CV_LOC_REAR: - return RearItems.toArray(new abPlaceable[RearItems.size()]); - case LocationIndex.CV_LOC_RIGHT: - return RearItems.toArray(new abPlaceable[RightItems.size()]); - case LocationIndex.CV_LOC_TURRET1: - return Turret1Items.toArray(new abPlaceable[Turret1Items.size()]); - case LocationIndex.CV_LOC_TURRET2: - return Turret2Items.toArray(new abPlaceable[Turret2Items.size()]); - case LocationIndex.CV_LOC_SPONSON_LEFT: - return SponsonTurretLeftItems.toArray(new abPlaceable[SponsonTurretLeftItems.size()]); - case LocationIndex.CV_LOC_SPONSON_RIGHT: - return SponsonTurretRightItems.toArray(new abPlaceable[SponsonTurretRightItems.size()]); + case LocationIndex.CV_LOC_BODY: return BodyItems.toArray(new abPlaceable[BodyItems.size()]); + case LocationIndex.CV_LOC_FRONT: return FrontItems.toArray(new abPlaceable[FrontItems.size()]); + case LocationIndex.CV_LOC_LEFT: return LeftItems.toArray(new abPlaceable[LeftItems.size()]); + case LocationIndex.CV_LOC_REAR: return RearItems.toArray(new abPlaceable[RearItems.size()]); + case LocationIndex.CV_LOC_RIGHT: return RightItems.toArray(new abPlaceable[RightItems.size()]); + case LocationIndex.CV_LOC_TURRET1: return Turret1Items.toArray(new abPlaceable[Turret1Items.size()]); + case LocationIndex.CV_LOC_TURRET2: return Turret2Items.toArray(new abPlaceable[Turret2Items.size()]); + case LocationIndex.CV_LOC_SPONSON_LEFT: return SponsonTurretLeftItems.toArray(new abPlaceable[SponsonTurretLeftItems.size()]); + case LocationIndex.CV_LOC_SPONSON_RIGHT: return SponsonTurretRightItems.toArray(new abPlaceable[SponsonTurretRightItems.size()]); } return null; } public int Find(abPlaceable p) { - if ( FrontItems.contains(p) ) - return LocationIndex.CV_LOC_FRONT; - if ( LeftItems.contains(p) ) - return LocationIndex.CV_LOC_LEFT; - if ( RightItems.contains(p) ) - return LocationIndex.CV_LOC_RIGHT; - if ( RearItems.contains(p) ) - return LocationIndex.CV_LOC_REAR; - if ( Turret1Items.contains(p) ) - return LocationIndex.CV_LOC_TURRET1; - if ( Turret2Items.contains(p) ) - return LocationIndex.CV_LOC_TURRET2; - if ( SponsonTurretLeftItems.contains(p) ) - return LocationIndex.CV_LOC_SPONSON_LEFT; - if ( SponsonTurretRightItems.contains(p) ) - return LocationIndex.CV_LOC_SPONSON_RIGHT; - if ( BodyItems.contains(p) ) - return LocationIndex.CV_LOC_BODY; + if ( FrontItems.contains(p) ) return LocationIndex.CV_LOC_FRONT; + if ( LeftItems.contains(p) ) return LocationIndex.CV_LOC_LEFT; + if ( RightItems.contains(p) ) return LocationIndex.CV_LOC_RIGHT; + if ( BodyItems.contains(p) ) return LocationIndex.CV_LOC_BODY; + if ( RearItems.contains(p) ) return LocationIndex.CV_LOC_REAR; + if ( Turret1Items.contains(p) ) return LocationIndex.CV_LOC_TURRET1; + if ( Turret2Items.contains(p) ) return LocationIndex.CV_LOC_TURRET2; + if ( SponsonTurretLeftItems.contains(p) ) return LocationIndex.CV_LOC_SPONSON_LEFT; + if ( SponsonTurretRightItems.contains(p) ) return LocationIndex.CV_LOC_SPONSON_RIGHT; return 11; } public LocationIndex FindIndex(abPlaceable p) { - if ( FrontItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_FRONT, p.NumCVSpaces()); - if ( LeftItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_LEFT, p.NumCVSpaces()); - if ( RightItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_RIGHT, p.NumCVSpaces()); - if ( BodyItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_BODY, p.NumCVSpaces()); - if ( Turret1Items.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_TURRET1, p.NumCVSpaces()); - if ( RearItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_REAR, p.NumCVSpaces()); - if ( Turret2Items.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_TURRET2, p.NumCVSpaces()); - if ( SponsonTurretLeftItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_SPONSON_LEFT, p.NumCVSpaces()); - if ( SponsonTurretRightItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_SPONSON_RIGHT, p.NumCVSpaces()); + if ( FrontItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_FRONT, p.NumCVSpaces()); + if ( LeftItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_LEFT, p.NumCVSpaces()); + if ( RightItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_RIGHT, p.NumCVSpaces()); + if ( BodyItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_BODY, p.NumCVSpaces()); + if ( Turret1Items.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_TURRET1, p.NumCVSpaces()); + if ( RearItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_REAR, p.NumCVSpaces()); + if ( Turret2Items.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_TURRET2, p.NumCVSpaces()); + if ( SponsonTurretLeftItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_SPONSON_LEFT, p.NumCVSpaces()); + if ( SponsonTurretRightItems.contains(p)) return new LocationIndex(0, LocationIndex.CV_LOC_SPONSON_RIGHT, p.NumCVSpaces()); return null; } @@ -623,19 +607,19 @@ public int[] FindModularArmor() { } public void FlushIllegal() { - // since most everything else is taken care of during mech recalculates, + // since most everything else is taken care of during recalculates, // this method is provided for non-core equipment AvailableCode AC; abPlaceable p; int Rules = Owner.GetRulesLevel(); //Owner.CheckArmoredComponents(); - + NonCore = GetNonCore(); // see if there's anything to flush out - if( GetNonCore().size() <= 0 ) { return; } + if( NonCore.isEmpty() ) { return; } - for( int i = GetNonCore().size() - 1; i >= 0; i-- ) { - p = (abPlaceable) GetNonCore().get( i ); + for( int i = NonCore.size() - 1; i >= 0; i-- ) { + p = (abPlaceable) NonCore.get( i ); AC = p.GetAvailability(); try { CheckExclusions( p ); @@ -645,7 +629,7 @@ public void FlushIllegal() { } catch( Exception e ) { Remove( p ); } - if( GetNonCore().contains( p ) ) { + if( NonCore.contains( p ) ) { if( Rules < AvailableCode.RULES_EXPERIMENTAL ) { p.ArmorComponent( false ); } @@ -667,46 +651,32 @@ public boolean UnallocateAll(abPlaceable p, boolean override) { SponsonTurretRightItems.remove(p); NonCore.remove(p); TCList.remove(p); + // if the item is an MG Array, check for it's MGs and unallocate + if( p instanceof MGArray ) { + for( int i = 0; i < ((MGArray) p).GetMGs().length; i++ ) { + UnallocateAll( ((MGArray) p).GetMGs()[i], true ); + } + } Owner.SetChanged( true ); return true; } public void Remove(abPlaceable p) { - // removes the item completely from the loadout. - // first, unallocate it. UnallocateAll( p, true ); - // Now remove it from the queue - //RemoveFromQueue( p ); - - // check to see if this is a core component - //if( ! p.CoreComponent() ) { - // remove it to the non core list - if( NonCore.contains( p ) ) - NonCore.remove( p ); - if( Equipment.contains( p ) ) - Equipment.remove( p ); - if( TCList.contains( p ) ) - TCList.remove( p ); - if ( FrontItems.contains( p ) ) - FrontItems.remove( p ); - if ( LeftItems.contains(p)) - LeftItems.remove(p); - if ( RightItems.contains(p)) - RightItems.remove(p); - if ( BodyItems.contains(p)) - BodyItems.remove(p); - if ( RearItems.contains(p)) - RearItems.remove(p); - if ( Turret1Items.contains(p)) - Turret1Items.remove(p); - if ( Turret2Items.contains(p)) - Turret2Items.remove(p); - if ( SponsonTurretLeftItems.contains(p)) - SponsonTurretLeftItems.remove(p); - if ( SponsonTurretRightItems.contains(p)) - SponsonTurretRightItems.remove(p); - //} + // remove it to the non core list + if( NonCore.contains( p ) ) NonCore.remove( p ); + if( Equipment.contains( p ) ) Equipment.remove( p ); + if( TCList.contains( p ) ) TCList.remove( p ); + if ( FrontItems.contains( p ) ) FrontItems.remove( p ); + if ( LeftItems.contains(p)) LeftItems.remove(p); + if ( RightItems.contains(p)) RightItems.remove(p); + if ( BodyItems.contains(p)) BodyItems.remove(p); + if ( RearItems.contains(p)) RearItems.remove(p); + if ( Turret1Items.contains(p)) Turret1Items.remove(p); + if ( Turret2Items.contains(p)) Turret2Items.remove(p); + if ( SponsonTurretLeftItems.contains(p)) SponsonTurretLeftItems.remove(p); + if ( SponsonTurretRightItems.contains(p)) SponsonTurretRightItems.remove(p); GetHeatSinks().SetNumHS(GetTotalHeat()); Owner.SetChanged( true ); @@ -725,7 +695,19 @@ public void AutoAllocate(EquipmentCollection e) { } public boolean IsAllocated(abPlaceable p) { - throw new UnsupportedOperationException("Not supported yet."); + // checks to see if the specified item is allocated in the loadout + + if( FrontItems.contains(p)) { return true; } + if( LeftItems.contains(p) ) { return true; } + if( RightItems.contains(p) ) { return true; } + if( BodyItems.contains(p) ) { return true; } + if( RearItems.contains(p) ) { return true; } + if( Turret1Items.contains(p) ) { return true; } + if( Turret2Items.contains(p) ) { return true; } + if( SponsonTurretLeftItems.contains(p) ) { return true; } + if( SponsonTurretRightItems.contains(p) ) { return true; } + if( RotorItems.contains(p) ) { return true; } + return false; } public int UnplacedItems() { @@ -780,8 +762,7 @@ public ifCVLoadout Clone() { clone.SetRulesLevel( RulesLevel ); clone.SetTechBase( TechBase ); clone.SetEra( Era ); - clone.SetYear( Year, false ); - clone.SetClanCASE( UsingClanCASE ); + clone.SetYear( Year, YearSpecified ); try { clone.SetFCSArtemisIV( UseAIVFCS ); clone.SetFCSArtemisV( UseAVFCS ); @@ -796,26 +777,36 @@ public ifCVLoadout Clone() { clone.SetRightItems( (ArrayList)RightItems.clone() ); clone.SetBodyItems( (ArrayList)BodyItems.clone() ); clone.SetRearItems( (ArrayList)RearItems.clone() ); - clone.SetTurret1( (ArrayList)Turret1Items.clone() ); - clone.SetTurret2( (ArrayList)Turret2Items.clone() ); + clone.SetTurret1Items( (ArrayList)Turret1Items.clone() ); + clone.SetTurret2Items( (ArrayList)Turret2Items.clone() ); clone.SetSponsonTurretLeftItems((ArrayList) SponsonTurretLeftItems.clone()); clone.SetSponsonTurretRightItems((ArrayList) SponsonTurretRightItems.clone()); - + if( TCList.size() > 0 ) { clone.SetTCList( (ArrayList) TCList.clone() ); } if( Equipment.size() > 0 ) { clone.SetEquipment( (ArrayList) Equipment.clone() ); } + if (HasCase()) { + clone.SetCase( Case ); + } if( HasSupercharger() ) { clone.SetSupercharger( SCharger ); } + if (HasVTOLBooster()) { + clone.SetVTOLBooster( VBooster ); + } + if (HasArmoredMotiveSystem()) { + clone.SetArmoredMotiveSystem(true, IsArmoredMotiveSystemClan()); + } if( Owner.IsOmni() ) { clone.SetBaseLoadout( this ); } clone.SetTurret(Turret1); clone.SetRearTurret(Turret2); clone.SetSponsonTurretLeft(SponsonTurretLeft); + clone.SetSponsonTurretRight(SponsonTurretRight); return clone; } @@ -849,11 +840,11 @@ public void SetBodyItems(ArrayList c) { BodyItems = c; } - public void SetTurret1(ArrayList c) { + public void SetTurret1Items(ArrayList c) { Turret1Items = c; } - public void SetTurret2(ArrayList c) { + public void SetTurret2Items(ArrayList c) { Turret2Items = c; } @@ -878,40 +869,42 @@ public boolean CanUseClanCASE() { } public boolean IsUsingClanCASE() { - return UsingClanCASE; + return Case.IsClan(); } - public void SetClanCASE(boolean b) { - UsingClanCASE = b; - Case.SetClan(b); - Owner.SetChanged( true ); - } + public void AddCase(boolean isClan) { + Case.SetClan(isClan); - public void RemoveISCase() { - UsingCASE = false; - Remove(Case); - } - - public void SetISCASE() { - UsingCASE = true; - Remove(Case); + if (HasCase()) { return; } try { AddTo(Case, LocationIndex.CV_LOC_BODY); + Owner.SetChanged( true ); } catch (Exception ex) { System.err.println(ex.getMessage()); } } - public boolean HasISCASE() { - if ( UsingCASE ) return true; - if ( Owner.IsOmni() && this != Owner.GetBaseLoadout() ) return Owner.GetBaseLoadout().HasISCASE(); - return false; + public void RemoveCase() { + Case.SetClan(false); + Remove(Case); + Owner.SetChanged( true ); } - public CASE GetISCase() { - return Case; + public boolean HasCase() { + return IsAllocated(Case); } + public void SetCase( CASE c ) { + Case = c; + } + public void SetClanCASE(boolean b) { + Case.SetClan(b); + Owner.SetChanged( true ); + } + + public CASE GetCase() { + return Case; + } // handlers for Artemis IV operations. public void SetFCSArtemisIV( boolean b ) throws Exception { @@ -1025,23 +1018,90 @@ public void CheckTC() { } public void SetSupercharger(boolean b) throws Exception { - UsingSupercharger = b; + if( b == false ) { + Remove( SCharger ); + RemoveMechMod(SCharger.GetMechModifier()); + return; + } + + try { + AddTo(SCharger, LocationIndex.CV_LOC_BODY); + } catch (Exception ex) { + System.err.println(ex.getMessage()); + } + AddMechModifier(SCharger.GetMechModifier()); Owner.SetChanged( true ); } public void SetSupercharger(Supercharger s) { + // this sets the loadout's supercharger to a different one. + // Used for cloning purposes only! SCharger = s; + AddMechModifier(SCharger.GetMechModifier()); Owner.SetChanged( true ); } public boolean HasSupercharger() { - return UsingSupercharger; + return IsAllocated( SCharger ); } public Supercharger GetSupercharger() { return SCharger; } + public void SetVTOLBooster(boolean b) throws Exception { + if (!b) { + Remove(VBooster); + RemoveMechMod(VBooster.GetMechModifier()); + return; + } + + try { + AddToBody(VBooster); + AddMechModifier(VBooster.GetMechModifier()); + } catch (Exception ex) { + System.err.println(ex.getMessage()); + } + Owner.setChanged(true); + } + + public void SetVTOLBooster(VTOLBooster s) { + // this sets the loadout's booster to a different one. + // Used for cloning purposes only! + VBooster = s; + AddMechModifier(VBooster.GetMechModifier()); + Owner.SetChanged( true ); + } + + public boolean HasVTOLBooster() { return IsAllocated(VBooster); } + + public VTOLBooster GetVTOLBooster() { + return VBooster; + } + + public boolean HasArmoredMotiveSystem() { return IsAllocated( AMotiveS ); } + + public boolean IsArmoredMotiveSystemClan() { return AMotiveS.IsClan(); } + + public void SetArmoredMotiveSystem(boolean b, boolean isClan) { + if (!b) { + Remove(AMotiveS); + return; + } + + try { + AMotiveS.SetClan(isClan); + AddToBody(AMotiveS); + } catch (Exception ex) { + System.err.println(ex.getMessage()); + } + Owner.setChanged(true); + } + + public ArmoredMotiveSystem GetArmoredMotiveSystem() { + return AMotiveS; + } + public CVPowerAmplifier GetPowerAmplifier() { return PowerAmplifier; } diff --git a/sswlib/src/main/java/components/CombatVehicle.java b/sswlib/src/main/java/components/CombatVehicle.java index 9ed88257..689523a9 100644 --- a/sswlib/src/main/java/components/CombatVehicle.java +++ b/sswlib/src/main/java/components/CombatVehicle.java @@ -64,8 +64,7 @@ public class CombatVehicle implements ifUnit, ifBattleforce { private int HeatSinks = 0, Tonnage = 20, CruiseMP = 1, - Crew = 0, - Year; + Crew = 0; private double JJMult, LiftEquipment = 0, Controls = 0; @@ -74,6 +73,7 @@ public class CombatVehicle implements ifUnit, ifBattleforce { Changed = false, Primitive = false, HasBlueShield = false, + HasCase = false, HasTurret1 = false, HasTurret2 = false, HasSponsonTurret = false, @@ -104,6 +104,7 @@ public class CombatVehicle implements ifUnit, ifBattleforce { private CVArmor CurArmor = new CVArmor( this ); private Hashtable Lookup = new Hashtable(); private ArrayList MechMods = new ArrayList(); + private ArrayList Quirks = new ArrayList(); private static AvailableCode OmniAvailable = new AvailableCode( AvailableCode.TECH_BOTH ), DualTurretAC = new AvailableCode( AvailableCode.TECH_BOTH ), ChinTurretAC = new AvailableCode( AvailableCode.TECH_BOTH ), @@ -116,7 +117,19 @@ public class CombatVehicle implements ifUnit, ifBattleforce { 1.3, 1.3, 1.3, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6 }; + // Constructors public CombatVehicle() { + // no prefs file, create a default. + Prefs = Preferences.userRoot().node( Constants.SAWPrefs ); + Load(); + } + + public CombatVehicle( Preferences p ) { + Prefs = p; + Load(); + } + + private void Load() { OmniAvailable.SetCodes( 'E', 'X', 'E', 'E', 'D', 'E', 'X', 'E', 'E', 'D' ); OmniAvailable.SetFactions( "", "", "", "", "", "", "", "" ); OmniAvailable.SetISDates( 0, 0, false, 3010, 0, 0, false, false ); @@ -173,6 +186,9 @@ public CombatVehicle() { CurLoadout = new CVLoadout(this); CurLoadout.GetHeatSinks().SetSingle(); MainLoadout = CurLoadout; + CurLoadout.SetBaseLoadout( MainLoadout ); + + Quirks = new ArrayList(); BuildLookupTable(); setTonnage(10); @@ -329,7 +345,7 @@ public boolean CanUseTurret() { } public boolean CanUseDualTurret() { - if( CommonTools.IsAllowed( DualTurretAC,this) ) { return true; } + if( !IsVTOL() && CommonTools.IsAllowed( DualTurretAC,this) ) { return true; } return false; } @@ -424,7 +440,7 @@ public double GetCurrentTons() { result += GetFullAmphibiousTonnage(); result += GetEnvironmentalSealingTonnage(); //if( HasBlueShield ) { result += BlueShield.GetTonnage(); } - if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } + //if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } ArrayList v = CurLoadout.GetNonCore(); if( v.size() > 0 ) { @@ -449,7 +465,7 @@ public double GetCurrentDryTons() { if( CurLoadout.UsingTC() ) { result += GetTC().GetTonnage(); } if( ! CurEngine.IsNuclear() ) { result += CurLoadout.GetPowerAmplifier().GetTonnage(); } if( HasBlueShield ) { result += BlueShield.GetTonnage(); } - if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } + //if( CurLoadout.HasSupercharger() ) { result += CurLoadout.GetSupercharger().GetTonnage(); } if( UsingEnvironmentalSealing ) { result += EnviroSealing.GetTonnage(); } ArrayList v = CurLoadout.GetNonCore(); @@ -1018,6 +1034,8 @@ public void SetEra( int e ) { } public void SetYear( int y, boolean specified ) { + // override specified as false if year is 0 + if( y == 0) specified = false; if( Omni ) { CurLoadout.SetYear( y, specified ); } else { @@ -1053,6 +1071,15 @@ public void setModel(String Model) { this.Model = Model; } + public ArrayList GetQuirks() { + return Quirks; + } + + public void SetQuirks (ArrayList q) { + Quirks = q; + + SetChanged( true ); + } public String getOverview() { return Overview; } @@ -1246,6 +1273,13 @@ public int getCruiseMP() { return CruiseMP; } + public int GetAdjustedCruiseMP( boolean BV, boolean MASCTSM ) { + MechModifier m = GetTotalModifiers( BV, MASCTSM ); + int retval = CruiseMP; + retval += GetTotalModifiers( BV, MASCTSM ).WalkingAdder(); + if( retval < 0 ) { return 0; } + return retval; + } public int getMaxCruiseMP() { if( CurEngine.IsPrimitive() ) { return (int) Math.floor( ( ( 400.0 + (double)CurConfig.GetSuspensionFactor(Tonnage) ) / (double)Tonnage ) / 1.2 ); @@ -1381,7 +1415,7 @@ public void setHasTurret1(boolean HasTurret1) { this.HasTurret1 = HasTurret1; //Move any weapons/equipment that was in the turret to another location if (!HasTurret1) { - GetLoadout().SetTurret1(new ArrayList()); + GetLoadout().SetTurret1Items(new ArrayList()); GetLoadout().RefreshHeatSinks(); CurArmor.SetArmor(LocationIndex.CV_LOC_TURRET1, 0); } @@ -1395,7 +1429,7 @@ public void setHasTurret2(boolean HasTurret2) { this.HasTurret2 = HasTurret2; //Move any weapons/equipment that was in the turret to another location if (!HasTurret2) { - GetLoadout().SetTurret2(new ArrayList()); + GetLoadout().SetTurret2Items(new ArrayList()); GetLoadout().RefreshHeatSinks(); CurArmor.SetArmor(LocationIndex.CV_LOC_TURRET2, 0); } @@ -1530,15 +1564,11 @@ public void setLookup(Hashtable Lookup) { } public int getYear() { - return Year; + return GetYear(); } - public void setYear(int y, boolean specified) { - if( Omni ) { - CurLoadout.SetYear( y, specified ); - } else { - MainLoadout.SetYear( y, specified ); - } + public void setYear(int y, boolean specified) { + SetYear( y, specified ); } public void SetYearRestricted( boolean y ) { @@ -1564,7 +1594,30 @@ public int getFlankMP() { public int getFlankMP( int MiniMult ) { return (int) Math.floor( ( getCruiseMP() * MiniMult ) * 1.5 + 0.5 ); } - + + public int GetAdjustedFlankMP( boolean BV, boolean MASCTSM ) { + // this had to become more complicated because of the peculiar + // idiosyncracies of the BV system. Stupid. + MechModifier m = GetTotalModifiers( BV, MASCTSM ); + int WalkValue = getCruiseMP(); + double Multiplier = 1.5 + m.RunningMultiplier(); + int retval = (int) Math.floor( WalkValue * Multiplier + 0.5 ) + m.RunningAdder(); + if( retval < 0 ) { return 0; } + return retval; + } + + public int GetAdjustedFlankMP( boolean BV, boolean MASCTSM, int MiniMult ) { + // this had to become more complicated because of the peculiar + // idiosyncracies of the BV system. Stupid. + // this method provided for miniatures-scale printing + MechModifier m = GetTotalModifiers( BV, MASCTSM ); + int WalkValue = GetAdjustedCruiseMP( BV, MASCTSM ) * MiniMult; + double Multiplier = 1.5 + m.RunningMultiplier(); + int retval = (int) Math.floor( WalkValue * Multiplier + 0.5 ) + m.RunningAdder(); + if( retval < 0 ) { return 0; } + return retval; + } + public void SetRulesLevel( int r ) { if( Omni ) { CurLoadout.SetRulesLevel( r ); @@ -1706,17 +1759,18 @@ public String GetFullName() { public String GetChatInfo() { String info = GetFullName() + " "; - info += GetTonnage() + "t, "; + info += GetTonnage() + "t "; + info += GetMotiveLookupName() + ", "; // MP info += getCruiseMP(); - //if( getCruiseMP() != GetAdjustedWalkingMP( false, true ) ) { - // info += "[" + GetAdjustedWalkingMP( false, true ) + "]"; - //} + if( getCruiseMP() != GetAdjustedCruiseMP( false, true ) ) { + info += "[" + GetAdjustedCruiseMP( false, true ) + "]"; + } info += "/"; info += getFlankMP(); - //if( getFlankMP() != GetAdjustedRunningMP( false, true ) ) { - // info += "[" + GetAdjustedRunningMP( false, true ) + "]"; - //} + if( getFlankMP() != GetAdjustedFlankMP( false, true ) ) { + info += "[" + GetAdjustedFlankMP( false, true ) + "]"; + } if ( CurLoadout.GetJumpJets().GetNumJJ() > 0 ) { info += "/" + CurLoadout.GetJumpJets().GetNumJJ(); //if( CurLoadout.GetJumpJets().GetNumJJ() != this.GetAdjustedJumpingMP( false ) ) { @@ -1871,13 +1925,10 @@ public boolean ValidateECM() { } public boolean HasECM() { - // ensures that, if the 'Mech needs ECM, it has it. - SimplePlaceable p = new SimplePlaceable( "ECMTest", "ECMTest", "ECMTest", "ECMTest", "none", 0, false, null ); - p.SetExclusions(new String[] { "ECM", "Watchdog" }); - try { - CurLoadout.CheckExclusions( p ); - } catch( Exception e ) { - return true; + for (abPlaceable item : (ArrayList)CurLoadout.GetEquipment()) { + if (item.LookupName().contains("ECM") || item.LookupName().contains("Watchdog") || item.LookupName().contains("CEWS")) { + return true; + } } return false; } @@ -1960,6 +2011,7 @@ public double GetChassisModifier() { if ( UsingFullAmphibious ) retval += 0.2; if ( UsingDuneBuggy ) retval += 0.1; if ( UsingEnvironmentalSealing ) retval += 0.1; + if ( GetLoadout().HasArmoredMotiveSystem() ) retval += 0.1; return retval; } @@ -1988,6 +2040,7 @@ public String GetChassisModifierString() { if ( UsingFullAmphibious ) b.append(", Full Amphibious"); if ( UsingDuneBuggy ) b.append(", Dune Buggy"); if ( UsingEnvironmentalSealing && !(CurConfig instanceof stCVSubmarine) ) b.append(", Environmental Sealing"); + if ( GetLoadout().HasArmoredMotiveSystem() ) b.append(", Armored Motive System"); if ( b.length() > 0 ) return "(" + b.toString().substring(2) + ")"; return ""; } @@ -2131,7 +2184,7 @@ public double GetDefensiveFactor() { // target number for speed. // subtract one since we're indexing an array - int RunMP = getFlankMP() - 1; + int RunMP = GetAdjustedFlankMP(true, false) - 1; int JumpMP = 0; // this is a safeguard for using MASC on an incredibly speedy chassis @@ -2319,7 +2372,7 @@ public double GetTonnageBV() { public double GetOffensiveFactor() { double result = 0.0; - result += (double) (getFlankMP() - 5.0f); + result += (double) (GetAdjustedFlankMP(true, true) - 5.0f); result = result * 0.1 + 1.0; result = (double) Math.pow( result, 1.2 ) ; @@ -2538,6 +2591,9 @@ public double GetAmmoCosts() { retval += ( (abPlaceable) v.get( i ) ).GetCost(); } } + if( Prefs.getBoolean( "CostAmmoMult", false ) ) { + retval *= GetCostMult() * GetConfigMultiplier(); + } return retval; } else { return retval; @@ -2699,6 +2755,14 @@ public int GetMegaMekLevel() { return 5; } } + + public void SetCase(boolean b) { + HasCase = b; + } + + public boolean HasCase() { + return HasCase; + } public void SetTrailer(boolean b ) { IsTrailer = b; diff --git a/sswlib/src/main/java/components/Equipment.java b/sswlib/src/main/java/components/Equipment.java index a8bdacad..4e817cda 100644 --- a/sswlib/src/main/java/components/Equipment.java +++ b/sswlib/src/main/java/components/Equipment.java @@ -29,10 +29,9 @@ package components; import com.google.gson.annotations.SerializedName; - import java.util.ArrayList; -public class Equipment extends abPlaceable { +public class Equipment extends abPlaceable implements ifEquipment { private String ActualName, CritName, Type, @@ -51,7 +50,8 @@ public class Equipment extends abPlaceable { LngRange = 0, Heat = 0, MaxAllowed = 0, - MaxAllowedPerLocation = 0; + MaxAllowedPerLocation = 0, + CurrentTechBase = AvailableCode.TECH_INNER_SPHERE; private double Tonnage = 0.0, Cost = 0.0, OffBV = 0.0, @@ -81,6 +81,7 @@ public class Equipment extends abPlaceable { RequiresNuclear = false, RequiresPowerAmps = false; private transient boolean Rear = false; + private transient ifTurret Turret = null; @SerializedName("Availability") private AvailableCode AC; public Equipment() { @@ -104,6 +105,8 @@ public Equipment( Equipment e ) { LookupName = e.LookupName; Type = e.Type; AC = e.AC.Clone(); + CurrentTechBase = AC.GetTechBase(); + if (CurrentTechBase == AvailableCode.TECH_BOTH) { CurrentTechBase = AvailableCode.TECH_INNER_SPHERE; } MegaMekName = e.MegaMekName; Crits = e.Crits; CVSpace = e.CVSpace; @@ -227,6 +230,7 @@ public void SetBookReference( String b ) { BookReference = b; } + //NOTE: Do NOT use a Rear reference here as this field is used on the Validate method public String ActualName() { return ActualName; } @@ -236,11 +240,7 @@ public String CritName() { if( VariableSize ) { retval += " (" + Tonnage + " tons)"; } - if( Rear ) { - return "(R) " + retval; - } else { - return retval; - } + return NameModifier() + retval; } @Override @@ -253,11 +253,7 @@ public String PrintName() { } public String LookupName() { - if( Rear ) { - return "(R) " + LookupName; - } else { - return LookupName; - } + return NameModifier() + LookupName; } public String ChatName() { @@ -265,11 +261,7 @@ public String ChatName() { } public String MegaMekName( boolean UseRear ) { - if( Rear ) { - return MegaMekName + " (R)"; - } else { - return MegaMekName; - } + return (MegaMekName + " " + NameModifier()).trim(); } public String BookReference() { @@ -414,12 +406,12 @@ public boolean CanAllocCVFront() { @Override public boolean CanAllocCVRear() { - return alloc_sides; + return alloc_rear; } @Override public boolean CanAllocCVSide() { - return alloc_rear; + return alloc_sides; } @Override @@ -427,6 +419,9 @@ public boolean CanAllocCVTurret() { return alloc_turret; } + @Override + public boolean CanAllocCVBody() { return alloc_body; } + public int GetTechBase() { return AC.GetTechBase(); } @@ -438,7 +433,7 @@ public boolean CanAllocLegs() { @Override public boolean CanMountRear() { - return CanMountRear; + return CanMountRear && ! IsTurreted(); } @Override @@ -451,6 +446,28 @@ public boolean IsMountedRear() { return Rear; } + @Override + public boolean CanMountTurret() { + return CanAllocCVTurret() && ! IsMountedRear(); + } + + @Override + public void MountTurret( ifTurret t ) { + if( Turret == t ) return; + if( Turret != null ) { + Turret.RemoveItem( this ); + } + if( t != null ) { + t.AddItem( this ); + } + Turret = t; + } + + @Override + public ifTurret GetTurret() { + return Turret; + } + @Override public String GetManufacturer() { return Manufacturer; @@ -481,6 +498,7 @@ public boolean RequiresPowerAmps() { return RequiresPowerAmps; } + @Override public int MaxAllowed() { return MaxAllowed; } @@ -530,10 +548,10 @@ public void Validate( Mech m ) throws Exception { ArrayList currentEquipment = m.GetLoadout().GetEquipment(); for (int i = 0, c = 0; i < currentEquipment.size(); ++i) { abPlaceable currentItem = (abPlaceable) currentEquipment.get(i); - if (currentItem.LookupName().equals(LookupName)) { + if (currentItem.ActualName().equals(ActualName)) { ++c; if (c == MaxAllowed) { - throw new Exception("Only " + MaxAllowed + " " + CritName + "(s) may be mounted on one 'Mech."); + throw new Exception("Only " + MaxAllowed + " " + CritName + "(s) may be mounted."); } } } @@ -543,24 +561,19 @@ public void Validate( Mech m ) throws Exception { } } - public boolean Validate( CombatVehicle v ) - { + @Override + public void Validate( CombatVehicle v ) throws Exception { if( MaxAllowed > 0 ) { ArrayList currentEquipment = v.GetLoadout().GetEquipment(); for( int i = 0, c = 0; i < currentEquipment.size(); ++i ) { abPlaceable currentItem = (abPlaceable) currentEquipment.get( i ); - if( currentItem.LookupName().equals( LookupName ) ) { + if( currentItem.ActualName().equals( ActualName ) ) { ++c; if( c == MaxAllowed ) { - return false; + throw new Exception("Only " + MaxAllowed + " " + CritName + "(s) may be mounted."); } } } - return true; - } else if( RequiresQuad ) { - return false; - } else { - return true; } } @@ -590,6 +603,17 @@ public AvailableCode GetAvailability() { return retval; } + @Override + public String GetEquipmentType() { + return "equipment"; + } + + @Override + public void SetCurrentTech(int techbase) { CurrentTechBase = techbase; } + + @Override + public int GetCurrentTech() { return CurrentTechBase; } + @Override public String toString() { return CritName(); diff --git a/sswlib/src/main/java/components/Gyro.java b/sswlib/src/main/java/components/Gyro.java index cb6d7fdb..2a9a4013 100644 --- a/sswlib/src/main/java/components/Gyro.java +++ b/sswlib/src/main/java/components/Gyro.java @@ -177,6 +177,15 @@ public double GetCurOffensiveBV( boolean UseRear, boolean UseTC, boolean UseAES, } public double GetDefensiveBV() { + //IntOps p.187 "Gyroless ’Mechs: If a ’Mech with a Machina Domini Interface Cockpit is not equipped with a gyro, + //treat the unit as if it is equipped with a standard gyro when finding its Defensive Battle Rating." + if( CurConfig instanceof stGyroNone) { + if(((Mech)Owner).GetCockpit().GetCurrentState() instanceof stCockpitInterface) { + Gyro temp = new Gyro((Mech)Owner); + temp.SetStandard(); + return temp.GetDefensiveBV(); + } + } if( IsArmored() ) { double result = Owner.GetTonnage() * CurConfig.GetBVMult(); result += result * NumCrits() * 0.05; diff --git a/sswlib/src/main/java/components/LiftHoist.java b/sswlib/src/main/java/components/LiftHoist.java new file mode 100644 index 00000000..3f885b0c --- /dev/null +++ b/sswlib/src/main/java/components/LiftHoist.java @@ -0,0 +1,199 @@ +/* +Copyright (c) 2008~2009, Justin R. Bengtson (poopshotgun@yahoo.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Justin R. Bengtson nor the names of contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package components; + +/** + * + * @author gblouin + */ +public class LiftHoist extends Equipment implements ifEquipment { + private final ifUnit Owner; + private final static AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); + public LiftHoist(ifUnit l) + { + AC.SetISCodes( 'A', 'A', 'A', 'A', 'A' ); + AC.SetISDates( 0, 0, false, 1950, 0, 0, false, false ); + AC.SetISFactions( "", "", "", "" ); + AC.SetCLCodes( 'A', 'X', 'A', 'A', 'A' ); + AC.SetCLDates( 0, 0, false, 1950, 0, 0, false, false ); + AC.SetCLFactions( "", "", "", "" ); + AC.SetPBMAllowed( true ); + AC.SetPIMAllowed( true ); + AC.SetPrimitiveOnly(false); + AC.SetSuperHeavyCompatible(true); + AC.SetSuperHeavyOnly(false); + AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + Owner = l; + + SetMountableRear(true); + } + + public String ActualName() { + return "Lift Hoist"; + } + + public String CritName() { + return NameModifier() + "Lift Hoist"; + } + + @Override + public boolean IsVariableSize() { + return false; + } + + @Override + public boolean HasAmmo() { + return false; + } + + @Override + public int GetAmmoIndex() { + return 0; + } + + public String LookupName() { + return CritName(); + } + + public String ChatName() { + return "LftHst"; + } + + public String MegaMekName( boolean UseRear ) { + return CritName(); + } + + public String BookReference() { + return "Tech Manual"; + } + + @Override + public int NumCrits() { + return 3; + } + + public int NumCVSpaces() { + return 1; + } + + @Override + public double GetTonnage() { + return 3.0; + } + + @Override + public double GetCost() { + return 5000; + } + + public double GetOffensiveBV() { + return 0.0; + } + + @Override + public double GetCurOffensiveBV(boolean UseRear, boolean UseTC, boolean UseAES) { + return 0; + } + + @Override + public double GetCurOffensiveBV(boolean UseRear, boolean UseTC, boolean UseAES, boolean UseRobotic) { + return 0.0; + } + + public double GetDefensiveBV() { + return 0.0; + } + + @Override + public AvailableCode GetAvailability() { + return AC.Clone(); + } + + @Override + public boolean CoreComponent() { + return false; + } + + @Override + public String toString() { + return CritName(); + } + + @Override + public int MaxAllowed() { + if (Owner instanceof CombatVehicle) { + return 4; + } + return 2; + } + + @Override + public void Validate(Mech m) throws Exception { + if (MaxAllowed() == 0) { + return; + } + + int count = 0; + for (Object item : m.GetLoadout().GetEquipment()) { + abPlaceable currentItem = (abPlaceable) item; + if (currentItem.LookupName().equals(LookupName())) { + ++count; + if (count == MaxAllowed()) { + throw new Exception("Only " + MaxAllowed() + " " + CritName() + "(s) may be mounted on one 'Mech."); + } + } + } + } + + @Override + public void Validate(CombatVehicle v) throws Exception { + if (MaxAllowed() == 0) { + return; + } + + int count = 0; + for(Object item : v.GetLoadout().GetEquipment()) { + abPlaceable currentItem = (abPlaceable) item; + if( currentItem.ActualName().equals( ActualName() ) ) { + ++count; + if( count == MaxAllowed() ) { + throw new Exception("Only " + MaxAllowed() + " " + CritName() + "(s) may be mounted."); + } + } + } + } + + @Override + public boolean CanAllocCVBody() { + if (Owner instanceof CombatVehicle){ + return ((CombatVehicle) Owner).IsVTOL(); + } + return false; + } +} diff --git a/sswlib/src/main/java/components/MGArray.java b/sswlib/src/main/java/components/MGArray.java index 94c0d397..5bab02ea 100644 --- a/sswlib/src/main/java/components/MGArray.java +++ b/sswlib/src/main/java/components/MGArray.java @@ -89,35 +89,17 @@ public String ActualName() { // the lookup name is used when we are trying to find the piece of equipment. public String LookupName() { String retval = GetName(); - if( Rear ) { - if( Clan ) { - retval = "(R) (CL) " + retval; - } else { - retval = "(R) (IS) " + retval; - } + if( Clan ) { + retval = "(CL) " + retval; } else { - if( Clan ) { - retval = "(CL) " + retval; - } else { - retval = "(IS) " + retval; - } - } - if( IsTurreted() ) { - retval = "(T) " + retval; + retval = "(IS) " + retval; } - return retval; + return NameModifier() + retval; } // the crit name is how the item appears in the loadout when allocated. public String CritName() { - String retval = GetShortName(); - if( Rear ) { - retval = "(R) " + retval; - } - if( IsTurreted() ) { - retval = "(T) " + retval; - } - return retval; + return NameModifier() + GetShortName(); } // the name to be used when expoerting this equipment to a chat line. @@ -140,10 +122,7 @@ public String MegaMekName( boolean UseRear ) { } else { retval = "IS" + retval; } - if( Rear ) { - retval += " (R)"; - } - return retval; + return NameModifier() + retval; } // reference for the book that the equipment comes from @@ -157,7 +136,7 @@ public int NumCrits() { } public int NumCVSpaces() { - return 1; + return 1 + NumMGs; } @Override @@ -449,16 +428,12 @@ public boolean SwitchableAmmo() { @Override public boolean CanMountRear() { - return true; + return ! IsTurreted(); } @Override public void MountRear( boolean rear ) { Rear = rear; - if( MGs[0] != null ) { MGs[0].MountRear( rear ); } - if( MGs[1] != null ) { MGs[1].MountRear( rear ); } - if( MGs[2] != null ) { MGs[2].MountRear( rear ); } - if( MGs[3] != null ) { MGs[3].MountRear( rear ); } } @Override @@ -476,26 +451,24 @@ public String GetManufacturer() { return Manufacturer; } - public boolean AddToTurret( ifTurret t ) { - if( t.AddWeapon( this ) ) { - Turret = t; - return true; - } else { - Turret = null; - return false; - } - } - - public void RemoveFromTurret( ifTurret t ) { - t.RemoveWeapon( this ); - Turret = null; + @Override + public boolean CanMountTurret() { + return CanAllocCVTurret() && ! IsMountedRear(); } - public boolean IsTurreted() { - if( Turret != null ) { return true; } - return false; + @Override + public void MountTurret( ifTurret t ) { + if( Turret == t ) return; + if( Turret != null ) { + Turret.RemoveItem( this ); + } + if( t != null ) { + t.AddItem( this ); + } + Turret = t; } + @Override public ifTurret GetTurret() { return Turret; } @@ -525,4 +498,9 @@ private RangedWeapon Copy( RangedWeapon b ) { public String toString() { return GetName(); } + + @Override + public boolean CanAllocCVBody() { + return false; + } } diff --git a/sswlib/src/main/java/components/Mech.java b/sswlib/src/main/java/components/Mech.java index f2585287..fb72cddf 100644 --- a/sswlib/src/main/java/components/Mech.java +++ b/sswlib/src/main/java/components/Mech.java @@ -358,6 +358,8 @@ public void SetRulesLevel( int r ) { } public void SetYear( int y, boolean specified ) { + // override specified as false if year is 0 + if( y == 0) specified = false; if( Omnimech ) { CurLoadout.SetYear( y, specified ); } else { @@ -2163,9 +2165,9 @@ public double GetCurrentDryTons() { return result; } - public int GetMaxHeat() { + public double GetMaxHeat() { // returns the maximum heat of the mech - int result = 0; + double result = 0; result += GetMovementHeat(); result += GetWeaponHeat(); if( ! Prefs.getBoolean( "HeatExcludeSystems", false ) ) { @@ -2285,11 +2287,12 @@ public int GetBVMovementHeat() { } } - public int GetWeaponHeat() + public double GetWeaponHeat() { return GetWeaponHeat(Prefs.getBoolean("HeatExcludeOS", false), Prefs.getBoolean( "HeatExcludeRear", false), - Prefs.getBoolean( "HeatACFullRate", true), + Prefs.getBoolean( "HeatACFullRate", false), + Prefs.getBoolean( "HeatStreaksHalfRate", false), Prefs.getBoolean( "HeatExcludeEquips", false)); } @@ -2297,17 +2300,19 @@ public int GetWeaponHeat() * * @param ExcludeOS * @param ExcludeRear - * @param FullRate + * @param ACFullRate + * @param StreaksHalfRate * @param ExcludeEquip * @return int representing the total weapon heat limited by the exclusions provided */ - public int GetWeaponHeat(boolean ExcludeOS, + public double GetWeaponHeat(boolean ExcludeOS, boolean ExcludeRear, - boolean FullRate, + boolean ACFullRate, + boolean StreaksHalfRate, boolean ExcludeEquip) { // returns the heat generated by weaponry and equipment that are not // core components - int result = 0; + double result = 0; ArrayList v = CurLoadout.GetNonCore(); if( v.size() <= 0 ) { return result; @@ -2319,14 +2324,17 @@ public int GetWeaponHeat(boolean ExcludeOS, if( a instanceof ifWeapon ) { boolean OS = ((ifWeapon) a).IsOneShot(); boolean Rear = a.IsMountedRear(); - int rate = 1; - if( ( a instanceof RangedWeapon ) && FullRate ) { + double rate = 1; + if( ( a instanceof RangedWeapon ) && ACFullRate ) { if( ((RangedWeapon) a).IsUltra() ) { rate = 2; } else if( ((RangedWeapon) a).IsRotary() ) { rate = 6; } } + if( ((ifWeapon) a).IsStreak() && StreaksHalfRate ) { + rate = 0.5; + } if( ExcludeOS || ExcludeRear ) { if( ExcludeOS ) { if( ExcludeRear ) { @@ -2569,18 +2577,12 @@ public double GetExplosiveAmmoPenalty() { } break; case 4: - if (CurLoadout instanceof QuadLoadout && (! CurLoadout.HasLACASEII() )){ - result -= 15.0 * p.NumCrits(); - } - else if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= 15.0 * p.NumCrits(); } break; case 5: - if (CurLoadout instanceof QuadLoadout && (! CurLoadout.HasRACASEII() )){ - result -= 15.0 * p.NumCrits(); - } - else if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= 15.0 * p.NumCrits(); } break; @@ -2618,12 +2620,12 @@ else if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.Is } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= 15.0 * p.NumCrits(); } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.HasRTCASE() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= 15.0 * p.NumCrits(); } break; @@ -2794,12 +2796,12 @@ public double GetExplosiveWeaponPenalty() { } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= p.NumCrits() + mod; } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasRACASEII() & !CurLoadout.HasRTCASEII() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= p.NumCrits() + mod; } break; @@ -2837,12 +2839,12 @@ public double GetExplosiveWeaponPenalty() { } break; case 4: - if( ! CurLoadout.HasLACASEII() &! CurLoadout.HasLTCASEII() &! CurLoadout.HasLTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasLACASEII() & !CurLoadout.HasLTCASEII() & !CurLoadout.HasLTCASE() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= p.NumCrits() + mod; } break; case 5: - if( ! CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() &! CurLoadout.IsUsingClanCASE() ) { + if ((!CurLoadout.HasRACASEII() &! CurLoadout.HasRTCASEII() &! CurLoadout.HasRTCASE() & !CurLoadout.IsUsingClanCASE()) | CurLoadout.IsQuad()) { result -= p.NumCrits() + mod; } break; @@ -3001,7 +3003,7 @@ public double GetHeatAdjustedWeaponBV() { double wheat = GetBVWeaponHeat(); - if( GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { // check for coolant pods int NumHS = GetHeatSinks().GetNumHS(), MaxHSBonus = NumHS * 2, NumPods = 0; for( int i = 0; i < v.size(); i++ ) { @@ -3409,6 +3411,9 @@ public double GetAmmoCosts() { retval += ( (abPlaceable) v.get( i ) ).GetCost(); } } + if( Prefs.getBoolean( "CostAmmoMult", false ) ) { + retval *= GetCostMult(); + } return retval; } else { return retval; diff --git a/sswlib/src/main/java/components/MechTurret.java b/sswlib/src/main/java/components/MechTurret.java index 749cbfa2..fdf701d0 100644 --- a/sswlib/src/main/java/components/MechTurret.java +++ b/sswlib/src/main/java/components/MechTurret.java @@ -36,7 +36,7 @@ public class MechTurret extends abPlaceable implements ifTurret { private ifMechLoadout Owner; private AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); - private Vector weapons = new Vector(); + private Vector items = new Vector(); public MechTurret( ifMechLoadout l ) { Owner = l; @@ -49,43 +49,41 @@ public MechTurret( ifMechLoadout l ) { AC.SetCLFactions( "", "", "PS", "" ); } - public boolean AddWeapon( ifWeapon w ) { - if( ! (( w instanceof RangedWeapon ) || ( w instanceof MGArray )) ) { - return false; - } - if( w instanceof RangedWeapon ) { - //If it can't go in a Vehicle Turret then it can't go in a Mech one. - if( !((RangedWeapon) w).CanAllocCVTurret() ) return false; - //Make sure if they can split, that they haven't been. - if( ((RangedWeapon) w).CanSplit() ) { - //Gets all crit slots - ArrayList locations = Owner.FindIndexes( (abPlaceable) w ); - //first one - LocationIndex firstSlot = (LocationIndex) locations.get(0); - //check all of them - for (int i = 0; i < locations.size(); i++) { - //compare to the first. If they are different, it's been split. - LocationIndex currentSlot = ((LocationIndex) locations.get(i)); - if (currentSlot.Location != firstSlot.Location) - return false; - } + @Override + public boolean AddItem( abPlaceable p ) { + if( items.contains( p )) return false; + //Make sure if they can split, that they haven't been. + if( p.CanSplit() ) { + //Gets all crit slots + ArrayList locations = Owner.FindIndexes( (abPlaceable) p ); + //first one + LocationIndex firstSlot = (LocationIndex) locations.get(0); + //check all of them + for (int i = 0; i < locations.size(); i++) { + //compare to the first. If they are different, it's been split. + LocationIndex currentSlot = ((LocationIndex) locations.get(i)); + if (currentSlot.Location != firstSlot.Location) + return false; } } - weapons.add( w ); + items.add( p ); return true; } - public void RemoveWeapon( ifWeapon w ) { + @Override + public void RemoveItem( abPlaceable p ) { // extra code here! - weapons.remove( w ); + items.remove( p ); } - public Vector GetWeapons() { - return weapons; + @Override + public Vector GetItems() { + return items; } - public boolean IsInstalled( ifWeapon w ) { - return weapons.contains( w ); + @Override + public boolean IsInstalled( abPlaceable p ) { + return items.contains( p ); } @Override @@ -170,8 +168,8 @@ public int NumCVSpaces() { private double GetSize() { double retval = 0.0; - for( int i = 0; i < weapons.size(); i++ ) { - retval += ((abPlaceable) weapons.get( i )).GetTonnage(); + for( int i = 0; i < items.size(); i++ ) { + retval += ((abPlaceable) items.get( i )).GetTonnage(); } if( Owner.GetMech().UsingFractionalAccounting() ) { return CommonTools.RoundFractionalTons( retval * 0.1 ); diff --git a/sswlib/src/main/java/components/QuadLoadout.java b/sswlib/src/main/java/components/QuadLoadout.java index 161636a6..ea66f061 100644 --- a/sswlib/src/main/java/components/QuadLoadout.java +++ b/sswlib/src/main/java/components/QuadLoadout.java @@ -1973,17 +1973,6 @@ public boolean UnallocateAll( abPlaceable p, boolean override ) { if( ((RangedWeapon) p).IsUsingPulseModule() ) { UnallocateAll( ((RangedWeapon) p).GetPulseModule(), true ); } - if( ((RangedWeapon) p).IsTurreted() ) { - if( ((RangedWeapon) p).GetTurret() == HDTurret ) { - ((RangedWeapon) p).RemoveFromTurret( HDTurret ); - } - if( ((RangedWeapon) p).GetTurret() == LTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( LTTurret ); - } - if( ((RangedWeapon) p).GetTurret() == RTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( RTTurret ); - } - } } // if the item is an MG Array, check for it's MGs and unallocate @@ -1993,6 +1982,10 @@ public boolean UnallocateAll( abPlaceable p, boolean override ) { } } + if( p.IsTurreted() ) { + p.MountTurret( null ); + } + Owner.SetChanged( true ); // everything worked out fine @@ -2091,17 +2084,6 @@ public void UnallocateByIndex( int SIndex, abPlaceable[] a ) { if( ((RangedWeapon) p).IsUsingPulseModule() ) { UnallocateAll( ((RangedWeapon) p).GetPulseModule(), true ); } - if( ((RangedWeapon) p).IsTurreted() ) { - if( ((RangedWeapon) p).GetTurret() == HDTurret ) { - ((RangedWeapon) p).RemoveFromTurret( HDTurret ); - } - if( ((RangedWeapon) p).GetTurret() == LTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( LTTurret ); - } - if( ((RangedWeapon) p).GetTurret() == RTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( RTTurret ); - } - } } // if the item is an MG Array, check for it's MGs and unallocate @@ -2111,6 +2093,10 @@ public void UnallocateByIndex( int SIndex, abPlaceable[] a ) { } } + if( p.IsTurreted() ) { + p.MountTurret( null ); + } + Owner.SetChanged( true ); } @@ -2174,6 +2160,11 @@ public void AutoAllocate( EquipmentCollection e ) { while( ! Placed ) { try { switch( Loc ) { + case LocationIndex.MECH_LOC_HD: + AddToHD( p, FirstFree( HDCrits ) ); + Loc++; + Placed = true; + break; case LocationIndex.MECH_LOC_CT: AddToCT( p, FirstFree( CTCrits ) ); Loc++; @@ -2210,7 +2201,7 @@ public void AutoAllocate( EquipmentCollection e ) { Placed = true; break; default: - Loc = LocationIndex.MECH_LOC_CT; + Loc = LocationIndex.MECH_LOC_HD; DefCount++; } } catch( Exception x ) { @@ -2916,6 +2907,25 @@ public boolean IsAllocated( abPlaceable p ) { // Private Methods private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exception { + class RemoveEntry { + abPlaceable p; + boolean rear; + ifTurret turret; + + RemoveEntry( int AddInLoc, int i ) { + // we've already ensured that it is not location locked + // above, so put the item back into the queue. + p = Loc[i]; + rear = p.IsMountedRear(); + turret = p.GetTurret(); + if( p.CanSplit() && p.Contiguous() ) { + UnallocateAll( Loc[i], false ); + } else { + UnallocateByIndex( AddInLoc, Loc ); + } + } + } + // Adds the specified placeable to the given location at the specified // stating index. Throws Exceptions with error messages if things went // wrong. @@ -2924,14 +2934,15 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc ((Equipment) p).ValidateMaxPerLocation(Loc); } + // TODO: this snapshot thing doesn't work (see its usage below), commented out for now // Let's get a snapshot of the location so we can reset it if we have to. - abPlaceable SnapShot[] = Loc.clone(); + //abPlaceable SnapShot[] = Loc.clone(); // we have to accomodate for Artemis IV systems boolean AddIn = false; boolean ArrayGood = false; int AddInSize = 1; - ArrayList removed = new ArrayList(), rears = new ArrayList(); + ArrayList removed = new ArrayList<>(); // check for generic placement if( SIndex == -1 ) { @@ -3044,17 +3055,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc for( i = SIndex; i < ( p.NumCrits() + SIndex ); i++ ) { // is there a non-location locked item there? if( Loc[i] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( i, Loc ); - } + removed.add( new RemoveEntry( i, i ) ); } // finally, allocate the item slot Loc[i] = p; @@ -3065,17 +3066,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc if( p instanceof RangedWeapon ) { if( ((RangedWeapon) p).IsUsingFCS() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } for( int j = AddInLoc; j < AddInSize + AddInLoc; j++ ) { Loc[j] = (abPlaceable) ((RangedWeapon) p).GetFCS(); @@ -3083,49 +3074,19 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc } if( ((RangedWeapon) p).IsUsingCapacitor() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetCapacitor(); } if( ((RangedWeapon) p).IsUsingInsulator() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetInsulator(); } if( ((RangedWeapon) p).IsUsingPulseModule() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetPulseModule(); } @@ -3135,16 +3096,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc if( p instanceof MGArray ) { for( i = 0; i < ((MGArray) p).GetNumMGs(); i++ ) { if( Loc[MGLocs[i]] != NoItem ) { - // we know it's not location locked, so kick it out - if( Loc[MGLocs[i]].CanSplit() && Loc[MGLocs[i]].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[MGLocs[i]], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( MGLocs[i], Loc ); - } + removed.add( new RemoveEntry( MGLocs[i], i ) ); } Loc[MGLocs[i]] = ((MGArray) p).GetMGs()[i]; } @@ -3162,16 +3114,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc // if there is an item there, put it back in the queue if( Loc[SIndex] != NoItem ) { - // put the item back into the queue - if( Loc[SIndex].CanSplit() && Loc[SIndex].Contiguous() ) { - removed.add( Loc[SIndex] ); - rears.add( new Boolean( Loc[SIndex].IsMountedRear() ) ); - UnallocateAll( Loc[SIndex], false ); - } else { - removed.add( Loc[SIndex] ); - rears.add( new Boolean( Loc[SIndex].IsMountedRear() ) ); - UnallocateByIndex( SIndex, Loc ); - } + removed.add( new RemoveEntry( SIndex, SIndex ) ); } // now allocate the item. @@ -3186,16 +3129,18 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc } // now that allocation is finished, add in the removed items if possible - for( int i = 0; i < removed.size(); i++ ) { + for( RemoveEntry remove : removed ) { // no error handling here since the items are already in the queue try { - Allocate( (abPlaceable) removed.get( i ), -1, Loc ); - ((abPlaceable) removed.get( i )).MountRear( ((Boolean) rears.get( i ))); + Allocate( remove.p, -1, Loc ); + remove.p.MountRear( remove.rear ); + remove.p.MountTurret( remove.turret ); } catch( Exception e1 ) { } } } catch ( ArrayIndexOutOfBoundsException e ) { + // TODO: Following snapshot thing actually does nothing // reset the location - Loc = SnapShot; + //Loc = SnapShot; // tell the user what happened. if( p instanceof RangedWeapon ) { @@ -3409,7 +3354,7 @@ public ifMechLoadout Clone() { clone.SetRulesLevel( RulesLevel ); clone.SetTechBase( TechBase ); clone.SetEra( Era ); - clone.SetYear( Year, false ); + clone.SetYear( Year, YearSpecified ); clone.SetHDCrits( HDCrits.clone() ); clone.SetCTCrits( CTCrits.clone() ); clone.SetLTCrits( LTCrits.clone() ); @@ -4517,10 +4462,7 @@ public void SetHDTurret( MechTurret t ) { } public boolean CanUseHDTurret() { - if( Owner.GetCockpit().IsTorsoMounted() && !HasLTTurret() && !HasRTTurret() ) { - return true; - } - return false; + return Owner.GetCockpit().IsTorsoMounted(); } public MechTurret GetLTTurret() { @@ -4574,8 +4516,7 @@ public void SetLTTurret( MechTurret t ) { } public boolean CanUseLTTurret() { - if( HasRTTurret() || HasHDTurret() ) { return false; } - return true; + return ! HasRTTurret(); } public MechTurret GetRTTurret() { @@ -4629,19 +4570,14 @@ public void SetRTTurret( MechTurret t ) { } public boolean CanUseRTTurret() { - if( HasLTTurret() || HasHDTurret() ) { return false; } - return true; + return ! HasLTTurret(); } private void ClearTurretWeapons( MechTurret t ) { for( int i = 0; i < NonCore.size(); i++ ) { - if( NonCore.get( i ) instanceof RangedWeapon ) { - RangedWeapon w = (RangedWeapon) NonCore.get( i ); - if( w.IsTurreted() ) { - if( w.GetTurret() == t ) { - w.RemoveFromTurret( t ); - } - } + abPlaceable p = (abPlaceable) NonCore.get( i ); + if( p.GetTurret() == t ) { + p.MountTurret( null ); } } } diff --git a/sswlib/src/main/java/components/Quirk.java b/sswlib/src/main/java/components/Quirk.java index 087a7872..08a92f0e 100644 --- a/sswlib/src/main/java/components/Quirk.java +++ b/sswlib/src/main/java/components/Quirk.java @@ -96,6 +96,24 @@ public int getCost() { return cost; } + /** + * @return the cost as a string with + or - prefix depending on isPositive() + */ + public String getCostText() { + if (isPositive()) { + return "+" + cost; + } + return "-" + cost; + } + + public String getDirection() { + if (isPositive()) { + return "Pos"; + } else { + return "Neg"; + } + } + /** * @return the description @@ -198,7 +216,7 @@ public boolean isProtomech() { /** * @return the isvariable */ - public boolean isIsvariable() { + public boolean isVariable() { return isvariable; } diff --git a/sswlib/src/main/java/components/RangedWeapon.java b/sswlib/src/main/java/components/RangedWeapon.java index b670d1b2..f1fff3af 100644 --- a/sswlib/src/main/java/components/RangedWeapon.java +++ b/sswlib/src/main/java/components/RangedWeapon.java @@ -375,20 +375,7 @@ public String CritName() { if( UsingCaseless ) { retval += " (Caseless)"; } - if( IsTurreted() ) { - retval = "(T) " + retval; - } else { - if( InArray ) { - if( CurArray.IsTurreted() ) { - retval = "(T) " + retval; - } - } - } - if( MountedRear ) { - return "(R) " + retval; - } else { - return retval; - } + return NameModifier() + retval; } public String LookupName() { @@ -405,14 +392,7 @@ public String LookupName() { if( UsingCaseless ) { retval += " (Caseless)"; } - if( IsTurreted() ) { - retval = "(T) " + retval; - } - if( MountedRear ) { - return "(R) " + retval; - } else { - return retval; - } + return NameModifier() + retval; } public String ChatName() { @@ -420,11 +400,7 @@ public String ChatName() { } public String MegaMekName( boolean UseRear ) { - if( UseRear ) { - return MegaMekName + " (R)"; - } else { - return MegaMekName; - } + return (MegaMekName + " " + NameModifier()).trim(); } public String BookReference() { @@ -581,13 +557,13 @@ public double GetCurOffensiveBV( boolean UseRear, boolean UseTC, boolean UseAES, return retval; } else { if( UseRear ) { - if( MountedRear ) { + if( IsMountedRear() ) { return retval; } else { return retval * 0.5; } } else { - if( MountedRear ) { + if( IsMountedRear() ) { return retval * 0.5; } else { return retval; @@ -721,17 +697,13 @@ public int GetToHitLong() { public boolean CanMountRear() { // all weapons can be mounted to the rear. // unless they're turreted - if( IsTurreted() ) { return false; } - return true; + return ! IsTurreted(); } @Override public void MountRear( boolean rear ) { if( IsInArray() ) { - if( GetMyArray().IsMountedRear() != rear ) { - GetMyArray().MountRear( rear ); - } - MountedRear = rear; + GetMyArray().MountRear( rear ); } else { MountedRear = rear; } @@ -739,7 +711,11 @@ public void MountRear( boolean rear ) { @Override public boolean IsMountedRear() { - return MountedRear; + if( IsInArray() ) { + return GetMyArray().IsMountedRear(); + } else { + return MountedRear; + } } public boolean IsCluster() { @@ -1083,44 +1059,38 @@ public void SetLocationLinked( boolean b ) { SetLocked( b ); } - public boolean AddToTurret( ifTurret t ) { - if( InArray ) { - if( CurArray.AddToTurret( t ) ) { - return true; - } else { - return false; - } - } - if( t.AddWeapon( this ) ) { - Turret = t; - return true; - } else { - Turret = null; - return false; - } - } - - public void RemoveFromTurret( ifTurret t ) { - if( InArray ) { - CurArray.RemoveFromTurret( t ); - return; - } - t.RemoveWeapon( this ); - Turret = null; + @Override + public boolean CanMountTurret() { + // If it can't go in a Vehicle Turret then it can't go in a Mech one. + // Turret and rear mount are also mutually exclusive. + return CanAllocCVTurret() && ! IsMountedRear(); } - public boolean IsTurreted() { - if( InArray ) { - return CurArray.IsTurreted(); + @Override + public void MountTurret( ifTurret t ) { + if( IsInArray() ) { + GetMyArray().MountTurret( t ); + } else { + if( Turret == t ) return; + if( Turret != null ) { + Turret.RemoveItem( this ); + } + if( t != null ) { + t.AddItem( this ); + } + Turret = t; } - if( Turret != null ) { return true; } - return false; } + @Override public ifTurret GetTurret() { - return Turret; + if( IsInArray() ) { + return GetMyArray().GetTurret(); + } else { + return Turret; + } } - + public RangedWeapon Clone() { return new RangedWeapon( this ); } @@ -1132,12 +1102,8 @@ public int GetBMRulesLevel() { @Override public String toString() { String retval = CritName; - if( MountedRear ) - retval = "(R) " + retval; - if ( UsingFCS ) retval += " w/" + GetFCS().toString(); - - return retval; + return NameModifier() + retval; } } diff --git a/sswlib/src/main/java/components/SponsonTurret.java b/sswlib/src/main/java/components/SponsonTurret.java index 3e983ae6..c3bee0f9 100644 --- a/sswlib/src/main/java/components/SponsonTurret.java +++ b/sswlib/src/main/java/components/SponsonTurret.java @@ -28,16 +28,13 @@ package components; -import common.CommonTools; import java.util.ArrayList; public class SponsonTurret extends abPlaceable { private ifCVLoadout Owner; private final static AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); - private boolean Clan, - isTonnageSet; + private boolean Clan; private ArrayList Items = new ArrayList(); - private double MaxTonnage = 0; public SponsonTurret( ifCVLoadout l, boolean clan) { AC.SetISCodes( 'B', 'F', 'F', 'F', 'D' ); @@ -96,10 +93,7 @@ public int NumCVSpaces() { @Override public double GetTonnage() { - if ( isTonnageSet ) - return MaxTonnage; - else - return GetSize(); + return GetSize(); } @Override @@ -145,9 +139,6 @@ public AvailableCode GetAvailability() { private double GetSize() { double Build = 0.0; - if ( isTonnageSet ) - return MaxTonnage; - if( Items.isEmpty() ) { return 0; } @@ -192,21 +183,4 @@ public void SetItems( ArrayList a ) { public ArrayList GetItems() { return Items; } - - public void TonnageSet( boolean i ) { - isTonnageSet = i; - if (!i) - MaxTonnage = 0; - } - public void SetTonnage( double t ) { - MaxTonnage = t; - isTonnageSet = true; - } - public boolean isTonnageSet() { - return isTonnageSet; - } - - public double GetMaxTonnage() { - return MaxTonnage; - } } diff --git a/sswlib/src/main/java/components/Supercharger.java b/sswlib/src/main/java/components/Supercharger.java index 2e2b088d..4c5a9b72 100644 --- a/sswlib/src/main/java/components/Supercharger.java +++ b/sswlib/src/main/java/components/Supercharger.java @@ -28,7 +28,7 @@ package components; -public class Supercharger extends abPlaceable { +public class Supercharger extends Equipment { private ifLoadout Owner; private AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); @@ -39,7 +39,7 @@ public Supercharger( ifLoadout l ) { AC.SetCLCodes( 'C', 'X', 'F', 'F', 'D' ); AC.SetCLDates( 0, 0, false, 3078, 0, 0, false, false ); AC.SetCLFactions( "", "", "ES", "" ); - AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); Owner = (ifLoadout)l; AddMechModifier( new MechModifier( 0, 0, 0, 0.5, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, true, false ) ); } @@ -145,6 +145,14 @@ public boolean CoreComponent() { return true; } + public void SetClan(boolean b ) { super.SetCurrentTech(b ? AvailableCode.TECH_CLAN : AvailableCode.TECH_INNER_SPHERE); } + + public boolean IsClan() { return (super.GetCurrentTech() == AvailableCode.TECH_CLAN); } + @Override + public String GetEquipmentType() { + return "Supercharger"; + } + @Override public AvailableCode GetAvailability() { AvailableCode retval = AC.Clone(); diff --git a/sswlib/src/main/java/components/TripodLoadout.java b/sswlib/src/main/java/components/TripodLoadout.java index 82da5de1..a9d901a4 100644 --- a/sswlib/src/main/java/components/TripodLoadout.java +++ b/sswlib/src/main/java/components/TripodLoadout.java @@ -2349,17 +2349,6 @@ public boolean UnallocateAll( abPlaceable p, boolean override ) { if( ((RangedWeapon) p).IsUsingPulseModule() ) { UnallocateAll( ((RangedWeapon) p).GetPulseModule(), true ); } - if( ((RangedWeapon) p).IsTurreted() ) { - if( ((RangedWeapon) p).GetTurret() == HDTurret ) { - ((RangedWeapon) p).RemoveFromTurret( HDTurret ); - } - if( ((RangedWeapon) p).GetTurret() == LTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( LTTurret ); - } - if( ((RangedWeapon) p).GetTurret() == RTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( RTTurret ); - } - } } // if the item is an MG Array, check for it's MGs and unallocate @@ -2369,6 +2358,10 @@ public boolean UnallocateAll( abPlaceable p, boolean override ) { } } + if( p.IsTurreted() ) { + p.MountTurret( null ); + } + Owner.SetChanged( true ); // everything worked out fine @@ -2467,17 +2460,6 @@ public void UnallocateByIndex( int SIndex, abPlaceable[] a ) { if( ((RangedWeapon) p).IsUsingPulseModule() ) { UnallocateAll( ((RangedWeapon) p).GetPulseModule(), true ); } - if( ((RangedWeapon) p).IsTurreted() ) { - if( ((RangedWeapon) p).GetTurret() == HDTurret ) { - ((RangedWeapon) p).RemoveFromTurret( HDTurret ); - } - if( ((RangedWeapon) p).GetTurret() == LTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( LTTurret ); - } - if( ((RangedWeapon) p).GetTurret() == RTTurret ) { - ((RangedWeapon) p).RemoveFromTurret( RTTurret ); - } - } } // if the item is an MG Array, check for it's MGs and unallocate @@ -2487,6 +2469,10 @@ public void UnallocateByIndex( int SIndex, abPlaceable[] a ) { } } + if( p.IsTurreted() ) { + p.MountTurret( null ); + } + Owner.SetChanged( true ); } @@ -2554,6 +2540,11 @@ public void AutoAllocate( EquipmentCollection e ) { while( ! Placed ) { try { switch( Loc ) { + case LocationIndex.MECH_LOC_HD: + AddToHD( p, FirstFree( HDCrits ) ); + Loc++; + Placed = true; + break; case LocationIndex.MECH_LOC_CT: AddToCT( p, FirstFree( CTCrits ) ); Loc++; @@ -2595,7 +2586,7 @@ public void AutoAllocate( EquipmentCollection e ) { Placed = true; break; default: - Loc = LocationIndex.MECH_LOC_CT; + Loc = LocationIndex.MECH_LOC_HD; DefCount++; } } catch( Exception x ) { @@ -3352,6 +3343,25 @@ public boolean IsAllocated( abPlaceable p ) { // Private Methods private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exception { + class RemoveEntry { + abPlaceable p; + boolean rear; + ifTurret turret; + + RemoveEntry( int AddInLoc, int i ) { + // we've already ensured that it is not location locked + // above, so put the item back into the queue. + p = Loc[i]; + rear = p.IsMountedRear(); + turret = p.GetTurret(); + if( p.CanSplit() && p.Contiguous() ) { + UnallocateAll( Loc[i], false ); + } else { + UnallocateByIndex( AddInLoc, Loc ); + } + } + } + // Adds the specified placeable to the given location at the specified // stating index. Throws Exceptions with error messages if things went // wrong. @@ -3360,14 +3370,15 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc ((Equipment) p).ValidateMaxPerLocation(Loc); } + // TODO: this snapshot thing doesn't work (see its usage below), commented out for now // Let's get a snapshot of the location so we can reset it if we have to. - abPlaceable SnapShot[] = Loc.clone(); + //abPlaceable SnapShot[] = Loc.clone(); // we have to accomodate for Artemis IV systems boolean AddIn = false; boolean ArrayGood = false; int AddInSize = 1; - ArrayList removed = new ArrayList(), rears = new ArrayList(); + ArrayList removed = new ArrayList<>(); // check for generic placement if( SIndex == -1 ) { @@ -3480,17 +3491,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc for( i = SIndex; i < ( p.NumCrits() + SIndex ); i++ ) { // is there a non-location locked item there? if( Loc[i] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( i, Loc ); - } + removed.add( new RemoveEntry( i, i ) ); } // finally, allocate the item slot Loc[i] = p; @@ -3501,17 +3502,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc if( p instanceof RangedWeapon ) { if( ((RangedWeapon) p).IsUsingFCS() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } for( int j = AddInLoc; j < AddInSize + AddInLoc; j++ ) { Loc[j] = (abPlaceable) ((RangedWeapon) p).GetFCS(); @@ -3519,49 +3510,19 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc } if( ((RangedWeapon) p).IsUsingCapacitor() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetCapacitor(); } if( ((RangedWeapon) p).IsUsingInsulator() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetInsulator(); } if( ((RangedWeapon) p).IsUsingPulseModule() ) { if( Loc[AddInLoc] != NoItem ) { - // we've already ensured that it is not location locked - // above, so put the item back into the queue. - if( Loc[i].CanSplit() && Loc[i].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[i], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( AddInLoc, Loc ); - } + removed.add( new RemoveEntry( AddInLoc, i ) ); } Loc[AddInLoc] = ((RangedWeapon) p).GetPulseModule(); } @@ -3571,16 +3532,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc if( p instanceof MGArray ) { for( i = 0; i < ((MGArray) p).GetNumMGs(); i++ ) { if( Loc[MGLocs[i]] != NoItem ) { - // we know it's not location locked, so kick it out - if( Loc[MGLocs[i]].CanSplit() && Loc[MGLocs[i]].Contiguous() ) { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateAll( Loc[MGLocs[i]], false ); - } else { - removed.add( Loc[i] ); - rears.add( new Boolean( Loc[i].IsMountedRear() ) ); - UnallocateByIndex( MGLocs[i], Loc ); - } + removed.add( new RemoveEntry( MGLocs[i], i ) ); } Loc[MGLocs[i]] = ((MGArray) p).GetMGs()[i]; } @@ -3598,16 +3550,7 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc // if there is an item there, put it back in the queue if( Loc[SIndex] != NoItem ) { - // put the item back into the queue - if( Loc[SIndex].CanSplit() && Loc[SIndex].Contiguous() ) { - removed.add( Loc[SIndex] ); - rears.add( new Boolean( Loc[SIndex].IsMountedRear() ) ); - UnallocateAll( Loc[SIndex], false ); - } else { - removed.add( Loc[SIndex] ); - rears.add( new Boolean( Loc[SIndex].IsMountedRear() ) ); - UnallocateByIndex( SIndex, Loc ); - } + removed.add( new RemoveEntry( SIndex, SIndex ) ); } // now allocate the item. @@ -3622,16 +3565,18 @@ private void Allocate( abPlaceable p, int SIndex, abPlaceable[] Loc ) throws Exc } // now that allocation is finished, add in the removed items if possible - for( int i = 0; i < removed.size(); i++ ) { + for( RemoveEntry remove : removed ) { // no error handling here since the items are already in the queue try { - Allocate( (abPlaceable) removed.get( i ), -1, Loc ); - ((abPlaceable) removed.get( i )).MountRear( ((Boolean) rears.get( i ))); + Allocate( remove.p, -1, Loc ); + remove.p.MountRear( remove.rear ); + remove.p.MountTurret( remove.turret ); } catch( Exception e1 ) { } } } catch ( ArrayIndexOutOfBoundsException e ) { + // TODO: Following snapshot thing actually does nothing // reset the location - Loc = SnapShot; + //Loc = SnapShot; // tell the user what happened. if( p instanceof RangedWeapon ) { @@ -3872,7 +3817,7 @@ public ifMechLoadout Clone() { clone.SetRulesLevel( RulesLevel ); clone.SetTechBase( TechBase ); clone.SetEra( Era ); - clone.SetYear( Year, false ); + clone.SetYear( Year, YearSpecified ); clone.SetHDCrits( HDCrits.clone() ); clone.SetCTCrits( CTCrits.clone() ); clone.SetLTCrits( LTCrits.clone() ); @@ -5120,13 +5065,9 @@ public boolean CanUseRTTurret() { private void ClearTurretWeapons( MechTurret t ) { for( int i = 0; i < NonCore.size(); i++ ) { - if( NonCore.get( i ) instanceof RangedWeapon ) { - RangedWeapon w = (RangedWeapon) NonCore.get( i ); - if( w.IsTurreted() ) { - if( w.GetTurret() == t ) { - w.RemoveFromTurret( t ); - } - } + abPlaceable p = (abPlaceable) NonCore.get( i ); + if( p.GetTurret() == t ) { + p.MountTurret( null ); } } } diff --git a/sswlib/src/main/java/components/Turret.java b/sswlib/src/main/java/components/Turret.java index ed124119..a8b12913 100644 --- a/sswlib/src/main/java/components/Turret.java +++ b/sswlib/src/main/java/components/Turret.java @@ -99,12 +99,12 @@ public double GetTonnage() { if ( isTonnageSet ) return MaxTonnage; else - return GetSize(); + return GetTonnageFromItems(); } @Override public double GetCost() { - return GetSize() * 5000.0; + return GetTonnage() * 5000.0; } public double GetOffensiveBV() { @@ -142,16 +142,13 @@ public AvailableCode GetAvailability() { return retval; } - private double GetSize() { - double Build = 0.0; - - if ( isTonnageSet ) - return MaxTonnage; - + public double GetTonnageFromItems() { if( Items.isEmpty() ) { return 0; } + double Build = 0.0; + for( int i = 0; i < Items.size(); i++ ) { abPlaceable a = (abPlaceable)Items.get(i); if( a instanceof RangedWeapon ) { @@ -175,6 +172,14 @@ private double GetSize() { return CommonTools.RoundHalfUp( Build * 0.10 ); } + public String GetTonnageText() { + if( isTonnageSet ) { + return String.format( "%.1f/%.1f", GetTonnageFromItems(), GetMaxTonnage() ); + } else { + return String.format( "%.1f", GetTonnage() ); + } + } + @Override public boolean CoreComponent() { return true; @@ -184,28 +189,29 @@ public boolean CoreComponent() { public String toString() { return CritName(); } - + public void SetItems( ArrayList a ) { Items = a; } - + public ArrayList GetItems() { return Items; } - - public void TonnageSet( boolean i ) { - isTonnageSet = i; - if (!i) - MaxTonnage = 0; + + public void UnsetTonnage() { + MaxTonnage = 0; + isTonnageSet = false; } + public void SetTonnage( double t ) { MaxTonnage = t; isTonnageSet = true; } + public boolean isTonnageSet() { return isTonnageSet; } - + public double GetMaxTonnage() { return MaxTonnage; } diff --git a/sswlib/src/main/java/components/VTOLBooster.java b/sswlib/src/main/java/components/VTOLBooster.java new file mode 100644 index 00000000..536e9fa7 --- /dev/null +++ b/sswlib/src/main/java/components/VTOLBooster.java @@ -0,0 +1,163 @@ +/* +Copyright (c) 2023~2024, Justin R. Bengtson (poopshotgun@yahoo.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Justin R. Bengtson nor the names of contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package components; + +public class VTOLBooster extends Equipment { + private ifLoadout Owner; + private AvailableCode AC = new AvailableCode( AvailableCode.TECH_BOTH ); + + public VTOLBooster(ifLoadout l ) { + AC.SetISCodes( 'D', 'X', 'F', 'E', 'D' ); + AC.SetISDates( 0, 0, false, 3009, 0, 0, false, false ); + AC.SetISFactions( "", "", "ES", "" ); + AC.SetCLCodes( 'D', 'X', 'F', 'E', 'D' ); + AC.SetCLDates( 0, 0, false, 2839, 0, 0, false, false ); + AC.SetCLFactions( "", "", "ES", "" ); + AC.SetRulesLevels( AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + Owner = (ifLoadout)l; + AddMechModifier(new MechModifier(0, 0, 0, 0.5, 0, 3, 0, 0.0, 0.0, 0.0, 0.0, true, false)); + } + + public String ActualName() { + return "VTOL Jet Booster"; + } + + public String CritName() { + return "VTOL Jet Booster"; + } + + public String LookupName() { + return "VTOL Jet Booster"; + } + + public String ChatName() { return "JtBstr"; } + + public String MegaMekName( boolean UseRear ) { + return (Owner.GetTechBase() >= AvailableCode.TECH_CLAN ? "CL" : "IS") + "VTOLJetBooster"; + } + + public String BookReference() { + return "Tactical Operations: Advanced Units Equipment"; + } + + @Override + public int NumCrits() { + return 1; + } + + public int NumCVSpaces() { + return 1; + } + + @Override + public double GetTonnage() { + double retval = 0.0; + if( Owner.UsingFractionalAccounting() ) { + retval = Math.ceil( Owner.GetEngine().GetTonnage() * 100 ) * 0.001; + } else { + retval = ((int) ( Math.ceil( Owner.GetEngine().GetTonnage() * 0.1 * 2 ))) * 0.5; + } + if( IsArmored() ) { + retval += 0.5; + } + return retval; + } + + @Override + public double GetCost() { + double retval = Owner.GetEngine().GetRating() * 10000.0; + if( IsArmored() ) { + retval += 150000.; + } + return retval; + } + + @Override + public double GetOffensiveBV() { + return 0.0; + } + + @Override + public double GetCurOffensiveBV( boolean UseRear, boolean UseTC, boolean UseAES ) { + return 0.0; + } + + @Override + public double GetCurOffensiveBV( boolean UseRear, boolean UseTC, boolean UseAES, boolean UseRobotic ) { + // BV will not change for this item, so just return the normal value + return GetOffensiveBV(); + } + + @Override + public double GetDefensiveBV() { + if( IsArmored() ) { + return 5.0; + } else { + return 0.0; + } + } + + @Override + public boolean LocationLocked() { + return true; + } + + @Override + public boolean LocationLinked() { + return true; + } + + @Override + public boolean CoreComponent() { + return true; + } + + @Override + public AvailableCode GetAvailability() { + AvailableCode retval = AC.Clone(); + if( IsArmored() ) { + retval.Combine( ArmoredAC ); + } + return retval; + } + + @Override + public boolean CanAllocCVFront() { return false; } + @Override + public boolean CanAllocCVRear() { return false; } + @Override + public boolean CanAllocCVSide() { return false; } + @Override + public boolean CanAllocCVTurret() { return false; } + + @Override + public String GetEquipmentType() { + return "VTOL Jet Booster"; + } +} diff --git a/sswlib/src/main/java/components/VehicularGrenadeLauncher.java b/sswlib/src/main/java/components/VehicularGrenadeLauncher.java index 57d228d1..03a5f1d6 100644 --- a/sswlib/src/main/java/components/VehicularGrenadeLauncher.java +++ b/sswlib/src/main/java/components/VehicularGrenadeLauncher.java @@ -157,6 +157,11 @@ public boolean CanAllocLegs() { return false; } + @Override + public boolean CanAllocCVBody() { + return false; + } + public int NumCrits() { return 1; } diff --git a/sswlib/src/main/java/components/abPlaceable.java b/sswlib/src/main/java/components/abPlaceable.java index 3fa715aa..9428165d 100644 --- a/sswlib/src/main/java/components/abPlaceable.java +++ b/sswlib/src/main/java/components/abPlaceable.java @@ -312,6 +312,17 @@ public boolean LocationLinked() { // we use other names elsewhere because this can get extremely long. public abstract String ActualName(); + // intended for usage within LookupName and CritName + protected String NameModifier() { + if( IsMountedRear() ) { + return "(R) "; + } else if( IsTurreted() ) { + return "(T) "; + } else { + return ""; + } + } + // the lookup name is used when we are trying to find the piece of equipment. public abstract String LookupName(); @@ -327,11 +338,12 @@ public String CritName( int Loc ) { public String PrintName() { return CritName(); } - + // the name to be used when expoerting this equipment to a chat line. public abstract String ChatName(); // the name to be used when exporting to MegaMek + // TODO: UseRear is legacy and unused public abstract String MegaMekName( boolean UseRear ); // reference for the book that the equipment comes from @@ -382,14 +394,16 @@ public void DecrementPlaced() { public void ResetPlaced() { } - // tells us whether the item can be mounted to the rear. Most items cannot, - // so this automatically returns false + // Tells us whether the item can be mounted to the rear on a mech location. + // Most items cannot, so this automatically returns false + // (Not used for vehicles, which have their own dedicated rear location.) public boolean CanMountRear() { return false; } - // This next two methods should be overridden by any component that can be - // mounted to the rear. + // The next two methods should be overridden by any component that can be + // mounted to the rear on a mech location. + // (Not used for vehicles, which have their own dedicated rear location.) public void MountRear(boolean rear) { } @@ -397,6 +411,27 @@ public boolean IsMountedRear() { return false; } + // Tells us whether the item can be mounted to a mech turret. + // Defaults to delegating to CanAllocCVTurret. + // (Not used for vehicles, which have their own dedicated turret locations.) + public boolean CanMountTurret() { + return CanAllocCVTurret(); + } + + // The next two methods should be overridden by any component that can be + // mounted to a mech turret. + // (Not used for vehicles, which have their own dedicated turret locations.) + public void MountTurret(ifTurret turret) { + } + + public ifTurret GetTurret() { + return null; + } + + public boolean IsTurreted() { + return GetTurret() != null; + } + // tells us if this is a core component. A special list is kept in the // loadout for items not of this type and calculations based on such. public boolean CoreComponent() { diff --git a/sswlib/src/main/java/components/ifCVLoadout.java b/sswlib/src/main/java/components/ifCVLoadout.java index c0c05de6..235890d1 100644 --- a/sswlib/src/main/java/components/ifCVLoadout.java +++ b/sswlib/src/main/java/components/ifCVLoadout.java @@ -116,8 +116,8 @@ public interface ifCVLoadout { public void SetRightItems( ArrayList c ); public void SetRearItems( ArrayList c ); public void SetBodyItems( ArrayList c ); - public void SetTurret1( ArrayList c ); - public void SetTurret2( ArrayList c ); + public void SetTurret1Items( ArrayList c ); + public void SetTurret2Items( ArrayList c ); public void SetSponsonTurretLeftItems(ArrayList c); public void SetSponsonTurretRightItems(ArrayList c); public void SetNonCore( ArrayList v ); @@ -130,11 +130,12 @@ public interface ifCVLoadout { public ArrayList GetMechMods(); public boolean CanUseClanCASE(); public boolean IsUsingClanCASE(); - public void SetClanCASE( boolean b ); - public void RemoveISCase(); - public void SetISCASE(); - public boolean HasISCASE(); - public CASE GetISCase(); + public void AddCase(boolean isClan); + public void RemoveCase(); + public boolean HasCase(); + public void SetCase( CASE c ); + public CASE GetCase(); + public void SetClanCASE(boolean b); public void SetFCSArtemisIV( boolean b ) throws Exception; public void SetFCSArtemisV( boolean b ) throws Exception; public void SetFCSApollo( boolean b ) throws Exception; @@ -148,6 +149,10 @@ public interface ifCVLoadout { public void SetSupercharger( Supercharger s ); public boolean HasSupercharger(); public Supercharger GetSupercharger(); + public void SetVTOLBooster(boolean b) throws Exception; + public void SetVTOLBooster(VTOLBooster s); + public boolean HasVTOLBooster(); + public VTOLBooster GetVTOLBooster(); public CVPowerAmplifier GetPowerAmplifier(); public void CheckExclusions( abPlaceable a ) throws Exception; public void MoveToQueue(int loc); @@ -157,6 +162,10 @@ public interface ifCVLoadout { public double GetSponsonTurretCost(); public void ResetHeatSinks(); public int NumCVAmmoSpaces(); + public boolean HasArmoredMotiveSystem(); + public boolean IsArmoredMotiveSystemClan(); + public void SetArmoredMotiveSystem(boolean b, boolean isClan); + public ArmoredMotiveSystem GetArmoredMotiveSystem(); /* public void AddMechModifier( MechModifier m ); public void RemoveMechMod( MechModifier m ); diff --git a/sswlib/src/main/java/components/ifEquipment.java b/sswlib/src/main/java/components/ifEquipment.java new file mode 100644 index 00000000..1f989321 --- /dev/null +++ b/sswlib/src/main/java/components/ifEquipment.java @@ -0,0 +1,49 @@ +/* +Copyright (c) 2008~2009, Justin R. Bengtson (poopshotgun@yahoo.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Justin R. Bengtson nor the names of contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package components; + +public interface ifEquipment { + // an abstract class for equipment of all types. This provides a basic + // functionality for most equipment types and can be overridden if needed. + public String LookupName(); + public String CritName(); + public boolean IsVariableSize(); + public boolean HasAmmo(); + public int GetAmmoIndex(); + public int MaxAllowed(); + + public void Validate( Mech m ) throws Exception; + public void Validate( CombatVehicle v ) throws Exception; + + public boolean CanAllocCVBody(); + public String GetEquipmentType(); + + public void SetCurrentTech(int techbase); + public int GetCurrentTech(); +} diff --git a/sswlib/src/main/java/components/ifTurret.java b/sswlib/src/main/java/components/ifTurret.java index aa8978be..2e37e467 100644 --- a/sswlib/src/main/java/components/ifTurret.java +++ b/sswlib/src/main/java/components/ifTurret.java @@ -31,10 +31,10 @@ import java.util.Vector; public interface ifTurret { - public boolean AddWeapon( ifWeapon w ); - public void RemoveWeapon( ifWeapon w ); - public Vector GetWeapons(); - public boolean IsInstalled( ifWeapon w ); + public boolean AddItem( abPlaceable p ); + public void RemoveItem( abPlaceable p ); + public Vector GetItems(); + public boolean IsInstalled( abPlaceable p ); public double GetTonnage(); public double GetCost(); } \ No newline at end of file diff --git a/sswlib/src/main/java/components/ifUnit.java b/sswlib/src/main/java/components/ifUnit.java index 9e71f3fd..d046e20a 100644 --- a/sswlib/src/main/java/components/ifUnit.java +++ b/sswlib/src/main/java/components/ifUnit.java @@ -5,6 +5,8 @@ package components; +import java.util.ArrayList; + public interface ifUnit { public int GetUnitType(); public int GetRulesLevel(); @@ -26,4 +28,6 @@ public interface ifUnit { public PhysicalEnhancement GetPhysEnhance(); public boolean UsingTC(); public TargetingComputer GetTC(); + public void SetQuirks (ArrayList q); + } diff --git a/sswlib/src/main/java/dialog/dlgQuirks.form b/sswlib/src/main/java/dialog/dlgQuirks.form new file mode 100644 index 00000000..633563f0 --- /dev/null +++ b/sswlib/src/main/java/dialog/dlgQuirks.form @@ -0,0 +1,196 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> + <Title/> + <Editor/> + <Renderer/> + </Column> + </TableColumnModel> + </Property> + <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> + <TableHeader reorderingAllowed="true" resizingAllowed="true"/> + </Property> + </Properties> + <Events> + <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tblListMouseClicked"/> + </Events> + </Component> + </SubComponents> + </Container> + <Container class="javax.swing.JScrollPane" name="jScrollPane2"> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTable" name="tblSelected"> + <Properties> + <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> + <Table columnCount="4" rowCount="4"> + <Column editable="true" title="Title 1" type="java.lang.Object"/> + <Column editable="true" title="Title 2" type="java.lang.Object"/> + <Column editable="true" title="Title 3" type="java.lang.Object"/> + <Column editable="true" title="Title 4" type="java.lang.Object"/> + </Table> + </Property> + </Properties> + <Events> + <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tblSelectedMouseClicked"/> + </Events> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="btnAdd"> + <Properties> + <Property name="text" type="java.lang.String" value=">>"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="btnRemove"> + <Properties> + <Property name="text" type="java.lang.String" value="<<"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRemoveActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JButton" name="btnDone"> + <Properties> + <Property name="text" type="java.lang.String" value="Done"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnDoneActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> diff --git a/sswlib/src/main/java/dialog/dlgQuirks.java b/sswlib/src/main/java/dialog/dlgQuirks.java new file mode 100644 index 00000000..3133d199 --- /dev/null +++ b/sswlib/src/main/java/dialog/dlgQuirks.java @@ -0,0 +1,234 @@ +/* +Copyright (c) 2008~2009, George Blouin Jr (george.blouin@gmail.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Justin R. Bengtson nor the names of contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package dialog; + +import components.Quirk; +import components.ifUnit; +import list.view.tbQuirks; +import java.util.ArrayList; + +public class dlgQuirks extends javax.swing.JDialog { + private tbQuirks tblQ; + private ifUnit Unit; + + /** Creates new form dlgQuirks */ + public dlgQuirks(java.awt.Frame parent, boolean modal, ifUnit unit, ArrayList<Quirk> availableQuirks, ArrayList<Quirk> currentQuirks) { + super(parent, modal); + initComponents(); + + Unit = unit; + + tblQ = new tbQuirks(currentQuirks); + tblQ.setupTable(tblSelected); + tblList.setModel(new tbQuirks(availableQuirks)); + } + + private void Refresh() + { + tblQ.setupTable(tblSelected); + tblQ.fireTableChanged(null); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + lblBattleMechQuirks = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + tblList = new javax.swing.JTable(); + jScrollPane2 = new javax.swing.JScrollPane(); + tblSelected = new javax.swing.JTable(); + btnAdd = new javax.swing.JButton(); + btnRemove = new javax.swing.JButton(); + btnDone = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + lblBattleMechQuirks.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + lblBattleMechQuirks.setText("BattleMech Quirks"); + lblBattleMechQuirks.setMaximumSize(new java.awt.Dimension(175, 15)); + lblBattleMechQuirks.setMinimumSize(new java.awt.Dimension(175, 15)); + lblBattleMechQuirks.setPreferredSize(new java.awt.Dimension(175, 15)); + + tblList.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + tblList.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + tblListMouseClicked(evt); + } + }); + jScrollPane1.setViewportView(tblList); + + tblSelected.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + tblSelected.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + tblSelectedMouseClicked(evt); + } + }); + jScrollPane2.setViewportView(tblSelected); + + btnAdd.setText(">>"); + btnAdd.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnAddActionPerformed(evt); + } + }); + + btnRemove.setText("<<"); + btnRemove.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnRemoveActionPerformed(evt); + } + }); + + btnDone.setText("Done"); + btnDone.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnDoneActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(btnRemove) + .addComponent(btnAdd)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(lblBattleMechQuirks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(btnDone))) + .addContainerGap()) + ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jScrollPane1, jScrollPane2}); + + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(lblBattleMechQuirks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, 0) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnDone) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(btnAdd) + .addGap(26, 26, 26) + .addComponent(btnRemove) + .addGap(111, 111, 111)))) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private void btnAddActionPerformed(java.awt.event.ActionEvent evt) { + Quirk q = (Quirk)((tbQuirks) tblList.getModel()).get( tblList.convertRowIndexToModel( tblList.getSelectedRow() )); + tblQ.quirklist.add(q); + Refresh(); + } + + private void btnRemoveActionPerformed(java.awt.event.ActionEvent evt) { + Quirk q = (Quirk)((tbQuirks) tblSelected.getModel()).get( tblSelected.convertRowIndexToModel( tblSelected.getSelectedRow() )); + tblQ.quirklist.remove(q); + Refresh(); + } + + private void btnDoneActionPerformed(java.awt.event.ActionEvent evt) { + setVisible( false ); + } + + private void tblListMouseClicked(java.awt.event.MouseEvent evt) { + if ( evt.getClickCount() == 2 ) { + btnAddActionPerformed(null); + } + } + + private void tblSelectedMouseClicked(java.awt.event.MouseEvent evt) { + if ( evt.getClickCount() == 2 ) { + btnRemoveActionPerformed(null); + } + } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnAdd; + private javax.swing.JButton btnDone; + private javax.swing.JButton btnRemove; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JLabel lblBattleMechQuirks; + private javax.swing.JTable tblList; + private javax.swing.JTable tblSelected; + // End of variables declaration//GEN-END:variables + +} diff --git a/sswlib/src/main/java/filehandlers/CVReader.java b/sswlib/src/main/java/filehandlers/CVReader.java index 319169b9..9d13c45b 100644 --- a/sswlib/src/main/java/filehandlers/CVReader.java +++ b/sswlib/src/main/java/filehandlers/CVReader.java @@ -319,8 +319,8 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) } else if( n.item( 0 ).getTextContent().equals( AvailableCode.TechBaseSTR[AvailableCode.TECH_BOTH] ) ) { m.SetMixed(); } - m.SetCompany( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); - m.SetLocation( FileCommon.DecodeFluff( map.getNamedItem( "location" ).getTextContent() ) ); + m.SetCompany( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); + m.SetLocation( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "location" ).getTextContent() ) ) ); n = d.getElementsByTagName( "year" ); map = n.item( 0 ).getAttributes(); m.SetYear( Integer.parseInt( n.item( 0 ).getTextContent() ), true ); @@ -370,7 +370,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) m.Visit( v ); } } - m.SetChassisModel( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); + m.SetChassisModel( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); n = d.getElementsByTagName( "engine" ); map = n.item( 0 ).getAttributes(); @@ -393,7 +393,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) m.Visit( v ); } //m.SetEngineRating( Integer.parseInt( map.getNamedItem( "rating" ).getTextContent() ) ); - m.SetEngineManufacturer( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); + m.SetEngineManufacturer( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); // base loadout // get the actuators first since that will complete the structural components @@ -416,10 +416,8 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) if ( omniCombatVehicle && map.getNamedItem("turretlimit") != null ) { m.GetLoadout().GetTurret().SetTonnage( Double.parseDouble(map.getNamedItem("turretlimit").getTextContent() ) ); } - // take care of Clan CASE on previous save file versions - if( SaveFileVersion < 1 ) { - // this will fail if Inner Sphere, so we're safe - //m.GetLoadout().SetClanCASE( true ); + if ( omniCombatVehicle && map.getNamedItem("rearturretlimit") != null ) { + m.GetLoadout().GetRearTurret().SetTonnage( Double.parseDouble(map.getNamedItem("rearturretlimit").getTextContent() ) ); } n = n.item( 0 ).getChildNodes(); LocationIndex ltc = new LocationIndex(); @@ -428,7 +426,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) if( n.item( i ).getNodeName().equals( "source" ) ) { m.setSource( n.item( i ).getTextContent() ); } else if( n.item( i ).getNodeName().equals( "clancase" ) ) { - //m.GetLoadout().SetClanCASE( ParseBoolean( n.item( i ).getTextContent() ) ); + m.GetLoadout().SetClanCASE( ParseBoolean( n.item( i ).getTextContent() ) ); } else if( n.item( i ).getNodeName().equals( "heatsinks" ) ) { map = n.item( i ).getAttributes(); int numhs = Integer.parseInt( map.getNamedItem( "number" ).getTextContent() ); @@ -507,6 +505,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) String eMan = ""; String eType = ""; String eName = ""; + String techbase = CommonTools.GetTechbaseString(m.GetTechbase()); int VGLArc = 0; int VGLAmmo = 0; double vtons = 0.0; @@ -515,10 +514,12 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) for( int j = 0; j < nl.getLength(); j++ ) { if( nl.item( j ).getNodeName().equals( "name" ) ) { map = nl.item( j ).getAttributes(); - eMan = map.getNamedItem( "manufacturer" ).getTextContent(); + eMan = CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ); eName = nl.item( j ).getTextContent(); } else if( nl.item( j ).getNodeName().equals( "type" ) ) { eType = nl.item( j ).getTextContent(); + } else if( nl.item( j ).getNodeName().equals( "techbase" ) ) { + techbase = nl.item( j ).getTextContent(); } else if( nl.item( j ).getNodeName().equals( "location" ) ) { l = DecodeLocation( nl.item( j ) ); if (l.Location == LocationIndex.CV_LOC_SPONSON_LEFT|| l.Location == LocationIndex.CV_LOC_SPONSON_RIGHT) { @@ -536,32 +537,31 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) lotsize = Integer.parseInt( nl.item( j ).getTextContent() ); } } - if( eType.equals( "TargetingComputer" ) || eType.equals( "CASE" ) || eType.equals( "CASEII" ) || eType.equals( "Supercharger" ) ) { + if( eType.equals( "TargetingComputer" ) || eType.equals( "CASE" ) + || eType.equals( "CASEII" ) || eType.equals( "Supercharger" ) + || eType.equals( "VTOL Jet Booster")) { if( eType.equals( "TargetingComputer") ) { if( SaveFileVersion == 0 ) { - if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { - m.UseTC( true, true ); - } else { - m.UseTC( true, false ); - } + m.UseTC( true, ( m.GetTechbase() == AvailableCode.TECH_CLAN ) ); } else { - if( eName.contains( "(CL)" ) ) { - m.UseTC( true, true ); - } else { - m.UseTC( true, false ); - } + m.UseTC( true, eName.contains( "(CL)" ) ); } ltc = l; } else if( eType.equals( "CASE" ) ) { - m.GetLoadout().SetISCASE(); - m.GetLoadout().SetClanCASE(( m.GetTechBase() == AvailableCode.TECH_CLAN)); + m.GetLoadout().AddCase(m.GetLoadout().IsUsingClanCASE() || (m.GetTechBase() == AvailableCode.TECH_CLAN)); } else if( eType.equals( "Supercharger" ) ) { m.GetLoadout().SetSupercharger( true ); + } else if( eType.equals( "VTOL Jet Booster" ) ) { + m.GetLoadout().SetVTOLBooster( true ); + } else if ( eType.equals("Armored Motive System")) { + m.GetLoadout().SetArmoredMotiveSystem(true, techbase == CommonTools.GetTechbaseString(AvailableCode.TECH_CLAN) + || (m.GetTechBase() == AvailableCode.TECH_CLAN)); } } else { abPlaceable p = GetEquipmentByName( eName, eType, m ); if( p == null ) { - throw new Exception( "Could not find " + eName + " as a piece of equipment.\nThe CombatVehicle cannot be loaded." ); + Messages += "Could not find " + eName + " as a piece of equipment.\n"; + continue; } p.SetManufacturer( eMan ); if( p instanceof Equipment ) { @@ -569,6 +569,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) ((Equipment) p).SetMaxTons(m.GetTonnage()); ((Equipment) p).SetTonnage( vtons ); } + ((Equipment) p).SetCurrentTech(CommonTools.GetTechbaseValue(techbase)); } if( ( p instanceof Ammunition ) && lotsize > 0 ) { ((Ammunition) p).SetLotSize( lotsize ); @@ -577,7 +578,12 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) ((VehicularGrenadeLauncher) p).SetArc( VGLArc ); ((VehicularGrenadeLauncher) p).SetAmmoType( VGLAmmo ); } - m.GetLoadout().AddTo(p, l.Location); + try { + m.GetLoadout().AddTo(p, l.Location); + } catch (Exception e) { + Messages += e.toString(); + continue; + } } } else if( n.item( i ).getNodeName().equals( "armored_locations" ) ) { NodeList nl = n.item( i ).getChildNodes(); @@ -628,7 +634,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) String pwtype = ""; int pwtech = 0; boolean oldfile = false, clanarmor = false; - m.SetArmorModel( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); + m.SetArmorModel( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); if( map.getNamedItem( "techbase" ) == null ) { // old style save file, set the armor based on the 'CombatVehicle's techbase if( m.GetBaseTechbase() == AvailableCode.TECH_CLAN ) { @@ -870,11 +876,6 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) } m.GetLoadout().SetRulesLevel( ruleslevel ); } - // take care of Clan CASE on previous save file versions - if( SaveFileVersion < 1 ) { - // this will fail if Inner Sphere, so we're safe - //m.GetLoadout().SetClanCASE( true ); - } if( SaveFileVersion < 2 ) { m.setSource( Source ); } @@ -901,7 +902,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) } } } else if( n.item( i ).getNodeName().equals( "clancase" ) ) { - //m.GetLoadout().SetClanCASE( ParseBoolean( n.item( i ).getTextContent() ) ); + m.GetLoadout().SetClanCASE( ParseBoolean( n.item( i ).getTextContent() ) ); } else if( n.item( i ).getNodeName().equals( "heatsinks" ) ) { hsLoc.clear(); map = n.item( i ).getAttributes(); @@ -986,7 +987,7 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) for( int j = 0; j < nl.getLength(); j++ ) { if( nl.item( j ).getNodeName().equals( "name" ) ) { map = nl.item( j ).getAttributes(); - eMan = map.getNamedItem( "manufacturer" ).getTextContent(); + eMan = CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ); eName = nl.item( j ).getTextContent(); } else if( nl.item( j ).getNodeName().equals( "type" ) ) { eType = nl.item( j ).getTextContent(); @@ -1004,7 +1005,9 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) lotsize = Integer.parseInt( nl.item( j ).getTextContent() ); } } - if( eType.equals( "TargetingComputer" ) || eType.equals( "CASE" ) || eType.equals( "CASEII" ) || eType.equals( "Supercharger" ) ) { + if( eType.equals( "TargetingComputer" ) || eType.equals( "CASE" ) + || eType.equals( "CASEII" ) || eType.equals( "Supercharger" ) + || eType.equals( "VTOL Jet Booster")) { if( eType.equals( "TargetingComputer") ) { if( SaveFileVersion == 0 ) { if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { @@ -1021,30 +1024,37 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) } ltc = l; } else if( eType.equals( "CASE" ) ) { - m.GetLoadout().SetISCASE(); - m.GetLoadout().SetClanCASE(( m.GetTechBase() == AvailableCode.TECH_CLAN)); + m.GetLoadout().AddCase(m.GetLoadout().IsUsingClanCASE() || (m.GetTechBase() == AvailableCode.TECH_CLAN)); } else if( eType.equals( "Supercharger" ) ) { m.GetLoadout().SetSupercharger( true ); + } else if ( eType.equals( "VTOL Jet Booster")) { + m.GetLoadout().SetVTOLBooster( true); } } else { abPlaceable p = GetEquipmentByName( eName, eType, m ); if( p == null ) { - throw new Exception( "Could not find " + eName + " as a piece of equipment.\nThe CombatVehicle cannot be loaded." ); + Messages += "Could not find " + eName + " as a piece of equipment.\n"; + continue; } - p.SetManufacturer( eMan ); - if( p instanceof Equipment ) { - if( ((Equipment) p).IsVariableSize() ) { - ((Equipment) p).SetTonnage( vtons ); + try { + p.SetManufacturer( eMan ); + if( p instanceof Equipment ) { + if( ((Equipment) p).IsVariableSize() ) { + ((Equipment) p).SetTonnage( vtons ); + } } + if( ( p instanceof Ammunition ) && lotsize > 0 ) { + ((Ammunition) p).SetLotSize( lotsize ); + } + if( p instanceof VehicularGrenadeLauncher ) { + ((VehicularGrenadeLauncher) p).SetArc( VGLArc ); + ((VehicularGrenadeLauncher) p).SetAmmoType( VGLAmmo ); + } + m.GetLoadout().AddTo(p, l.Location); + } catch( Exception e ) { + Messages += e.toString(); + continue; } - if( ( p instanceof Ammunition ) && lotsize > 0 ) { - ((Ammunition) p).SetLotSize( lotsize ); - } - if( p instanceof VehicularGrenadeLauncher ) { - ((VehicularGrenadeLauncher) p).SetArc( VGLArc ); - ((VehicularGrenadeLauncher) p).SetAmmoType( VGLAmmo ); - } - m.GetLoadout().AddTo(p, l.Location); } } else if( n.item( i ).getNodeName().equals( "armored_locations" ) ) { NodeList nl = n.item( i ).getChildNodes(); @@ -1110,24 +1120,62 @@ private CombatVehicle BuildVehicle( CombatVehicle m, Document d, DataFactory f ) } else { m.SetAdditional( FileCommon.DecodeFluff( n.item( 0 ).getTextContent() ) ); } - n = d.getElementsByTagName( "jumpjet_model" ); - if( n.item( 0 ).getTextContent() == null ) { - m.SetJJModel( "" ); - } else { - m.SetJJModel( FileCommon.DecodeFluff( n.item( 0 ).getTextContent() ) ); + n = d.getElementsByTagName( "quirks" ); + if (n.getLength() != 0) { + ArrayList<Quirk> quirks = new ArrayList<Quirk>(); + NodeList quirkList = n.item( 0 ).getChildNodes(); + for( int i = 0; i < quirkList.getLength(); i++ ) { + if (quirkList.item(i).getNodeName().equals("quirk")) { + Node nodeQuirk = quirkList.item(i); + map = nodeQuirk.getAttributes(); + + boolean postive = Boolean.parseBoolean(map.getNamedItem("postive").getTextContent()); + boolean battlemech = Boolean.parseBoolean(map.getNamedItem("battlemech").getTextContent()); + boolean industrialmech = Boolean.parseBoolean(map.getNamedItem("industrialmech").getTextContent()); + boolean combatvehicle = Boolean.parseBoolean(map.getNamedItem("combatvehicle").getTextContent()); + boolean battlearmor = Boolean.parseBoolean(map.getNamedItem("battlearmor").getTextContent()); + boolean aerospacefighter = Boolean.parseBoolean(map.getNamedItem("aerospacefighter").getTextContent()); + boolean conventionalfighter = Boolean.parseBoolean(map.getNamedItem("conventionalfigher").getTextContent()); + boolean dropship = Boolean.parseBoolean(map.getNamedItem("dropship").getTextContent()); + boolean jumpship = Boolean.parseBoolean(map.getNamedItem("jumpship").getTextContent()); + boolean warship = Boolean.parseBoolean(map.getNamedItem("warship").getTextContent()); + boolean spacestation = Boolean.parseBoolean(map.getNamedItem("spacestation").getTextContent()); + boolean protomech = Boolean.parseBoolean(map.getNamedItem("protomech").getTextContent()); + boolean isvariable = Boolean.parseBoolean(map.getNamedItem("isvariable").getTextContent()); + String name = null; + String description = null; + int cost = 0; + if (nodeQuirk != null) { + NodeList items = nodeQuirk.getChildNodes(); + for (int w = 0; w < items.getLength(); w++) { + if (items.item(w).getNodeName().equals("Name")) { + name = items.item(w).getTextContent(); + } + else if (items.item(w).getNodeName().equals("Cost")) { + // Backcompat for bug where quirks were saved with + or - prefixes + String costText = items.item(w).getTextContent().replaceAll( "[-+]", "" ); + cost = Integer.parseInt( costText ); + } + else if (items.item(w).getNodeName().equals("Description")) { + description = items.item(w).getTextContent(); + } + } + if (name != null && description != null && cost != 0) + { + quirks.add(new Quirk(name, postive, cost, battlemech, industrialmech, combatvehicle, battlearmor, aerospacefighter, conventionalfighter,dropship, + jumpship, warship, spacestation, protomech, isvariable, description)); + } + } + } + } + m.SetQuirks(quirks); } + n = d.getElementsByTagName( "jumpjet_model" ); + m.SetJJModel( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( n.item( 0 ).getTextContent() ) ) ); n = d.getElementsByTagName( "commsystem" ); - if( n.item( 0 ).getTextContent() == null ) { - m.SetCommSystem( "" ); - } else { - m.SetCommSystem( FileCommon.DecodeFluff( n.item( 0 ).getTextContent() ) ); - } + m.SetCommSystem( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( n.item( 0 ).getTextContent() ) ) ); n = d.getElementsByTagName( "tandtsystem" ); - if( n.item( 0 ).getTextContent() == null ) { - m.SetTandTSystem( "" ); - } else { - m.SetTandTSystem( FileCommon.DecodeFluff( n.item( 0 ).getTextContent() ) ); - } + m.SetTandTSystem( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( n.item( 0 ).getTextContent() ) ) ); // all done, return the CombatVehicle m.SetChanged( false ); @@ -1164,11 +1212,12 @@ private abPlaceable GetEquipmentByName( String name, String type, CombatVehicle name = FileCommon.LookupStripArc( name ); rear = true; } else if( name.substring( 0, 4 ).equals( "(T) " ) ) { - // turreted items are handled elsewhere, unfortunately. + // this is for mech turrets so shouldn't even exist, + // but handle it just in case name = FileCommon.LookupStripArc( name ); } } - if( ! name.contains( "(CL)" ) |! name.contains( "(IS)" ) ) { + if( ! name.contains( "(CL)" ) && ! name.contains( "(IS)" ) ) { // old style save file or an item that can be used by both techbases // we'll need to check. if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { @@ -1180,6 +1229,7 @@ private abPlaceable GetEquipmentByName( String name, String type, CombatVehicle if( type.equals( "energy" ) ) { boolean ppccap = false; boolean insulated = false; + boolean pulsemodule = false; if( name.contains( " + PPC Capacitor" ) ) { name = name.substring( 0, name.length() - 16 ); ppccap = true; @@ -1192,6 +1242,10 @@ private abPlaceable GetEquipmentByName( String name, String type, CombatVehicle name = name.substring( 0, name.length() - 12 ); insulated = true; } + if( name.contains(" + Pulse Module")) { + name = name.replace(" + Pulse Module", ""); + pulsemodule = true; + } if( name.contains( "Variable Speed Laser" ) ) { name = name.replace( "Variable Speed Laser", "Variable Speed Pulse Laser" ); } @@ -1203,6 +1257,7 @@ private abPlaceable GetEquipmentByName( String name, String type, CombatVehicle if( retval != null ) { ((RangedWeapon) retval).UseCapacitor( ppccap ); ((RangedWeapon) retval).UseInsulator( insulated ); + ((RangedWeapon) retval).UsePulseModule( pulsemodule); } } else if( type.equals( "ballistic" ) ) { boolean caseless = false; @@ -1289,6 +1344,7 @@ private abPlaceable GetEquipmentByName( String name, String type, CombatVehicle retval.MountRear( true ); } } catch( Exception e ) { + Messages += e.toString(); return null; } return retval; diff --git a/sswlib/src/main/java/filehandlers/CVTXTWriter.java b/sswlib/src/main/java/filehandlers/CVTXTWriter.java index 87463821..9da74f70 100644 --- a/sswlib/src/main/java/filehandlers/CVTXTWriter.java +++ b/sswlib/src/main/java/filehandlers/CVTXTWriter.java @@ -58,6 +58,7 @@ public CVTXTWriter() { } public CVTXTWriter( ArrayList<Force> forces ) { + this(); this.forces = forces; } @@ -111,14 +112,9 @@ public void WriteTXT( String filename ) throws IOException { FR.close(); } - public String GetChatStats( Mech m ) { - // a fun convenience routine for those who talk in chat or forums. - String retval = ""; - - // pondering some sort of GetChatName() for abplaceables. - retval += m.GetTonnage() + " tons, " + m.GetAdjustedWalkingMP( false, true ) + "/" + m.GetAdjustedRunningMP( false, true ) + "/" + m.GetAdjustedJumpingMP( false ); - - return retval; + public String GetChatStats( CombatVehicle m ) { + // !!! DO NOT USE THIS METHOD, INSTEAD UPDATE CombatVehicle.GetChatInfo(); + return ""; } public String GetTextExport() { @@ -148,20 +144,38 @@ public String GetTextExport() { retval += "Construction Options: Fractional Accounting" + NL + NL; } - //retval += "Chassis: " + CurVee.GetChassisModel() + " " + CurVee.GetIntStruc().CritName() + NL; - retval += "Power Plant: " + CurVee.GetEngineManufacturer() + " " + CurVee.GetEngine().GetRating() + " " + CurVee.GetEngine() + NL; - retval += "Cruise Speed: " + CommonTools.FormatSpeed( CurVee.getCruiseMP() * 10.8 ) + " km/h" + NL; - retval += "Flanking Speed: " + CommonTools.FormatSpeed( CurVee.getFlankMP() * 10.8 ) + " km/h" + NL; + //retval += "Chassis: " + ( IsUnknown( CurVee.GetChassisModel() ) ? "" : CurVee.GetChassisModel() + " " ) + " " + CurVee.GetIntStruc().CritName() + NL; + retval += "Power Plant: " + ( IsUnknown( CurVee.GetEngineManufacturer() ) ? "" : CurVee.GetEngineManufacturer() + " " ) + " " + CurVee.GetEngine().GetRating() + " " + CurVee.GetEngine() + NL; + //retval += "Cruise Speed: " + CommonTools.FormatSpeed( CurVee.GetAdjustedCruiseMP(false, true) * 10.8 ) + " km/h" + NL; + //retval += "Flanking Speed: " + CommonTools.FormatSpeed( CurVee.GetAdjustedFlankMP(false, true) * 10.8 ) + " km/h" + NL; + if( CurVee.GetAdjustedCruiseMP( false, true ) != CurVee.getCruiseMP() ) { + retval += "Cruise Speed: " + CommonTools.FormatSpeed( CurVee.getCruiseMP() * 10.8 ) + " km/h (" + CommonTools.FormatSpeed( CurVee.GetAdjustedCruiseMP( false, true ) * 10.8 ) + " km/h)" + NL; + } else { + retval += "Cruise Speed: " + CommonTools.FormatSpeed( CurVee.getCruiseMP() * 10.8 ) + " km/h" + NL; + } + if( CurVee.GetAdjustedFlankMP( false, true ) != CurVee.getFlankMP() ) { + retval += "Maximum Speed: " + CommonTools.FormatSpeed( CurVee.getFlankMP() * 10.8 ) + " km/h (" + CommonTools.FormatSpeed( CurVee.GetAdjustedFlankMP( false, true ) * 10.8 ) + " km/h)" + NL; + } else { + retval += "Maximum Speed: " + CommonTools.FormatSpeed( CurVee.getFlankMP() * 10.8 ) + " km/h" + NL; + } if ( CurVee.GetJumpJets().GetNumJJ() > 0 ) { - retval += "Jump Jets: " + CurVee.GetJJModel() + NL; + String jjModel = CurVee.GetJJModel(); + jjModel = ( IsUnknown( jjModel ) ? "" : jjModel + " " ) + GetJumpJetTypeLine(); + retval += "Jump Jets: " + jjModel + NL; retval += " Jump Capacity: " + GetJumpJetDistanceLine() + NL; } - retval += "Armor: " + CurVee.GetArmorModel() + " " + CurVee.GetArmor().CritName() + NL; + String armorModel = CurVee.GetArmorModel(); + retval += "Armor: " + ( IsUnknown( armorModel ) ? "" : armorModel + " " ) + " " + CurVee.GetArmor().CritName() + NL; retval += "Armament:" + NL; retval += GetArmament(); - retval += "Manufacturer: " + CurVee.GetCompany() + NL; - retval += " Primary Factory: " + CurVee.GetLocation() + NL; - retval += BuildComputerBlock() + NL + NL; + if ( ! IsUnknown( CurVee.GetCompany() ) ) { + retval += "Manufacturer: " + CurVee.GetCompany() + NL; + if ( ! IsUnknown( CurVee.GetLocation() ) ) { + retval += " Primary Factory: " + CurVee.GetLocation() + NL; + } + } + retval += BuildComputerBlock(); + retval += NL; // retval += "================================================================================" + NL; if( ! CurVee.getOverview().equals( "" ) ) { retval += "Overview:" + NL; @@ -214,8 +228,18 @@ public String GetMiniTextExport() { retval += "--------------------------------------------------------------------------------" + NL; retval += String.format( "Internal Structure: %1$-28s %2$3s points %3" + tformat, CurVee.GetIntStruc().CritName(), CurVee.GetIntStruc().GetTotalPoints(), CurVee.GetIntStruc().GetTonnage() ) + NL; retval += String.format( "Engine: %1$-28s %2$3s %3" + tformat, FileCommon.GetExportName( CurVee, CurVee.GetEngine() ), CurVee.GetEngine().GetRating(), CurVee.GetEngine().GetTonnage() ) + NL; - retval += " Cruise MP: " + CurVee.getCruiseMP() + NL; - retval += " Flank MP: " + CurVee.getFlankMP() + NL; +// retval += " Cruise MP: " + CurVee.GetAdjustedCruiseMP(false, true) + NL; +// retval += " Flank MP: " + CurVee.GetAdjustedFlankMP(false, true) + NL; + if( CurVee.GetAdjustedCruiseMP( false, true ) != CurVee.getCruiseMP() ) { + retval += "Cruise MP: " + CommonTools.FormatSpeed( CurVee.getCruiseMP() ) + " (" + CommonTools.FormatSpeed( CurVee.GetAdjustedCruiseMP( false, true ) ) + ")" + NL; + } else { + retval += "Cruise MP: " + CommonTools.FormatSpeed( CurVee.getCruiseMP() ) + NL; + } + if( CurVee.GetAdjustedFlankMP( false, true ) != CurVee.getFlankMP() ) { + retval += "Flank MP: " + CommonTools.FormatSpeed( CurVee.getFlankMP() ) + " (" + CommonTools.FormatSpeed( CurVee.GetAdjustedFlankMP( false, true ) ) + ")" + NL; + } else { + retval += "Flank MP: " + CommonTools.FormatSpeed( CurVee.getFlankMP() ) + NL; + } if( CurVee.GetJumpJets().GetNumJJ() > 0 ) { retval += " Jumping MP: " + GetJumpingMPLine() + " " + GetJumpJetTypeLine() + NL; retval += String.format( " %1$-68s %2$6.2f", "Jump Jet Locations: " + FileCommon.GetJumpJetLocations( CurVee ), CurVee.GetJumpJets().GetTonnage() ) + NL; @@ -488,7 +512,8 @@ private String BuildEquipmentBlock() { //v.add( CurVee.GetTC() ); } if( CurVee.GetLoadout().HasSupercharger() ) { - v.add( CurVee.GetLoadout().GetSupercharger() ); + //don't add as we already have it in the Body + //v.add( CurVee.GetLoadout().GetSupercharger() ); } if( v.size() < 1 ) { return ""; } @@ -644,9 +669,9 @@ private String BuildOmniLoadout() { //don't add as we already have it in the Body of the Vehicle //v.add( CurVee.GetTC() ); } - if( CurVee.GetLoadout().HasSupercharger() ) { - v.add( CurVee.GetLoadout().GetSupercharger() ); - } +// if( CurVee.GetLoadout().HasSupercharger() ) { +// v.add( CurVee.GetLoadout().GetSupercharger() ); +// } // now sort the equipment by location v = FileCommon.SortEquipmentForStats( CurVee, v ); @@ -766,7 +791,7 @@ private String BuildComputerBlock() { retval += NL; */ // start targeting and tracking system line - retval += "Targeting and Tracking System: " + CurVee.GetTandTSystem(); + retval += "Targeting and Tracking System: " + CurVee.GetTandTSystem() + NL; /* if( ! ( BAP instanceof EmptyItem ) ) { if( CurVee.UsingTC() ) { retval += NL + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName() + NL + " and " + CurVee.GetTC().GetCritName(); @@ -925,6 +950,9 @@ private String GetJumpJetTypeLine() { } } } + if( CurVee.GetJumpJets().IsProto() ) { + retval += " (Prototype)"; + } return retval; } @@ -1097,4 +1125,8 @@ public String CSVFormat( String data ) { else return data + ","; } + + private boolean IsUnknown( String str ) { + return str.isEmpty() || str.equalsIgnoreCase( "Unknown" ) || str.equalsIgnoreCase( "None" ); + } } diff --git a/sswlib/src/main/java/filehandlers/CVWriter.java b/sswlib/src/main/java/filehandlers/CVWriter.java index 7b6ba129..3692ad87 100644 --- a/sswlib/src/main/java/filehandlers/CVWriter.java +++ b/sswlib/src/main/java/filehandlers/CVWriter.java @@ -32,6 +32,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.io.StringWriter; import java.util.ArrayList; import common.*; import battleforce.BattleForceStats; @@ -51,16 +52,24 @@ public CVWriter( CombatVehicle v ) { } public void WriteXML( String filename ) throws IOException { - //BufferedWriter FR = new BufferedWriter( new FileWriter( filename ) ); - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + StringWriter stringWriter = new StringWriter(); + BufferedWriter FR = new BufferedWriter( stringWriter ); // beginning of an XML file: FR.write( "<?xml version=\"1.0\" encoding =\"UTF-8\"?>" ); FR.newLine(); - WriteXML(FR); + try { + WriteXML(FR); + } catch ( RuntimeException e ) { + throw new IOException( e ); + } FR.close(); + + try( OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ) { + writer.write(stringWriter.toString()); + } } public void WriteXML( BufferedWriter FR ) throws IOException { @@ -165,7 +174,14 @@ public void WriteXML( BufferedWriter FR ) throws IOException { if( CurUnit.IsOmni() ) { CurUnit.SetCurLoadout( common.Constants.BASELOADOUT_NAME ); } - FR.write( tab + "<baseloadout fcsa4=\"" + FileCommon.GetBoolean( CurUnit.UsingArtemisIV() ) + "\" fcsa5=\"" + FileCommon.GetBoolean( CurUnit.UsingArtemisV() ) + "\" fcsapollo=\"" + FileCommon.GetBoolean( CurUnit.UsingApollo() ) + "\" turretlimit=\"" + CurUnit.GetBaseLoadout().GetTurret().GetMaxTonnage() + "\" >" ); + FR.write( tab + "<baseloadout fcsa4=\"" + FileCommon.GetBoolean( CurUnit.UsingArtemisIV() ) + "\" fcsa5=\"" + FileCommon.GetBoolean( CurUnit.UsingArtemisV() ) + "\" fcsapollo=\"" + FileCommon.GetBoolean( CurUnit.UsingApollo() ) + "\""); + if( CurUnit.GetLoadout().GetTurret().isTonnageSet() ) { + FR.write( " turretlimit=\"" + CurUnit.GetLoadout().GetTurret().GetMaxTonnage() + "\""); + } + if( CurUnit.GetLoadout().GetRearTurret().isTonnageSet() ) { + FR.write( " rearturretlimit=\"" + CurUnit.GetLoadout().GetRearTurret().GetMaxTonnage() + "\"" ); + } + FR.write( ">" ); FR.newLine(); FR.write( tab + tab + "<source>" + FileCommon.EncodeFluff( CurUnit.getSource() ) + "</source>" ); @@ -175,6 +191,9 @@ public void WriteXML( BufferedWriter FR ) throws IOException { FR.write( tab + tab + "<info>" + CurUnit.GetChatInfo() + "</info>" ); FR.newLine(); + FR.write( tab + tab + "<clancase>" + FileCommon.GetBoolean( CurUnit.GetLoadout().IsUsingClanCASE() ) + "</clancase>" ); + FR.newLine(); + BattleForceStats stat = new BattleForceStats(CurUnit); stat.SerializeXML(FR, 2); FR.newLine(); @@ -243,8 +262,8 @@ public void WriteXML( BufferedWriter FR ) throws IOException { FR.newLine(); FR.write( tab + tab + "<cost>" + CurUnit.GetTotalCost() + "</cost>" ); FR.newLine(); - //FR.write( tab + tab + "<clancase>" + FileCommon.GetBoolean( CurUnit.GetLoadout().IsUsingClanCASE() ) + "</clancase>" ); - //FR.newLine(); + FR.write( tab + tab + "<clancase>" + FileCommon.GetBoolean( CurUnit.GetLoadout().IsUsingClanCASE() ) + "</clancase>" ); + FR.newLine(); if( CurUnit.GetJumpJets().GetNumJJ() > CurUnit.GetJumpJets().GetBaseLoadoutNumJJ() ) { FR.write( tab + tab + "<jumpjets number=\"" + CurUnit.GetJumpJets().GetNumJJ() + "\">" ); FR.newLine(); @@ -263,7 +282,7 @@ public void WriteXML( BufferedWriter FR ) throws IOException { FR.newLine(); } FR.write( GetEquipmentLines( tab + tab ) ); - if( CurUnit.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( CurUnit.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { // check for armored components FR.write( GetArmoredLocations( tab + tab ) ); } @@ -289,6 +308,32 @@ public void WriteXML( BufferedWriter FR ) throws IOException { FR.newLine(); FR.write( tab + tab + "<additional>" + FileCommon.EncodeFluff( CurUnit.GetAdditional() ) + "</additional>" ); FR.newLine(); + if (CurUnit.GetQuirks().size() > 0) + { + FR.write(tab + tab + "<quirks>"); + FR.newLine(); + for (Quirk quirk : CurUnit.GetQuirks()) + { + FR.write(tab + tab + tab + "<quirk postive=\"" + Boolean.toString(quirk.isPositive())+"\" battlemech=\"" + Boolean.toString(quirk.isBattlemech()) + + "\" industrialmech=\"" + Boolean.toString(quirk.isIndustrialmech()) + "\" combatvehicle=\"" + Boolean.toString(quirk.isCombatvehicle()) + + "\" battlearmor=\"" + Boolean.toString(quirk.isBattlearmor()) + "\" aerospacefighter=\"" + Boolean.toString(quirk.isAerospacefighter()) + + "\" conventionalfigher=\"" + Boolean.toString(quirk.isConventionalfighter()) + "\" dropship=\"" + Boolean.toString(quirk.isDropship()) + + "\" jumpship=\"" + Boolean.toString(quirk.isDropship()) + "\" warship=\"" + Boolean.toString(quirk.isWarship()) + + "\" spacestation=\"" + Boolean.toString(quirk.isSpacestation()) + "\" protomech=\"" + Boolean.toString(quirk.isProtomech()) + + "\" isvariable=\"" + Boolean.toString(quirk.isVariable()) + "\">"); + FR.newLine(); + FR.write(tab + tab + tab + tab + "<Name>" + FileCommon.EncodeFluff(quirk.getName()) + "</Name>"); + FR.newLine(); + FR.write(tab + tab + tab + tab + "<Cost>" + quirk.getCost() + "</Cost>"); + FR.newLine(); + FR.write(tab + tab + tab + tab + "<Description>" + FileCommon.EncodeFluff(quirk.getDescription()) + "</Description>"); + FR.newLine(); + FR.write(tab + tab + tab + "</quirk>"); + FR.newLine(); + } + FR.write(tab + tab + "</quirks>"); + FR.newLine(); + } FR.write( tab + tab + "<jumpjet_model>" + FileCommon.EncodeFluff( CurUnit.GetJJModel() ) + "</jumpjet_model>" ); FR.newLine(); FR.write( tab + tab + "<commsystem>" + FileCommon.EncodeFluff( CurUnit.GetCommSystem() ) + "</commsystem>" ); @@ -407,6 +452,9 @@ private String GetEquipmentLines( String prefix ) { retval += prefix + tab + "<vglammo>" + ((VehicularGrenadeLauncher) p).GetAmmoType() + "</vglammo>" + NL; } if( p instanceof Equipment ) { + if (CurUnit.GetTechbase() != ((Equipment)p).GetCurrentTech()) { + retval += prefix + tab + "<techbase>" + CommonTools.GetTechbaseString(((Equipment)p).GetCurrentTech()) + "</techbase>" + NL; + } if( ((Equipment) p).IsVariableSize() ) { retval += prefix + tab + "<tons>" + ((Equipment)p).GetTonnage(false) + "</tons>" + NL; } @@ -430,14 +478,14 @@ private String GetEquipmentLines( String prefix ) { retval += prefix + "</equipment>" + NL; } */ - if( CurUnit.GetLoadout().HasSupercharger() ) { - abPlaceable p = (abPlaceable) CurUnit.GetLoadout().GetSupercharger(); - retval += prefix + "<equipment>" + NL; - retval += prefix + tab + "<name manufacturer=\"\">Supercharger</name>" + NL; - retval += prefix + tab + "<type>Supercharger</type>" + NL; - retval += GetLocationLines( prefix + tab, p ); - retval += prefix + "</equipment>" + NL; - } +// if( CurUnit.GetLoadout().HasSupercharger() ) { +// abPlaceable p = (abPlaceable) CurUnit.GetLoadout().GetSupercharger(); +// retval += prefix + "<equipment>" + NL; +// retval += prefix + tab + "<name manufacturer=\"\">Supercharger</name>" + NL; +// retval += prefix + tab + "<type>Supercharger</type>" + NL; +// retval += GetLocationLines( prefix + tab, p ); +// retval += prefix + "</equipment>" + NL; +// } return retval; } @@ -462,13 +510,11 @@ private String GetEquipmentType( abPlaceable p ) { } else if( p instanceof PhysicalWeapon ) { return "physical"; } else if( p instanceof Equipment ) { - return "equipment"; + return ((Equipment)p).GetEquipmentType(); } else if( p instanceof Ammunition ) { return "ammunition"; } else if( p instanceof TargetingComputer ) { return "TargetingComputer"; - } else if ( p instanceof CASE ) { - return "CASE"; } else { return "miscellaneous"; } diff --git a/sswlib/src/main/java/filehandlers/MechReader.java b/sswlib/src/main/java/filehandlers/MechReader.java index 489a68ac..657b266d 100644 --- a/sswlib/src/main/java/filehandlers/MechReader.java +++ b/sswlib/src/main/java/filehandlers/MechReader.java @@ -420,8 +420,8 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { } else if( n.item( 0 ).getTextContent().equals( AvailableCode.TechBaseSTR[AvailableCode.TECH_BOTH] ) ) { m.SetMixed(); } - m.SetCompany( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); - m.SetLocation( FileCommon.DecodeFluff( map.getNamedItem( "location" ).getTextContent() ) ); + m.SetCompany( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); + m.SetLocation( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "location" ).getTextContent() ) ) ); n = d.getElementsByTagName( "year" ); map = n.item( 0 ).getAttributes(); m.SetYear( Integer.parseInt( n.item( 0 ).getTextContent() ), true ); @@ -479,7 +479,7 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { m.Visit( v ); } m.SetEngineRating( Integer.parseInt( map.getNamedItem( "rating" ).getTextContent() ) ); - m.SetEngineManufacturer( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); + m.SetEngineManufacturer( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); n = d.getElementsByTagName( "cockpit" ); v = m.Lookup( n.item( 0 ).getTextContent() ); @@ -557,7 +557,7 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { m.Visit( v ); } } - m.SetChassisModel( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); + m.SetChassisModel( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); // base loadout // get the actuators first since that will complete the structural components @@ -730,7 +730,7 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { for( int j = 0; j < nl.getLength(); j++ ) { if( nl.item( j ).getNodeName().equals( "name" ) ) { map = nl.item( j ).getAttributes(); - eMan = map.getNamedItem( "manufacturer" ).getTextContent(); + eMan = CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ); eName = nl.item( j ).getTextContent(); } else if( nl.item( j ).getNodeName().equals( "type" ) ) { eType = nl.item( j ).getTextContent(); @@ -820,86 +820,80 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { if (eName.equals("Drone Operating System")) {m.AddDroneOS();} if( p == null ) { - throw new Exception( "Could not find " + eName + " as a piece of equipment.\nThe Mech cannot be loaded." ); + Messages += "Could not find " + eName + " as a piece of equipment.\n"; + continue; } - p.SetManufacturer( eMan ); - if( p instanceof Equipment ) { - if( ((Equipment) p).IsVariableSize() ) { - ((Equipment) p).SetTonnage( vtons ); - } - } - if( ( p instanceof Ammunition ) && lotsize > 0 ) { - ((Ammunition) p).SetLotSize( lotsize ); - } - if( p.CanSplit() ) { - if( splitLoc.size() > 0 ) { - m.GetLoadout().AddToQueue( p ); - // have to do a hack here because we're using non-standard - // allocation methods. - m.GetLoadout().RemoveFromQueue( p ); - for( int j = 0; j < splitLoc.size(); j++ ) { - LocationIndex li = (LocationIndex) splitLoc.get( j ); - m.GetLoadout().AddTo( m.GetLoadout().GetCrits( li.Location ), p, li.Index, li.Number ); + try { + p.SetManufacturer( eMan ); + if( p instanceof Equipment ) { + if( ((Equipment) p).IsVariableSize() ) { + ((Equipment) p).SetTonnage( vtons ); } - } else { - m.GetLoadout().AddToQueue( p ); - m.GetLoadout().AddTo( p, l.Location, l.Index ); } - } else { - if( p instanceof Talons ) { - p.Place( m.GetLoadout() ); - } else { - m.GetLoadout().AddToQueue( p ); - m.GetLoadout().AddTo( p, l.Location, l.Index ); + if( ( p instanceof Ammunition ) && lotsize > 0 ) { + ((Ammunition) p).SetLotSize( lotsize ); } - if( turreted ) { - if( l.Location == LocationIndex.MECH_LOC_HD ) { - if( ( p instanceof RangedWeapon ) || ( p instanceof MGArray ) ) { - if( ! m.GetLoadout().HasHDTurret() ) { - throw new Exception( "A weapon was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); - } - if( p instanceof MGArray ) { - ((MGArray) p).AddToTurret( m.GetLoadout().GetHDTurret() ); - } else { - ((RangedWeapon) p).AddToTurret( m.GetLoadout().GetHDTurret() ); - } - } else { - throw new Exception( "An item that is not a weapon was specified as turreted\nbut only weapons can be turreted.\nThe 'Mech cannot be loaded." ); + if( p.CanSplit() ) { + if( splitLoc.size() > 0 ) { + m.GetLoadout().AddToQueue( p ); + // have to do a hack here because we're using non-standard + // allocation methods. + m.GetLoadout().RemoveFromQueue( p ); + for( int j = 0; j < splitLoc.size(); j++ ) { + LocationIndex li = (LocationIndex) splitLoc.get( j ); + m.GetLoadout().AddTo( m.GetLoadout().GetCrits( li.Location ), p, li.Index, li.Number ); } - } else if( l.Location == LocationIndex.MECH_LOC_LT ) { - if( ( p instanceof RangedWeapon ) || ( p instanceof MGArray ) ) { - if( ! m.GetLoadout().HasLTTurret() ) { - throw new Exception( "A weapon was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); - } - if( p instanceof MGArray ) { - ((MGArray) p).AddToTurret( m.GetLoadout().GetLTTurret() ); + } else { + m.GetLoadout().AddToQueue( p ); + m.GetLoadout().AddTo( p, l.Location, l.Index ); + } + } else { + if( p instanceof Talons ) { + p.Place( m.GetLoadout() ); + } else { + m.GetLoadout().AddToQueue( p ); + m.GetLoadout().AddTo( p, l.Location, l.Index ); + } + if( turreted ) { + if( l.Location == LocationIndex.MECH_LOC_HD ) { + if( p.CanMountTurret() ) { + if( ! m.GetLoadout().HasHDTurret() ) { + throw new Exception( "An item was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } + p.MountTurret( m.GetLoadout().GetHDTurret() ); } else { - ((RangedWeapon) p).AddToTurret( m.GetLoadout().GetLTTurret() ); + throw new Exception( "A non-turret-mountable item was specified as turreted.\nThe 'Mech cannot be loaded." ); } - } else { - throw new Exception( "An item that is not a weapon was specified as turreted\nbut only weapons can be turreted.\nThe 'Mech cannot be loaded." ); - } - } else if( l.Location == LocationIndex.MECH_LOC_RT ) { - if( ( p instanceof RangedWeapon ) || ( p instanceof MGArray ) ) { - if( ! m.GetLoadout().HasRTTurret() ) { - throw new Exception( "A weapon was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } else if( l.Location == LocationIndex.MECH_LOC_LT ) { + if( p.CanMountTurret() ) { + if( ! m.GetLoadout().HasLTTurret() ) { + throw new Exception( "An item was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } + p.MountTurret( m.GetLoadout().GetLTTurret() ); + } else { + throw new Exception( "A non-turret-mountable item was specified as turreted.\nThe 'Mech cannot be loaded." ); } - if( p instanceof MGArray ) { - ((MGArray) p).AddToTurret( m.GetLoadout().GetRTTurret() ); + } else if( l.Location == LocationIndex.MECH_LOC_RT ) { + if( p.CanMountTurret() ) { + if( ! m.GetLoadout().HasRTTurret() ) { + throw new Exception( "An item was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } + p.MountTurret( m.GetLoadout().GetRTTurret() ); } else { - ((RangedWeapon) p).AddToTurret( m.GetLoadout().GetRTTurret() ); + throw new Exception( "A non-turret-mountable item was specified as turreted.\nThe 'Mech cannot be loaded." ); } } else { - throw new Exception( "An item that is not a weapon was specified as turreted\nbut only weapons can be turreted.\nThe 'Mech cannot be loaded." ); + throw new Exception( "A item was specified as turreted, but it is\nnot in a location that can have a turret.\nThe 'Mech cannot be loaded." ); } - } else { - throw new Exception( "A weapon was specified as turreted, but it is\nnot in a location that can have a turret.\nThe 'Mech cannot be loaded." ); } } - } - if( p instanceof VehicularGrenadeLauncher ) { - ((VehicularGrenadeLauncher) p).SetArc( VGLArc ); - ((VehicularGrenadeLauncher) p).SetAmmoType( VGLAmmo ); + if( p instanceof VehicularGrenadeLauncher ) { + ((VehicularGrenadeLauncher) p).SetArc( VGLArc ); + ((VehicularGrenadeLauncher) p).SetAmmoType( VGLAmmo ); + } + } catch( Exception e ) { + Messages += e.toString(); + continue; } } } else if( n.item( i ).getNodeName().equals( "armored_locations" ) ) { @@ -1037,7 +1031,7 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { String pwtype = ""; int pwtech = 0; boolean oldfile = false, clanarmor = false; - m.SetArmorModel( FileCommon.DecodeFluff( map.getNamedItem( "manufacturer" ).getTextContent() ) ); + m.SetArmorModel( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ) ) ); if( map.getNamedItem( "techbase" ) == null ) { // old style save file, set the armor based on the 'Mech's techbase if( m.GetBaseTechbase() == AvailableCode.TECH_CLAN ) { @@ -1498,7 +1492,7 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { for( int j = 0; j < nl.getLength(); j++ ) { if( nl.item( j ).getNodeName().equals( "name" ) ) { map = nl.item( j ).getAttributes(); - eMan = map.getNamedItem( "manufacturer" ).getTextContent(); + eMan = CommonTools.UnknownToEmpty( map.getNamedItem( "manufacturer" ).getTextContent() ); eName = nl.item( j ).getTextContent(); } else if( nl.item( j ).getNodeName().equals( "type" ) ) { eType = nl.item( j ).getTextContent(); @@ -1585,86 +1579,80 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { } abPlaceable p = GetEquipmentByName( eName, eType, m ); if( p == null ) { - throw new Exception( "Could not find " + eName + " as a piece of equipment.\nThe Mech cannot be loaded." ); - } - p.SetManufacturer( eMan ); - if( p instanceof Equipment ) { - if( ((Equipment) p).IsVariableSize() ) { - ((Equipment) p).SetTonnage( vtons ); - } - } - if( ( p instanceof Ammunition ) && lotsize > 0 ) { - ((Ammunition) p).SetLotSize( lotsize ); + Messages += "Could not find " + eName + " as a piece of equipment.\n"; + continue; } - if( p.CanSplit() ) { - if( splitLoc.size() > 0 ) { - m.GetLoadout().AddToQueue( p ); - // have to do a hack here because we're using non-standard - // allocation methods. - m.GetLoadout().RemoveFromQueue( p ); - for( int j = 0; j < splitLoc.size(); j++ ) { - LocationIndex li = (LocationIndex) splitLoc.get( j ); - m.GetLoadout().AddTo( m.GetLoadout().GetCrits( li.Location ), p, li.Index, li.Number ); + try { + p.SetManufacturer( eMan ); + if( p instanceof Equipment ) { + if( ((Equipment) p).IsVariableSize() ) { + ((Equipment) p).SetTonnage( vtons ); } - } else { - m.GetLoadout().AddToQueue( p ); - m.GetLoadout().AddTo( p, l.Location, l.Index ); } - } else { - if( p instanceof Talons ) { - if( ! p.Place( m.GetLoadout() ) ) { - throw new Exception( "Talons cannot be added to the 'Mech because there is no available space." ); + if( ( p instanceof Ammunition ) && lotsize > 0 ) { + ((Ammunition) p).SetLotSize( lotsize ); + } + if( p.CanSplit() ) { + if( splitLoc.size() > 0 ) { + m.GetLoadout().AddToQueue( p ); + // have to do a hack here because we're using non-standard + // allocation methods. + m.GetLoadout().RemoveFromQueue( p ); + for( int j = 0; j < splitLoc.size(); j++ ) { + LocationIndex li = (LocationIndex) splitLoc.get( j ); + m.GetLoadout().AddTo( m.GetLoadout().GetCrits( li.Location ), p, li.Index, li.Number ); + } + } else { + m.GetLoadout().AddToQueue( p ); + m.GetLoadout().AddTo( p, l.Location, l.Index ); } } else { - m.GetLoadout().AddToQueue( p ); - m.GetLoadout().AddTo( p, l.Location, l.Index ); - } - if( turreted ) { - if( l.Location == LocationIndex.MECH_LOC_HD ) { - if( ( p instanceof RangedWeapon ) || ( p instanceof MGArray ) ) { - if( ! m.GetLoadout().HasHDTurret() ) { - throw new Exception( "A weapon was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); - } - if( p instanceof MGArray ) { - ((MGArray) p).AddToTurret( m.GetLoadout().GetHDTurret() ); - } else { - ((RangedWeapon) p).AddToTurret( m.GetLoadout().GetHDTurret() ); - } - } else { - throw new Exception( "An item that is not a weapon was specified as turreted\nbut only weapons can be turreted.\nThe 'Mech cannot be loaded." ); + if( p instanceof Talons ) { + if( ! p.Place( m.GetLoadout() ) ) { + throw new Exception( "Talons cannot be added to the 'Mech because there is no available space." ); } - } else if( l.Location == LocationIndex.MECH_LOC_LT ) { - if( ( p instanceof RangedWeapon ) || ( p instanceof MGArray ) ) { - if( ! m.GetLoadout().HasLTTurret() ) { - throw new Exception( "A weapon was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); - } - if( p instanceof MGArray ) { - ((MGArray) p).AddToTurret( m.GetLoadout().GetLTTurret() ); + } else { + m.GetLoadout().AddToQueue( p ); + m.GetLoadout().AddTo( p, l.Location, l.Index ); + } + if( turreted ) { + if( l.Location == LocationIndex.MECH_LOC_HD ) { + if( p.CanMountTurret() ) { + if( ! m.GetLoadout().HasHDTurret() ) { + throw new Exception( "An item was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } + p.MountTurret( m.GetLoadout().GetHDTurret() ); } else { - ((RangedWeapon) p).AddToTurret( m.GetLoadout().GetLTTurret() ); + throw new Exception( "A non-turret-mountable item was specified as turreted.\nThe 'Mech cannot be loaded." ); } - } else { - throw new Exception( "An item that is not a weapon was specified as turreted\nbut only weapons can be turreted.\nThe 'Mech cannot be loaded." ); - } - } else if( l.Location == LocationIndex.MECH_LOC_RT ) { - if( ( p instanceof RangedWeapon ) || ( p instanceof MGArray ) ) { - if( ! m.GetLoadout().HasRTTurret() ) { - throw new Exception( "A weapon was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } else if( l.Location == LocationIndex.MECH_LOC_LT ) { + if( p.CanMountTurret() ) { + if( ! m.GetLoadout().HasLTTurret() ) { + throw new Exception( "An item was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } + p.MountTurret( m.GetLoadout().GetLTTurret() ); + } else { + throw new Exception( "A non-turret-mountable item was specified as turreted.\nThe 'Mech cannot be loaded." ); } - if( p instanceof MGArray ) { - ((MGArray) p).AddToTurret( m.GetLoadout().GetRTTurret() ); + } else if( l.Location == LocationIndex.MECH_LOC_RT ) { + if( p.CanMountTurret() ) { + if( ! m.GetLoadout().HasRTTurret() ) { + throw new Exception( "An item was specified as turreted but there is no\nturret that it can legally be added to.\nThe 'Mech cannot be loaded." ); + } + p.MountTurret( m.GetLoadout().GetRTTurret() ); } else { - ((RangedWeapon) p).AddToTurret( m.GetLoadout().GetRTTurret() ); + throw new Exception( "A non-turret-mountable item was specified as turreted.\nThe 'Mech cannot be loaded." ); } - } else { - throw new Exception( "An item that is not a weapon was specified as turreted\nbut only weapons can be turreted.\nThe 'Mech cannot be loaded." ); } } } - } - if( p instanceof VehicularGrenadeLauncher ) { - ((VehicularGrenadeLauncher) p).SetArc( VGLArc ); - ((VehicularGrenadeLauncher) p).SetAmmoType( VGLAmmo ); + if( p instanceof VehicularGrenadeLauncher ) { + ((VehicularGrenadeLauncher) p).SetArc( VGLArc ); + ((VehicularGrenadeLauncher) p).SetAmmoType( VGLAmmo ); + } + } catch( Exception e ) { + Messages += e.toString(); + continue; } } } else if( n.item( i ).getNodeName().equals( "armored_locations" ) ) { @@ -1782,13 +1770,15 @@ private Mech BuildMech( Mech m, Document d, DataFactory f ) throws Exception { name = items.item(w).getTextContent(); } else if (items.item(w).getNodeName().equals("Cost")) { - cost = Integer.parseInt(items.item(w).getTextContent()); + // Backcompat for bug where quirks were with + or - prefixes + String costText = items.item(w).getTextContent().replaceAll( "[-+]", "" ); + cost = Integer.parseInt( costText ); } else if (items.item(w).getNodeName().equals("Description")) { description = items.item(w).getTextContent(); } } - if (name != null && description != null && cost != 0) + if (name != null && description != null) { quirks.add(new Quirk(name, postive, cost, battlemech, industrialmech, combatvehicle, battlearmor, aerospacefighter, conventionalfighter,dropship, jumpship, warship, spacestation, protomech, isvariable, description)); @@ -1799,23 +1789,11 @@ else if (items.item(w).getNodeName().equals("Description")) { m.SetQuirks(quirks); } n = d.getElementsByTagName( "jumpjet_model" ); - if( n.item( 0 ).getTextContent() == null ) { - m.SetJJModel( "" ); - } else { - m.SetJJModel( FileCommon.DecodeFluff( n.item( 0 ).getTextContent() ) ); - } + m.SetJJModel( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( n.item( 0 ).getTextContent() ) ) ); n = d.getElementsByTagName( "commsystem" ); - if( n.item( 0 ).getTextContent() == null ) { - m.SetCommSystem( "" ); - } else { - m.SetCommSystem( FileCommon.DecodeFluff( n.item( 0 ).getTextContent() ) ); - } + m.SetCommSystem( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( n.item( 0 ).getTextContent() ) ) ); n = d.getElementsByTagName( "tandtsystem" ); - if( n.item( 0 ).getTextContent() == null ) { - m.SetTandTSystem( "" ); - } else { - m.SetTandTSystem( FileCommon.DecodeFluff( n.item( 0 ).getTextContent() ) ); - } + m.SetTandTSystem( FileCommon.DecodeFluff( CommonTools.UnknownToEmpty( n.item( 0 ).getTextContent() ) ) ); // all done, return the mech m.SetChanged( false ); @@ -1852,11 +1830,12 @@ private abPlaceable GetEquipmentByName( String name, String type, Mech m ) { name = FileCommon.LookupStripArc( name ); rear = true; } else if( name.substring( 0, 4 ).equals( "(T) " ) ) { - // turreted items are handled elsewhere, unfortunately. + // turreted items are handled elsewhere due to dependency on + // separate equipment (the mech turret itself) name = FileCommon.LookupStripArc( name ); } } - if( ! name.contains( "(CL)" ) |! name.contains( "(IS)" ) ) { + if( ! name.contains( "(CL)" ) && ! name.contains( "(IS)" ) ) { // old style save file or an item that can be used by both techbases // we'll need to check. if( m.GetTechbase() == AvailableCode.TECH_CLAN ) { @@ -1868,6 +1847,7 @@ private abPlaceable GetEquipmentByName( String name, String type, Mech m ) { if( type.equals( "energy" ) ) { boolean ppccap = false; boolean insulated = false; + boolean pulsemodule = false; if( name.contains( " + PPC Capacitor" ) ) { name = name.substring( 0, name.length() - 16 ); ppccap = true; @@ -1880,6 +1860,10 @@ private abPlaceable GetEquipmentByName( String name, String type, Mech m ) { name = name.substring( 0, name.length() - 12 ); insulated = true; } + if( name.contains(" + Pulse Module")) { + name = name.replace(" + Pulse Module", ""); + pulsemodule = true; + } if( name.contains( "Variable Speed Laser" ) ) { name = name.replace( "Variable Speed Laser", "Variable Speed Pulse Laser" ); } @@ -1891,6 +1875,7 @@ private abPlaceable GetEquipmentByName( String name, String type, Mech m ) { if( retval != null ) { ((RangedWeapon) retval).UseCapacitor( ppccap ); ((RangedWeapon) retval).UseInsulator( insulated ); + ((RangedWeapon) retval).UsePulseModule( pulsemodule); } } else if( type.equals( "ballistic" ) ) { boolean caseless = false; @@ -1977,6 +1962,7 @@ private abPlaceable GetEquipmentByName( String name, String type, Mech m ) { retval.MountRear( true ); } } catch( Exception e ) { + Messages += e.toString(); return null; } return retval; diff --git a/sswlib/src/main/java/filehandlers/MechWriter.java b/sswlib/src/main/java/filehandlers/MechWriter.java index 0dee8ead..64630272 100644 --- a/sswlib/src/main/java/filehandlers/MechWriter.java +++ b/sswlib/src/main/java/filehandlers/MechWriter.java @@ -32,6 +32,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.io.StringWriter; import java.util.ArrayList; import common.*; import battleforce.BattleForceStats; @@ -51,16 +52,24 @@ public MechWriter( Mech m ) { } public void WriteXML( String filename ) throws IOException { - //BufferedWriter FR = new BufferedWriter( new FileWriter( filename ) ); - BufferedWriter FR = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ); + StringWriter stringWriter = new StringWriter(); + BufferedWriter FR = new BufferedWriter( stringWriter ); // beginning of an XML file: FR.write( "<?xml version=\"1.0\" encoding =\"UTF-8\"?>" ); FR.newLine(); - WriteXML(FR); + try { + WriteXML(FR); + } catch ( RuntimeException e ) { + throw new IOException( e ); + } FR.close(); + + try( OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( filename ), "UTF-8" ) ) { + writer.write(stringWriter.toString()); + } } public void WriteXML( BufferedWriter FR ) throws IOException { @@ -385,7 +394,7 @@ public void WriteXML( BufferedWriter FR ) throws IOException { FR.newLine(); } FR.write( GetEquipmentLines( tab + tab ) ); - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( CurMech.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { // check for armored components FR.write( GetArmoredLocations( tab + tab ) ); } @@ -469,7 +478,7 @@ public void WriteXML( BufferedWriter FR ) throws IOException { FR.newLine(); } FR.write( GetEquipmentLines( tab + tab ) ); - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( CurMech.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { // check for armored components FR.write( GetArmoredLocations( tab + tab ) ); } @@ -507,7 +516,7 @@ public void WriteXML( BufferedWriter FR ) throws IOException { "\" conventionalfigher=\"" + Boolean.toString(quirk.isConventionalfighter()) + "\" dropship=\"" + Boolean.toString(quirk.isDropship()) + "\" jumpship=\"" + Boolean.toString(quirk.isDropship()) + "\" warship=\"" + Boolean.toString(quirk.isWarship()) + "\" spacestation=\"" + Boolean.toString(quirk.isSpacestation()) + "\" protomech=\"" + Boolean.toString(quirk.isProtomech()) - + "\" isvariable=\"" + Boolean.toString(quirk.isIsvariable()) + "\">"); + + "\" isvariable=\"" + Boolean.toString(quirk.isVariable()) + "\">"); FR.newLine(); FR.write(tab + tab + tab + tab + "<Name>" + FileCommon.EncodeFluff(quirk.getName()) + "</Name>"); FR.newLine(); diff --git a/sswlib/src/main/java/filehandlers/TXTWriter.java b/sswlib/src/main/java/filehandlers/TXTWriter.java index 0f9db93d..e6d047ed 100644 --- a/sswlib/src/main/java/filehandlers/TXTWriter.java +++ b/sswlib/src/main/java/filehandlers/TXTWriter.java @@ -34,14 +34,12 @@ import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; -import java.util.Enumeration; import java.util.ArrayList; import battleforce.BattleForceStats; import battleforce.BattleForceTools; import components.*; import java.io.FileOutputStream; import java.io.OutputStreamWriter; -import java.util.ArrayList; import java.util.Iterator; import list.*; import utilities.CostBVBreakdown; @@ -60,6 +58,7 @@ public TXTWriter() { } public TXTWriter( ArrayList<Force> forces ) { + this(); this.forces = forces; } @@ -170,8 +169,8 @@ public String GetTextExport() { retval += "Construction Options: Fractional Accounting" + NL + NL; } - retval += "Chassis: " + CurMech.GetChassisModel() + " " + CurMech.GetIntStruc().CritName() + NL; - retval += "Power Plant: " + CurMech.GetEngineManufacturer() + " " + CurMech.GetEngine().GetRating() + " " + CurMech.GetEngine() + NL; + retval += "Chassis: " + ( IsUnknown( CurMech.GetChassisModel() ) ? "" : CurMech.GetChassisModel() + " " ) + CurMech.GetIntStruc().CritName() + NL; + retval += "Power Plant: " + ( IsUnknown( CurMech.GetEngineManufacturer() ) ? "" : CurMech.GetEngineManufacturer() + " " ) + CurMech.GetEngine().GetRating() + " " + CurMech.GetEngine() + NL; if( CurMech.GetAdjustedWalkingMP( false, true ) != CurMech.GetWalkingMP() ) { retval += "Walking Speed: " + CommonTools.FormatSpeed( CurMech.GetWalkingMP() * 10.8 ) + " km/h (" + CommonTools.FormatSpeed( CurMech.GetAdjustedWalkingMP( false, true ) * 10.8 ) + " km/h)" + NL; } else { @@ -182,18 +181,28 @@ public String GetTextExport() { } else { retval += "Maximum Speed: " + CommonTools.FormatSpeed( CurMech.GetRunningMP() * 10.8 ) + " km/h" + NL; } - retval += "Jump Jets: " + CurMech.GetJJModel() + NL; + String jjModel = CurMech.GetJJModel(); + if ( CurMech.GetJumpJets().GetNumJJ() > 0 ) { + jjModel = ( IsUnknown( jjModel ) ? "" : jjModel + " " ) + GetJumpJetTypeLine(); + } + retval += "Jump Jets: " + jjModel + NL; retval += " Jump Capacity: " + GetJumpJetDistanceLine() + NL; + String armorModel = CurMech.GetArmorModel(); if( CurMech.HasCTCase()|| CurMech.HasLTCase() || CurMech.HasRTCase() ) { - retval += "Armor: " + CurMech.GetArmorModel() + " " + CurMech.GetArmor().CritName() + " w/ CASE" + NL; + retval += "Armor: " + ( IsUnknown( armorModel ) ? "" : armorModel + " " ) + CurMech.GetArmor().CritName() + " w/ CASE" + NL; } else { - retval += "Armor: " + CurMech.GetArmorModel() + " " + CurMech.GetArmor().CritName() + NL; + retval += "Armor: " + ( IsUnknown( armorModel ) ? "" : armorModel + " " ) + CurMech.GetArmor().CritName() + NL; } retval += "Armament:" + NL; retval += GetArmament(); - retval += "Manufacturer: " + CurMech.GetCompany() + NL; - retval += " Primary Factory: " + CurMech.GetLocation() + NL; - retval += BuildComputerBlock() + NL + NL; + if( ! IsUnknown( CurMech.GetCompany() ) ) { + retval += "Manufacturer: " + CurMech.GetCompany() + NL; + if( ! IsUnknown( CurMech.GetLocation() ) ) { + retval += " Primary Factory: " + CurMech.GetLocation() + NL; + } + } + retval += BuildComputerBlock(); + retval += NL; // retval += "================================================================================" + NL; if( ! CurMech.GetOverview().equals( "" ) ) { retval += "Overview:" + NL; @@ -1058,7 +1067,7 @@ private String BuildComputerBlock() { retval += NL; */ // start targeting and tracking system line - retval += "Targeting and Tracking System: " + CurMech.GetTandTSystem(); + retval += "Targeting and Tracking System: " + CurMech.GetTandTSystem() + NL; /* if( ! ( BAP instanceof EmptyItem ) ) { if( CurMech.UsingTC() ) { retval += NL + " w/ " + BAP.GetManufacturer() + " " + BAP.GetCritName() + NL + " and " + CurMech.GetTC().GetCritName(); @@ -1251,6 +1260,9 @@ private String GetJumpJetTypeLine() { } } } + if( CurMech.GetJumpJets().IsProto() ) { + retval += " (Prototype)"; + } return retval; } @@ -1431,4 +1443,8 @@ public String CSVFormat( String data ) { else return data + ","; } + + private boolean IsUnknown( String str ) { + return str.isEmpty() || str.equalsIgnoreCase( "Unknown" ) || str.equalsIgnoreCase( "None" ); + } } diff --git a/sswlib/src/main/java/list/view/tbQuirks.java b/sswlib/src/main/java/list/view/tbQuirks.java index 91c73e3d..1953257c 100644 --- a/sswlib/src/main/java/list/view/tbQuirks.java +++ b/sswlib/src/main/java/list/view/tbQuirks.java @@ -43,7 +43,10 @@ public tbQuirks(ArrayList quirks) public void setupTable( JTable tbl ) { tbl.setModel(this); - tbl.getColumnModel().getColumn(0).setPreferredWidth(1); + tbl.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); + tbl.setAutoCreateRowSorter(true); + tbl.getColumnModel().getColumn(0).setMinWidth(1); + tbl.getColumnModel().getColumn(1).setMinWidth(100); } public Object get( int index ) { @@ -62,7 +65,7 @@ public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: - return ((Quirk)quirklist.get(rowIndex)).getCost(); + return ((Quirk)quirklist.get(rowIndex)).getCostText(); case 1: return ((Quirk)quirklist.get(rowIndex)).getName(); } diff --git a/sswlib/src/main/java/states/stArmorHD.java b/sswlib/src/main/java/states/stArmorHD.java index 21e4eddf..b24fdcc2 100644 --- a/sswlib/src/main/java/states/stArmorHD.java +++ b/sswlib/src/main/java/states/stArmorHD.java @@ -45,7 +45,7 @@ public stArmorHD() { AC.SetCLCodes( 'E', 'X', 'X', 'X', 'E' ); AC.SetCLDates( 0, 0, false, 3126, 0, 0, false, false ); AC.SetCLFactions( "", "", "--", "" ); - AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); AC.SetPBMAllowed(true); } diff --git a/sswlib/src/main/java/states/stArmorISAB.java b/sswlib/src/main/java/states/stArmorISAB.java index e27e0d40..aaf918ef 100644 --- a/sswlib/src/main/java/states/stArmorISAB.java +++ b/sswlib/src/main/java/states/stArmorISAB.java @@ -42,7 +42,7 @@ public stArmorISAB() { AC.SetISCodes( 'E', 'X', 'X', 'X', 'E' ); AC.SetISDates( 0, 0, false, 3114, 0, 0, false, false ); AC.SetISFactions( "", "", "DC", "" ); - AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED ); + AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED ); AC.SetPBMAllowed(true); } diff --git a/sswlib/src/main/java/states/stArmorISBR.java b/sswlib/src/main/java/states/stArmorISBR.java index 21c7e056..82239533 100644 --- a/sswlib/src/main/java/states/stArmorISBR.java +++ b/sswlib/src/main/java/states/stArmorISBR.java @@ -42,7 +42,7 @@ public stArmorISBR() { AC.SetISCodes( 'E', 'X', 'X', 'X', 'E' ); AC.SetISDates( 0, 0, false, 3131, 0, 0, false, false ); AC.SetISFactions( "", "", "DC", "" ); - AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED ); + AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED ); AC.SetPBMAllowed(true); } diff --git a/sswlib/src/main/java/states/stArmorISFF.java b/sswlib/src/main/java/states/stArmorISFF.java index badc42b5..f8ebae63 100644 --- a/sswlib/src/main/java/states/stArmorISFF.java +++ b/sswlib/src/main/java/states/stArmorISFF.java @@ -42,7 +42,7 @@ public stArmorISFF() { AC.SetISCodes( 'E', 'D', 'F', 'D', 'C' ); AC.SetISDates( 0, 0, false, 2571, 2810, 3040, true, true ); AC.SetISFactions( "", "", "TH", "DC" ); - AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT ); + AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT ); AC.SetPBMAllowed(true); } diff --git a/sswlib/src/main/java/states/stArmorISHF.java b/sswlib/src/main/java/states/stArmorISHF.java index 6dfc9914..f24a0dff 100644 --- a/sswlib/src/main/java/states/stArmorISHF.java +++ b/sswlib/src/main/java/states/stArmorISHF.java @@ -38,7 +38,7 @@ public stArmorISHF() { AC.SetISCodes( 'E', 'X', 'X', 'E', 'D' ); AC.SetISDates( 0, 0, false, 3056, 0, 0, false, false ); AC.SetISFactions( "", "", "LA", "" ); - AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT ); + AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT ); AC.SetPBMAllowed(true); } diff --git a/sswlib/src/main/java/states/stArmorISIR.java b/sswlib/src/main/java/states/stArmorISIR.java index a38bb303..5ab19f3c 100644 --- a/sswlib/src/main/java/states/stArmorISIR.java +++ b/sswlib/src/main/java/states/stArmorISIR.java @@ -45,7 +45,7 @@ public stArmorISIR() { /*AC.SetCLCodes( 'E', 'X', 'X', 'X', 'E' ); AC.SetCLDates( 0, 0, false, 3126, 0, 0, false, false ); AC.SetCLFactions( "", "", "TH", "" );*/ - AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); + AC.SetRulesLevels( AvailableCode.RULES_ADVANCED, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); AC.SetPBMAllowed(true); } diff --git a/sswlib/src/main/java/states/stArmorISLF.java b/sswlib/src/main/java/states/stArmorISLF.java index 04d6a8c3..f285b193 100644 --- a/sswlib/src/main/java/states/stArmorISLF.java +++ b/sswlib/src/main/java/states/stArmorISLF.java @@ -42,7 +42,7 @@ public stArmorISLF() { AC.SetISCodes( 'F', 'X', 'X', 'E', 'D' ); AC.SetISDates( 0, 0, false, 3055, 0, 0, false, false ); AC.SetISFactions( "", "", "FW", "" ); - AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_ADVANCED, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT ); + AC.SetRulesLevels( AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT, AvailableCode.RULES_TOURNAMENT ); AC.SetPBMAllowed(true); } diff --git a/sswlib/src/main/java/states/stChassisISCOBP.java b/sswlib/src/main/java/states/stChassisISCOBP.java index 8e08afeb..ef6a31c4 100644 --- a/sswlib/src/main/java/states/stChassisISCOBP.java +++ b/sswlib/src/main/java/states/stChassisISCOBP.java @@ -76,7 +76,7 @@ public String ActualName() { } public String CritName() { - return "Composite Structure"; + return "Composite"; } public String LookupName() { diff --git a/sswlib/src/main/java/states/stChassisISCOQD.java b/sswlib/src/main/java/states/stChassisISCOQD.java index df1f6390..45820f4a 100644 --- a/sswlib/src/main/java/states/stChassisISCOQD.java +++ b/sswlib/src/main/java/states/stChassisISCOQD.java @@ -76,7 +76,7 @@ public String ActualName() { } public String CritName() { - return "Composite Structure"; + return "Composite"; } public String LookupName() { diff --git a/sswlib/src/main/java/states/stChassisPBMBP.java b/sswlib/src/main/java/states/stChassisPBMBP.java index d7e18cf2..4b6ab53b 100644 --- a/sswlib/src/main/java/states/stChassisPBMBP.java +++ b/sswlib/src/main/java/states/stChassisPBMBP.java @@ -79,7 +79,7 @@ public String ActualName() { } public String CritName() { - return "Primitive Structure"; + return "Primitive"; } public String LookupName() { diff --git a/sswlib/src/main/java/states/stChassisPBMQD.java b/sswlib/src/main/java/states/stChassisPBMQD.java index 36a74fc4..07e63acf 100644 --- a/sswlib/src/main/java/states/stChassisPBMQD.java +++ b/sswlib/src/main/java/states/stChassisPBMQD.java @@ -79,7 +79,7 @@ public String ActualName() { } public String CritName() { - return "Primitive Structure"; + return "Primitive"; } public String LookupName() { diff --git a/sswlib/src/main/java/states/stCockpitInterface.java b/sswlib/src/main/java/states/stCockpitInterface.java index 4e1618a9..834092ca 100644 --- a/sswlib/src/main/java/states/stCockpitInterface.java +++ b/sswlib/src/main/java/states/stCockpitInterface.java @@ -42,12 +42,12 @@ public class stCockpitInterface implements ifCockpit, ifState { public stCockpitInterface() { AC.SetISCodes( 'E', 'X', 'X', 'F', 'X' ); - AC.SetISDates( 0, 0, false, 3074, 0, 0, false, false ); - AC.SetISFactions( "", "", "WB", "" ); + AC.SetISDates( 3068, 3074, false, 3078, 0, 0, false, false ); + AC.SetISFactions( "WB", "WB", "WB", "" ); AC.SetSuperHeavyCompatible(false); AC.SetCLCodes( 'F', 'X', 'X', 'F', 'F' ); - AC.SetCLDates( 0, 0, false, 3083, 0, 0, false, false ); - AC.SetCLFactions( "", "", "TH", "" ); + AC.SetCLDates( 3082, 3083, false, 3083, 0, 0, false, false ); + AC.SetCLFactions( "CHH", "CHH", "CHH", "" ); AC.SetRulesLevels( AvailableCode.RULES_EXPERIMENTAL, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED, AvailableCode.RULES_UNALLOWED ); } diff --git a/sswlib/src/main/java/states/stPECLMASC.java b/sswlib/src/main/java/states/stPECLMASC.java index 56fc7c18..fb614a4d 100644 --- a/sswlib/src/main/java/states/stPECLMASC.java +++ b/sswlib/src/main/java/states/stPECLMASC.java @@ -47,11 +47,11 @@ public boolean HasCounterpart() { } public int GetTonnage( int mechtons ) { - return (int) (mechtons * 0.04f + 0.51f); + return (int) Math.max((mechtons * 0.04f + 0.51f), 1); } public int GetCrits( int mechtons ) { - return (int) (mechtons * 0.04f + 0.51f); + return (int) Math.max((mechtons * 0.04f + 0.51f), 1); } public String ActualName() { diff --git a/sswlib/src/main/java/utilities/CVCostBVBreakdown.java b/sswlib/src/main/java/utilities/CVCostBVBreakdown.java index 3b7243bd..2dcd11d5 100644 --- a/sswlib/src/main/java/utilities/CVCostBVBreakdown.java +++ b/sswlib/src/main/java/utilities/CVCostBVBreakdown.java @@ -81,7 +81,7 @@ public String Render() { retval += String.format( "Total Cost %1$,13.0f", CurUnit.GetTotalCost() ) + NL; retval += NL + NL; retval += "Defensive BV Calculation Breakdown" + NL; - if( CurUnit.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( CurUnit.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { retval += "(Note: BV Calculations include defensive BV for armored components.)" + NL; } retval += "________________________________________________________________________________" + NL; @@ -142,7 +142,7 @@ private String GetEquipmentCostLines() { retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurUnit.GetBlueShield().CritName(), CurUnit.GetBlueShield().GetDefensiveBV(), CurUnit.GetBlueShield().GetOffensiveBV(), CurUnit.GetBlueShield().GetCost() ) + NL; } if( CurUnit.GetLoadout().HasSupercharger() ) { - retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurUnit.GetLoadout().GetSupercharger().CritName(), CurUnit.GetLoadout().GetSupercharger().GetDefensiveBV(), CurUnit.GetLoadout().GetSupercharger().GetOffensiveBV(), CurUnit.GetLoadout().GetSupercharger().GetCost() ) + NL; + //retval += String.format( "%1$-46s %2$,6.0f %3$,6.0f %4$,13.2f", CurUnit.GetLoadout().GetSupercharger().CritName(), CurUnit.GetLoadout().GetSupercharger().GetDefensiveBV(), CurUnit.GetLoadout().GetSupercharger().GetOffensiveBV(), CurUnit.GetLoadout().GetSupercharger().GetCost() ) + NL; } return retval; } @@ -249,8 +249,8 @@ public String PrintOffensiveFactorCalculations() { String retval = ""; double temp; - temp = (double) (CurUnit.getFlankMP() + ( Math.floor( 0 * 0.5 + 0.5 ) ) - 5.0 ); - retval += " Adjusted Flank MP (" + CurUnit.getFlankMP( ) + ") + ( Adjusted Jumping MP (" + 0 + ") / 2 ) - 5 = " + String.format( "%1$,.2f", CurUnit.getFlankMP() + ( Math.floor( 0 * 0.5 + 0.5 ) ) - 5.0 ) + NL; + temp = (double) (CurUnit.GetAdjustedFlankMP(false, true) + ( Math.floor( 0 * 0.5 + 0.5 ) ) - 5.0 ); + retval += " Adjusted Flank MP (" + CurUnit.GetAdjustedFlankMP(false, true ) + ") + ( Adjusted Jumping MP (" + 0 + ") / 2 ) - 5 = " + String.format( "%1$,.2f", CurUnit.GetAdjustedFlankMP(false, true) + ( Math.floor( 0 * 0.5 + 0.5 ) ) - 5.0 ) + NL; retval += " " + String.format( "%1$,.2f", temp ) + " / 10 + 1 = " + String.format( "%1$.3f", ( temp * 0.1 + 1.0 ) ) + NL; temp = temp * 0.1 + 1.0; retval += " " + String.format( "%1$,.2f", temp ) + " ^ 1.2 = " + (double) Math.floor( ( Math.pow( temp, 1.2 ) ) * 100 + 0.5 ) / 100 + " (rounded off to two digits)" + NL; diff --git a/sswlib/src/main/java/utilities/CostBVBreakdown.java b/sswlib/src/main/java/utilities/CostBVBreakdown.java index eb5fe2b5..c0076ce0 100644 --- a/sswlib/src/main/java/utilities/CostBVBreakdown.java +++ b/sswlib/src/main/java/utilities/CostBVBreakdown.java @@ -142,7 +142,7 @@ public String Render() { retval += String.format( "Total Cost %1$,13.0f", CurMech.GetTotalCost() ) + NL; retval += NL + NL; retval += "Defensive BV Calculation Breakdown" + NL; - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( CurMech.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { retval += "(Note: BV Calculations include defensive BV for armored components.)" + NL; } retval += "________________________________________________________________________________" + NL; @@ -570,7 +570,7 @@ public String PrintOffensiveFactorCalculations() { private boolean HasBonusFromCP() { ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( CurMech.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { // check for coolant pods for( int i = 0; i < v.size(); i++ ) { a = (abPlaceable) v.get( i ); @@ -590,7 +590,7 @@ private int GetBonusFromCP() { ArrayList v = CurMech.GetLoadout().GetNonCore(); abPlaceable a; - if( CurMech.GetRulesLevel() == AvailableCode.RULES_EXPERIMENTAL ) { + if( CurMech.GetRulesLevel() >= AvailableCode.RULES_EXPERIMENTAL ) { // check for coolant pods for( int i = 0; i < v.size(); i++ ) { a = (abPlaceable) v.get( i ); diff --git a/sswlib/src/main/java/visitors/VArmorSetVStealth.java b/sswlib/src/main/java/visitors/VArmorSetVStealth.java index c9e3ec49..752d26a3 100644 --- a/sswlib/src/main/java/visitors/VArmorSetVStealth.java +++ b/sswlib/src/main/java/visitors/VArmorSetVStealth.java @@ -33,6 +33,7 @@ public class VArmorSetVStealth implements ifVisitor { // sets the mech's armor to stealth private Mech CurMech; + private CombatVehicle CurVee; private LocationIndex[] Locs = null; public VArmorSetVStealth() { @@ -53,7 +54,36 @@ public void Visit(Mech m) throws Exception { } public void Visit( CombatVehicle v ) throws Exception { - v.GetArmor().SetISVST(); + // only the armor changes, so pass us off + CurVee = v; + ifCVLoadout l = CurVee.GetLoadout(); + CVArmor a = CurVee.GetArmor(); + + // remove the old armor, if needed + l.Remove( a ); + a.ResetPatchworkConfigs(); + + a.SetISVST(); + + if( Locs == null ) { + // place the armor + if( ! a.Place( l ) ) { + // not enough free space. tell the user + throw new Exception( "There is no available room for Stealth Armor!" ); + } + } else { + // use the location index array given to allocate the armor + if( ! a.Place( l, Locs ) ) { + // not enough free space. tell the user + throw new Exception( "There is no available room for Stealth Armor!" ); + } + } + if( a.GetMechModifier() != null ) { + CurVee.AddMechModifier( a.GetMechModifier() ); + } + // reset the locations just in case. Any time this visitor is used we + // should load up a new set of locations. + Locs = null; } public void Visit( Infantry i ) throws Exception {