sortKeys = new ArrayList<>();
sortKeys.add(new SortKey(0, SortOrder.ASCENDING));
techSorter.setSortKeys(sortKeys);
- JScrollPane scrollTechTable = new JScrollPane(techTable);
+ JScrollPane scrollTechTable = new JScrollPaneWithSpeed(techTable);
scrollTechTable.setMinimumSize(new Dimension(200, 200));
scrollTechTable.setPreferredSize(new Dimension(300, 300));
gridBagConstraints = new GridBagConstraints();
diff --git a/MekHQ/src/mekhq/gui/control/EditKillLogControl.java b/MekHQ/src/mekhq/gui/control/EditKillLogControl.java
index bccb345494..4882041028 100644
--- a/MekHQ/src/mekhq/gui/control/EditKillLogControl.java
+++ b/MekHQ/src/mekhq/gui/control/EditKillLogControl.java
@@ -24,6 +24,7 @@
import mekhq.campaign.personnel.Person;
import mekhq.gui.dialog.AddOrEditKillEntryDialog;
import mekhq.gui.model.KillTableModel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -96,7 +97,7 @@ private void initComponents() {
killTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
killTable.getSelectionModel().addListSelectionListener(this::killTableValueChanged);
- scrollKillTable = new JScrollPane();
+ scrollKillTable = new JScrollPaneWithSpeed();
scrollKillTable.setName("scrollPartsTable");
scrollKillTable.setViewportView(killTable);
this.add(scrollKillTable, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/control/EditPersonnelLogControl.java b/MekHQ/src/mekhq/gui/control/EditPersonnelLogControl.java
index b9b7298ae8..bc64e56919 100644
--- a/MekHQ/src/mekhq/gui/control/EditPersonnelLogControl.java
+++ b/MekHQ/src/mekhq/gui/control/EditPersonnelLogControl.java
@@ -24,6 +24,7 @@
import mekhq.campaign.personnel.Person;
import mekhq.gui.dialog.AddOrEditPersonnelEntryDialog;
import mekhq.gui.model.LogTableModel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -96,7 +97,7 @@ private void initComponents() {
logsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
logsTable.getSelectionModel().addListSelectionListener(this::logTableValueChanged);
- scrollLogsTable = new JScrollPane();
+ scrollLogsTable = new JScrollPaneWithSpeed();
scrollLogsTable.setName(resourceMap.getString("scrollLogsTable.name"));
scrollLogsTable.setViewportView(logsTable);
this.add(scrollLogsTable, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/control/EditScenarioLogControl.java b/MekHQ/src/mekhq/gui/control/EditScenarioLogControl.java
index d8e7cd6a89..dc1cdf8fac 100644
--- a/MekHQ/src/mekhq/gui/control/EditScenarioLogControl.java
+++ b/MekHQ/src/mekhq/gui/control/EditScenarioLogControl.java
@@ -24,6 +24,7 @@
import mekhq.campaign.personnel.Person;
import mekhq.gui.dialog.AddOrEditScenarioEntryDialog;
import mekhq.gui.model.LogTableModel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -96,7 +97,7 @@ private void initComponents() {
logsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
logsTable.getSelectionModel().addListSelectionListener(this::logTableValueChanged);
- scrollLogsTable = new JScrollPane();
+ scrollLogsTable = new JScrollPaneWithSpeed();
scrollLogsTable.setName(resourceMap.getString("scrollLogsTable.name"));
scrollLogsTable.setViewportView(logsTable);
this.add(scrollLogsTable, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/dialog/AcquisitionsDialog.java b/MekHQ/src/mekhq/gui/dialog/AcquisitionsDialog.java
index f650acdf9a..85f83b0de1 100644
--- a/MekHQ/src/mekhq/gui/dialog/AcquisitionsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/AcquisitionsDialog.java
@@ -55,6 +55,7 @@
import mekhq.gui.CampaignGUI;
import mekhq.gui.RepairTab;
import mekhq.gui.enums.MHQTabType;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.service.PartsAcquisitionService;
import mekhq.service.PartsAcquisitionService.PartCountInfo;
@@ -121,7 +122,7 @@ private void initComponents() {
pnlSummary.firePropertyChange("counts", -1, 0);
- JScrollPane scrollMain = new JScrollPane(pnlMain);
+ JScrollPane scrollMain = new JScrollPaneWithSpeed(pnlMain);
scrollMain.setPreferredSize(new Dimension(700, 500));
content.add(scrollMain, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java b/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java
index 8f75f61030..29a5327663 100644
--- a/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java
@@ -28,6 +28,7 @@
import mekhq.gui.enums.PersonnelFilter;
import mekhq.gui.model.AutoAwardsTableModel;
import mekhq.gui.sorter.PersonRankStringSorter;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import javax.swing.RowSorter.SortKey;
@@ -165,7 +166,7 @@ private void initComponents() {
JCheckBox cbxAward = (JCheckBox) cellEditor.getComponent();
cbxAward.addMouseListener(checkboxListener);
- JScrollPane scrollPane = new JScrollPane();
+ JScrollPane scrollPane = new JScrollPaneWithSpeed();
scrollPane.setViewportView(personnelTable);
scrollPane.setPreferredSize(new Dimension(500, 500));
autoAwardsPanel.add(scrollPane, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/dialog/BatchXPDialog.java b/MekHQ/src/mekhq/gui/dialog/BatchXPDialog.java
index 8de0fc3b66..7bca413ffa 100644
--- a/MekHQ/src/mekhq/gui/dialog/BatchXPDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/BatchXPDialog.java
@@ -53,6 +53,7 @@
import mekhq.campaign.personnel.ranks.Rank;
import mekhq.gui.enums.PersonnelTableModelColumn;
import mekhq.gui.model.PersonnelTableModel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.utilities.MekHqTableCellRenderer;
public final class BatchXPDialog extends JDialog {
@@ -184,7 +185,7 @@ private JComponent getPersonnelTable() {
personnelSorter.setRowFilter(personnelFilter);
personnelTable.setRowSorter(personnelSorter);
- final JScrollPane pane = new JScrollPane(personnelTable);
+ final JScrollPane pane = new JScrollPaneWithSpeed(personnelTable);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
return pane;
}
diff --git a/MekHQ/src/mekhq/gui/dialog/BombsDialog.java b/MekHQ/src/mekhq/gui/dialog/BombsDialog.java
index 79c7fca08a..d6843faa65 100644
--- a/MekHQ/src/mekhq/gui/dialog/BombsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/BombsDialog.java
@@ -44,6 +44,7 @@
import mekhq.campaign.Campaign;
import mekhq.campaign.parts.AmmoStorage;
import mekhq.campaign.parts.equipment.EquipmentPart;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Deric Page (dericpage@users.sourceforge.net)
@@ -103,7 +104,7 @@ private void initGUI() {
true, typeMax);
// Set up the display of this dialog.
- JScrollPane scroller = new JScrollPane(bombPanel);
+ JScrollPane scroller = new JScrollPaneWithSpeed(bombPanel);
scroller.setPreferredSize(new Dimension(300, 200));
setLayout(new BorderLayout());
add(scroller, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/dialog/CampaignExportWizard.java b/MekHQ/src/mekhq/gui/dialog/CampaignExportWizard.java
index 98d5460ada..d3e4c5db45 100644
--- a/MekHQ/src/mekhq/gui/dialog/CampaignExportWizard.java
+++ b/MekHQ/src/mekhq/gui/dialog/CampaignExportWizard.java
@@ -60,6 +60,7 @@
import mekhq.campaign.unit.Unit;
import mekhq.gui.CampaignGUI;
import mekhq.gui.FileDialogs;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* This class manages the GUI and logic for the campaign subset export wizard.
@@ -137,7 +138,7 @@ public void display(CampaignExportWizardState state) {
gbc.gridy++;
- JScrollPane scrollPane = new JScrollPane();
+ JScrollPane scrollPane = new JScrollPaneWithSpeed();
switch (state) {
case ForceSelection:
lblInstructions.setText(resourceMap.getString("lblInstructions.ForceSelection.text"));
diff --git a/MekHQ/src/mekhq/gui/dialog/ChooseFactionsDialog.java b/MekHQ/src/mekhq/gui/dialog/ChooseFactionsDialog.java
index 570223c59b..66c868bfb3 100644
--- a/MekHQ/src/mekhq/gui/dialog/ChooseFactionsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/ChooseFactionsDialog.java
@@ -47,6 +47,7 @@
import mekhq.MekHQ;
import mekhq.campaign.universe.Faction;
import mekhq.campaign.universe.Factions;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
public class ChooseFactionsDialog extends JDialog {
private static final MMLogger logger = MMLogger.create(ChooseFactionsDialog.class);
@@ -92,7 +93,7 @@ protected void initComponents() {
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
- JScrollPane scrollPane = new JScrollPane();
+ JScrollPane scrollPane = new JScrollPaneWithSpeed();
factionList = new JList<>(new FactionListModel(date));
factionList.setCellRenderer(new DefaultListCellRenderer() {
@Override
diff --git a/MekHQ/src/mekhq/gui/dialog/ChooseRefitDialog.java b/MekHQ/src/mekhq/gui/dialog/ChooseRefitDialog.java
index 89c9466322..9da7979302 100644
--- a/MekHQ/src/mekhq/gui/dialog/ChooseRefitDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/ChooseRefitDialog.java
@@ -54,6 +54,7 @@
import mekhq.campaign.Campaign;
import mekhq.campaign.parts.Refit;
import mekhq.campaign.unit.Unit;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Taharqa
@@ -120,7 +121,7 @@ private void initComponents() {
refitSorter.setComparator(RefitTableModel.COL_CLASS, new ClassSorter());
refitSorter.setComparator(RefitTableModel.COL_COST, new FormattedNumberSorter());
refitTable.setRowSorter(refitSorter);
- scrRefitTable = new JScrollPane();
+ scrRefitTable = new JScrollPaneWithSpeed();
scrRefitTable.setViewportView(refitTable);
scrRefitTable.setBorder(BorderFactory.createTitledBorder(resourceMap.getString("refitTable.title")));
GridBagConstraints gridBagConstraints = new GridBagConstraints();
@@ -133,7 +134,7 @@ private void initComponents() {
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
getContentPane().add(scrRefitTable, gridBagConstraints);
- scrShoppingList = new JScrollPane();
+ scrShoppingList = new JScrollPaneWithSpeed();
scrShoppingList.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(resourceMap.getString("shoppingList.title")),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
@@ -157,7 +158,7 @@ private void initComponents() {
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
MekView mv = new MekView(unit.getEntity(), false, true, true, ViewFormatting.HTML);
txtOldUnit.setText("" + mv.getMekReadout() + "
");
- scrOldUnit = new JScrollPane(txtOldUnit);
+ scrOldUnit = new JScrollPaneWithSpeed(txtOldUnit);
scrOldUnit.setMinimumSize(new Dimension(300, 400));
scrOldUnit.setPreferredSize(new Dimension(300, 400));
SwingUtilities.invokeLater(() -> scrOldUnit.getVerticalScrollBar().setValue(0));
@@ -178,7 +179,7 @@ private void initComponents() {
txtNewUnit.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(resourceMap.getString("txtNewUnit.title")),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
- scrNewUnit = new JScrollPane(txtNewUnit);
+ scrNewUnit = new JScrollPaneWithSpeed(txtNewUnit);
scrNewUnit.setMinimumSize(new Dimension(300, 400));
scrNewUnit.setPreferredSize(new Dimension(300, 400));
gridBagConstraints.gridx = 2;
diff --git a/MekHQ/src/mekhq/gui/dialog/CompanyGenerationDialog.java b/MekHQ/src/mekhq/gui/dialog/CompanyGenerationDialog.java
index 8e6f801a6e..062f81dd1f 100644
--- a/MekHQ/src/mekhq/gui/dialog/CompanyGenerationDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CompanyGenerationDialog.java
@@ -37,6 +37,7 @@
import mekhq.campaign.universe.generators.companyGenerators.AbstractCompanyGenerator;
import mekhq.gui.baseComponents.AbstractMHQValidationButtonDialog;
import mekhq.gui.panels.CompanyGenerationOptionsPanel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import java.awt.*;
@@ -94,7 +95,7 @@ public void setCompanyGenerationOptionsPanel(final CompanyGenerationOptionsPanel
protected Container createCenterPane() {
setCompanyGenerationOptionsPanel(new CompanyGenerationOptionsPanel(getFrame(), getCampaign(),
getCompanyGenerationOptions()));
- return new JScrollPane(getCompanyGenerationOptionsPanel());
+ return new JScrollPaneWithSpeed(getCompanyGenerationOptionsPanel());
}
@Override
diff --git a/MekHQ/src/mekhq/gui/dialog/ContractMarketDialog.java b/MekHQ/src/mekhq/gui/dialog/ContractMarketDialog.java
index 7efcdb7864..29a9fba0c4 100644
--- a/MekHQ/src/mekhq/gui/dialog/ContractMarketDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/ContractMarketDialog.java
@@ -35,6 +35,7 @@
import mekhq.gui.FactionComboBox;
import mekhq.gui.sorter.FormattedNumberSorter;
import mekhq.gui.sorter.IntegerStringSorter;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.view.ContractSummaryPanel;
import javax.swing.*;
@@ -123,8 +124,8 @@ private void countSuccessfulContracts() {
}
private void initComponents() {
- JScrollPane scrollTableContracts = new JScrollPane();
- scrollContractView = new JScrollPane();
+ JScrollPane scrollTableContracts = new JScrollPaneWithSpeed();
+ scrollContractView = new JScrollPaneWithSpeed();
JPanel panelTable = new JPanel();
JPanel panelFees = new JPanel();
JPanel panelRetainer = new JPanel();
@@ -511,17 +512,18 @@ private boolean triggerConfirmationDialog() {
ImageIcon icon = getFactionLogo(campaign, ((AtBContract) selectedContract).getEmployerCode(),
true);
- // Define resource keys for each difficulty level
- Map difficultyMessages = Map.of(
- -99, "messageChallengeUnknown.text",
- 1, "messageChallengeVeryEasy.text",
- 2, "messageChallengeEasy.text",
- 9, "messageChallengeHard.text",
- 10, "messageChallengeVeryHard.text"
- );
-
- // Extract the resource mapping and get the resource string
- String resourceKey = difficultyMessages.getOrDefault(difficulty, "");
+ // Get the resource string
+ String resourceKey = "";
+
+ if (difficulty == -99) {
+ resourceKey = "messageChallengeUnknown.text";
+ } else if (difficulty <= 2) {
+ resourceKey = "messageChallengeVeryEasy.text";
+ } else if (difficulty > 8) {
+ resourceKey = "messageChallengeVeryHard.text";
+ } else if (difficulty > 6) {
+ resourceKey = "messageChallengeHard.text";
+ }
// If resourceKey is not found, just return true, acting as if the player had accepted the mission
if (resourceKey.isEmpty()) {
diff --git a/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java b/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java
index b966ec467e..e8cde0c6bf 100644
--- a/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java
@@ -46,6 +46,7 @@
import mekhq.campaign.universe.Factions;
import mekhq.campaign.universe.Planet;
import mekhq.campaign.universe.PlanetarySystem;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.utilities.MarkdownEditorPanel;
import mekhq.gui.utilities.MarkdownRenderer;
@@ -865,9 +866,9 @@ private JPanel getRightPanel() {
rightPanel.add(topPanel, BorderLayout.PAGE_START);
- JScrollPane scrOptions = new JScrollPane();
+ JScrollPane scrOptions = new JScrollPaneWithSpeed();
panOptions = new JPanel();
- JScrollPane scrSkills = new JScrollPane();
+ JScrollPane scrSkills = new JScrollPaneWithSpeed();
panSkills = new JPanel();
JTabbedPane tabStats = new JTabbedPane();
diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizeBotForceDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizeBotForceDialog.java
index 490a457d8f..9d7f691d10 100644
--- a/MekHQ/src/mekhq/gui/dialog/CustomizeBotForceDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CustomizeBotForceDialog.java
@@ -60,6 +60,7 @@
import mekhq.gui.FileDialogs;
import mekhq.gui.baseComponents.DefaultMHQScrollablePanel;
import mekhq.gui.displayWrappers.FactionDisplay;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
public class CustomizeBotForceDialog extends JDialog {
private static final MMLogger logger = MMLogger.create(CustomizeBotForceDialog.class);
@@ -256,7 +257,7 @@ private void initComponents() {
panFixedUnits = new DefaultMHQScrollablePanel(frame, "panFixedEntity", new GridBagLayout());
refreshFixedEntityPanel();
- JScrollPane scrollFixedUnits = new JScrollPane(panFixedUnits);
+ JScrollPane scrollFixedUnits = new JScrollPaneWithSpeed(panFixedUnits);
scrollFixedUnits.setMinimumSize(new Dimension(400, 200));
scrollFixedUnits.setPreferredSize(new Dimension(400, 200));
scrollFixedUnits.setBorder(BorderFactory.createCompoundBorder(
diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java
index 413261071a..7dc5d07e4f 100644
--- a/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java
@@ -52,6 +52,7 @@
import mekhq.gui.control.EditKillLogControl;
import mekhq.gui.control.EditPersonnelLogControl;
import mekhq.gui.control.EditScenarioLogControl;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.utilities.MarkdownEditorPanel;
import javax.swing.*;
@@ -187,8 +188,8 @@ private void initComponents() {
JLabel lblToughness = new JLabel();
textEducationLevel = new JComboBox<>();
JLabel lblEducationLevel = new JLabel();
- JScrollPane scrOptions = new JScrollPane();
- JScrollPane scrSkills = new JScrollPane();
+ JScrollPane scrOptions = new JScrollPaneWithSpeed();
+ JScrollPane scrSkills = new JScrollPaneWithSpeed();
JPanel panButtons = new JPanel();
JButton btnOk = new JButton();
diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioDialog.java
index 5d35aeb1ea..7a7b2377e4 100644
--- a/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioDialog.java
@@ -58,6 +58,7 @@
import mekhq.gui.model.BotForceTableModel;
import mekhq.gui.model.LootTableModel;
import mekhq.gui.model.ObjectiveTableModel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.utilities.MarkdownEditorPanel;
/**
@@ -910,7 +911,7 @@ private void initObjectivesPanel(ResourceBundle resourceMap) {
objectiveTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
objectiveTable.getSelectionModel().addListSelectionListener(this::objectiveTableValueChanged);
- panObjectives.add(new JScrollPane(objectiveTable), BorderLayout.CENTER);
+ panObjectives.add(new JScrollPaneWithSpeed(objectiveTable), BorderLayout.CENTER);
}
@@ -998,7 +999,7 @@ private void initLootPanel(ResourceBundle resourceMap) {
lootTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
lootTable.getSelectionModel().addListSelectionListener(this::lootTableValueChanged);
- panLoot.add(new JScrollPane(lootTable), BorderLayout.CENTER);
+ panLoot.add(new JScrollPaneWithSpeed(lootTable), BorderLayout.CENTER);
}
private void lootTableValueChanged(ListSelectionEvent evt) {
@@ -1081,7 +1082,7 @@ private void initOtherForcesPanel(ResourceBundle resourceMap) {
forcesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
forcesTable.getSelectionModel().addListSelectionListener(this::forcesTableValueChanged);
- panOtherForces.add(new JScrollPane(forcesTable), BorderLayout.CENTER);
+ panOtherForces.add(new JScrollPaneWithSpeed(forcesTable), BorderLayout.CENTER);
}
private void forcesTableValueChanged(ListSelectionEvent evt) {
diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioObjectiveDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioObjectiveDialog.java
index 1dffa3d5ad..5723c29dfe 100644
--- a/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioObjectiveDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/CustomizeScenarioObjectiveDialog.java
@@ -41,6 +41,7 @@
import mekhq.campaign.mission.ScenarioObjective.ObjectiveAmountType;
import mekhq.campaign.mission.ScenarioObjective.ObjectiveCriterion;
import mekhq.campaign.mission.ScenarioObjective.TimeLimitType;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
public class CustomizeScenarioObjectiveDialog extends JDialog {
@@ -182,7 +183,7 @@ private void initialize() {
lstDetails.addListSelectionListener(
e -> btnRemoveDetail.setEnabled(!lstDetails.getSelectedValuesList().isEmpty()));
lstDetails.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- JScrollPane scrDetails = new JScrollPane(lstDetails);
+ JScrollPane scrDetails = new JScrollPaneWithSpeed(lstDetails);
scrDetails.setMinimumSize(new Dimension(200, 100));
scrDetails.setPreferredSize(new Dimension(200, 100));
gbc.gridx = 1;
@@ -336,7 +337,7 @@ private void initForcePanel(ResourceBundle resourceMap) {
localGbc.gridx++;
panForce.add(btnAdd, localGbc);
localGbc.gridx++;
- JScrollPane scrForceNames = new JScrollPane(forceNames);
+ JScrollPane scrForceNames = new JScrollPaneWithSpeed(forceNames);
scrForceNames.setMinimumSize(new Dimension(250, 100));
scrForceNames.setPreferredSize(new Dimension(250, 100));
panForce.add(scrForceNames, localGbc);
@@ -436,14 +437,14 @@ private void initObjectiveEffectPanel(ResourceBundle resourceMap) {
gbc.gridx = 0;
gbc.gridy++;
gbc.anchor = GridBagConstraints.NORTHWEST;
- JScrollPane scrSuccessEffects = new JScrollPane(successEffects);
+ JScrollPane scrSuccessEffects = new JScrollPaneWithSpeed(successEffects);
scrSuccessEffects.setMinimumSize(new Dimension(300, 100));
scrSuccessEffects.setPreferredSize(new Dimension(300, 100));
panBottom.add(scrSuccessEffects, gbc);
gbc.gridx++;
panBottom.add(btnRemoveSuccess, gbc);
gbc.gridx++;
- JScrollPane scrFailureEffects = new JScrollPane(failureEffects);
+ JScrollPane scrFailureEffects = new JScrollPaneWithSpeed(failureEffects);
scrFailureEffects.setMinimumSize(new Dimension(300, 100));
scrFailureEffects.setPreferredSize(new Dimension(300, 100));
panBottom.add(scrFailureEffects, gbc);
diff --git a/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java b/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java
index db6a62606b..d48946b4a2 100644
--- a/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/DataLoadingDialog.java
@@ -320,9 +320,6 @@ public Campaign doInBackground() throws Exception {
if ((preset != null) && (preset.getGameOptions() != null)) {
campaign.setGameOptions(preset.getGameOptions());
}
- campaign.setLocalDate(dc.getDate());
- campaign.getGameOptions().getOption(OptionsConstants.ALLOWED_YEAR).setValue(campaign.getGameYear());
- campaign.setStartingSystem((preset == null) ? null : preset.getPlanet());
// This must be after the date chooser to enable correct functionality.
setVisible(false);
@@ -330,7 +327,17 @@ public Campaign doInBackground() throws Exception {
// Campaign Options
if (isSelect && preset != null) {
preset.applyContinuousToCampaign(campaign);
+
+ // This needs to be after we've applied the preset
+ campaign.setLocalDate(dc.getDate());
+ campaign.getGameOptions().getOption(OptionsConstants.ALLOWED_YEAR).setValue(campaign.getGameYear());
+ campaign.setStartingSystem(preset.getPlanet());
} else {
+ // This needs to be before we trigger the customize preset dialog
+ campaign.setLocalDate(dc.getDate());
+ campaign.getGameOptions().getOption(OptionsConstants.ALLOWED_YEAR).setValue(campaign.getGameYear());
+ campaign.setStartingSystem((preset == null) ? null : preset.getPlanet());
+
CampaignOptionsDialog optionsDialog = new CampaignOptionsDialog(dialog, getFrame(), campaign, true);
optionsDialog.setLocationRelativeTo(getFrame());
optionsDialog.applyPreset(preset);
diff --git a/MekHQ/src/mekhq/gui/dialog/EditMapSettingsDialog.java b/MekHQ/src/mekhq/gui/dialog/EditMapSettingsDialog.java
index 63cd10c7d8..3a505e07cd 100644
--- a/MekHQ/src/mekhq/gui/dialog/EditMapSettingsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/EditMapSettingsDialog.java
@@ -56,6 +56,7 @@
import megamek.server.totalwarfare.TWGameManager;
import mekhq.MekHQ;
import mekhq.campaign.mission.Scenario;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
public class EditMapSettingsDialog extends JDialog {
private static final MMLogger logger = MMLogger.create(EditMapSettingsDialog.class);
@@ -133,7 +134,7 @@ private void initComponents() {
panSizeFixed = new JPanel(new BorderLayout());
JPanel panButtons = new JPanel(new FlowLayout());
- scrChooseMap = new JScrollPane();
+ scrChooseMap = new JScrollPaneWithSpeed();
scrChooseMap.setMinimumSize(new Dimension(600, 800));
scrChooseMap.setPreferredSize(new Dimension(600, 800));
diff --git a/MekHQ/src/mekhq/gui/dialog/EditPersonnelInjuriesDialog.java b/MekHQ/src/mekhq/gui/dialog/EditPersonnelInjuriesDialog.java
index 72d530ceb9..d5035e265f 100644
--- a/MekHQ/src/mekhq/gui/dialog/EditPersonnelInjuriesDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/EditPersonnelInjuriesDialog.java
@@ -48,6 +48,7 @@
import mekhq.campaign.Campaign;
import mekhq.campaign.personnel.Injury;
import mekhq.campaign.personnel.Person;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Ralgith
@@ -122,7 +123,7 @@ private void initComponents() {
injuriesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
injuriesTable.getSelectionModel().addListSelectionListener(this::injuriesTableValueChanged);
- JScrollPane scrollInjuryTable = new JScrollPane();
+ JScrollPane scrollInjuryTable = new JScrollPaneWithSpeed();
scrollInjuryTable.setName("scrollInjuryTable");
scrollInjuryTable.setViewportView(injuriesTable);
getContentPane().add(scrollInjuryTable, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/dialog/EditSkillPerquisiteDialog.java b/MekHQ/src/mekhq/gui/dialog/EditSkillPerquisiteDialog.java
index 12f0ec5d91..4d082e55a7 100644
--- a/MekHQ/src/mekhq/gui/dialog/EditSkillPerquisiteDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/EditSkillPerquisiteDialog.java
@@ -42,6 +42,7 @@
import mekhq.MekHQ;
import mekhq.campaign.personnel.SkillPerquisite;
import mekhq.campaign.personnel.SkillType;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Taharqa
@@ -113,7 +114,7 @@ private void initComponents() {
setTitle("Select Abilities");
getContentPane().setLayout(new BorderLayout());
- getContentPane().add(new JScrollPane(panMain), BorderLayout.CENTER);
+ getContentPane().add(new JScrollPaneWithSpeed(panMain), BorderLayout.CENTER);
getContentPane().add(panButtons, BorderLayout.SOUTH);
this.setPreferredSize(new Dimension(400, 700));
diff --git a/MekHQ/src/mekhq/gui/dialog/ForceTemplateAssignmentDialog.java b/MekHQ/src/mekhq/gui/dialog/ForceTemplateAssignmentDialog.java
index 49c4db64e6..0f109889be 100644
--- a/MekHQ/src/mekhq/gui/dialog/ForceTemplateAssignmentDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/ForceTemplateAssignmentDialog.java
@@ -27,6 +27,7 @@
import mekhq.campaign.mission.ScenarioForceTemplate.ForceGenerationMethod;
import mekhq.campaign.unit.Unit;
import mekhq.gui.CampaignGUI;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import java.awt.*;
@@ -87,7 +88,7 @@ private void display(boolean individualUnits) {
gbc.gridwidth = 1;
gbc.gridy++;
- JScrollPane itemListPane = new JScrollPane();
+ JScrollPane itemListPane = new JScrollPaneWithSpeed();
if (individualUnits) {
itemListPane.setViewportView(unitList);
refreshUnitList();
@@ -98,7 +99,7 @@ private void display(boolean individualUnits) {
getContentPane().add(itemListPane, gbc);
gbc.gridx++;
- JScrollPane templateListPane = new JScrollPane();
+ JScrollPane templateListPane = new JScrollPaneWithSpeed();
templateListPane.setViewportView(templateList);
itemListPane.setPreferredSize(
new Dimension((int) itemListPane.getPreferredSize().getWidth() + (int) templateListPane.getPreferredSize().getWidth(),
diff --git a/MekHQ/src/mekhq/gui/dialog/GMToolsDialog.java b/MekHQ/src/mekhq/gui/dialog/GMToolsDialog.java
index a0a88bff35..e08903f31b 100644
--- a/MekHQ/src/mekhq/gui/dialog/GMToolsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/GMToolsDialog.java
@@ -49,6 +49,7 @@
import mekhq.gui.displayWrappers.ClanDisplay;
import mekhq.gui.displayWrappers.FactionDisplay;
import mekhq.gui.panels.LayeredForceIconCreationPanel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
@@ -558,7 +559,7 @@ private JScrollPane createGeneralTab() {
.addComponent(dicePanel)
.addComponent(ratPanel));
- return new JScrollPane(panel);
+ return new JScrollPaneWithSpeed(panel);
}
private JPanel createDicePanel() {
@@ -788,7 +789,7 @@ private JScrollPane createNamesTab() {
.addComponent(companyNamePanel)
.addComponent(bloodnamePanel));
- return new JScrollPane(namesPanel);
+ return new JScrollPaneWithSpeed(namesPanel);
}
private JPanel createNamePanel() {
@@ -1270,7 +1271,7 @@ private JScrollPane createPersonnelModuleTab() {
layout.createParallelGroup(Alignment.LEADING)
.addComponent(procreationPanel));
- return new JScrollPane(personnelModulePanel);
+ return new JScrollPaneWithSpeed(personnelModulePanel);
}
private JPanel createProcreationPanel() {
diff --git a/MekHQ/src/mekhq/gui/dialog/LargeCraftAmmoSwapDialog.java b/MekHQ/src/mekhq/gui/dialog/LargeCraftAmmoSwapDialog.java
index 0b249c03c2..fa5533fb1e 100644
--- a/MekHQ/src/mekhq/gui/dialog/LargeCraftAmmoSwapDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/LargeCraftAmmoSwapDialog.java
@@ -38,6 +38,7 @@
import mekhq.campaign.parts.equipment.LargeCraftAmmoBin;
import mekhq.campaign.unit.Unit;
import mekhq.campaign.unit.actions.AdjustLargeCraftAmmoAction;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Neoancient
@@ -55,7 +56,7 @@ public LargeCraftAmmoSwapDialog(final JFrame frame, final Unit unit) {
getContentPane().setLayout(new BorderLayout());
mainPanel = new BayMunitionsChoicePanel(unit.getEntity(), unit.getCampaign().getGame());
- getContentPane().add(new JScrollPane(mainPanel), BorderLayout.CENTER);
+ getContentPane().add(new JScrollPaneWithSpeed(mainPanel), BorderLayout.CENTER);
JPanel panButtons = new JPanel();
JButton button = new JButton("OK");
button.addActionListener(ev -> apply());
diff --git a/MekHQ/src/mekhq/gui/dialog/LootDialog.java b/MekHQ/src/mekhq/gui/dialog/LootDialog.java
index 028f4f4168..fdc84a453b 100644
--- a/MekHQ/src/mekhq/gui/dialog/LootDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/LootDialog.java
@@ -40,6 +40,7 @@
import mekhq.campaign.finances.Money;
import mekhq.campaign.mission.Loot;
import mekhq.campaign.parts.Part;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Taharqa
@@ -183,7 +184,7 @@ private void initComponents() {
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
- scrUnits = new JScrollPane(listUnits);
+ scrUnits = new JScrollPaneWithSpeed(listUnits);
listUnits.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
listUnits.getSelectionModel().addListSelectionListener(evt -> listUnitsValueChanged());
refreshUnitList();
@@ -226,7 +227,7 @@ private void initComponents() {
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
- scrParts = new JScrollPane(listParts);
+ scrParts = new JScrollPaneWithSpeed(listParts);
listParts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
listParts.getSelectionModel().addListSelectionListener(evt -> listPartsValueChanged());
refreshPartList();
diff --git a/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java b/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java
index 7c610b600a..5e54ad82c7 100644
--- a/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/MHQOptionsDialog.java
@@ -36,6 +36,7 @@
import mekhq.gui.baseComponents.AbstractMHQButtonDialog;
import mekhq.gui.enums.ForceIconOperationalStatusStyle;
import mekhq.gui.enums.PersonnelFilterStyle;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
@@ -222,16 +223,22 @@ public MHQOptionsDialog(final JFrame frame) {
protected Container createCenterPane() {
JTabbedPane optionsTabbedPane = new JTabbedPane();
optionsTabbedPane.setName("optionsTabbedPane");
- optionsTabbedPane.add(resources.getString("displayTab.title"), new JScrollPane(createDisplayTab()));
- optionsTabbedPane.add(resources.getString("coloursTab.title"), new JScrollPane(createColoursTab()));
- optionsTabbedPane.add(resources.getString("fontsTab.title"), new JScrollPane(createFontsTab()));
- optionsTabbedPane.add(resources.getString("autosaveTab.title"), new JScrollPane(createAutosaveTab()));
- optionsTabbedPane.add(resources.getString("newDayTab.title"), new JScrollPane(createNewDayTab()));
+ optionsTabbedPane.add(resources.getString("displayTab.title"),
+ new JScrollPaneWithSpeed(createDisplayTab()));
+ optionsTabbedPane.add(resources.getString("coloursTab.title"),
+ new JScrollPaneWithSpeed(createColoursTab()));
+ optionsTabbedPane.add(resources.getString("fontsTab.title"),
+ new JScrollPaneWithSpeed(createFontsTab()));
+ optionsTabbedPane.add(resources.getString("autosaveTab.title"),
+ new JScrollPaneWithSpeed(createAutosaveTab()));
+ optionsTabbedPane.add(resources.getString("newDayTab.title"),
+ new JScrollPaneWithSpeed(createNewDayTab()));
optionsTabbedPane.add(resources.getString("campaignXMLSaveTab.title"),
- new JScrollPane(createCampaignXMLSaveTab()));
- optionsTabbedPane.add(resources.getString("nagTab.title"), new JScrollPane(createNagTab()));
+ new JScrollPaneWithSpeed(createCampaignXMLSaveTab()));
+ optionsTabbedPane.add(resources.getString("nagTab.title"),
+ new JScrollPaneWithSpeed(createNagTab()));
optionsTabbedPane.add(resources.getString("miscellaneousTab.title"),
- new JScrollPane(createMiscellaneousTab()));
+ new JScrollPaneWithSpeed(createMiscellaneousTab()));
return optionsTabbedPane;
}
diff --git a/MekHQ/src/mekhq/gui/dialog/MRMSDialog.java b/MekHQ/src/mekhq/gui/dialog/MRMSDialog.java
index c7e5a1a60b..fc82ce557e 100644
--- a/MekHQ/src/mekhq/gui/dialog/MRMSDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/MRMSDialog.java
@@ -39,6 +39,7 @@
import mekhq.gui.sorter.PartsDetailSorter;
import mekhq.gui.sorter.UnitStatusSorter;
import mekhq.gui.sorter.UnitTypeSorter;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.service.enums.MRMSMode;
import mekhq.service.mrms.MRMSConfiguredOptions;
import mekhq.service.mrms.MRMSOption;
@@ -287,7 +288,7 @@ private void initComponents() {
pnlMain.add(createOptionsPanel(), createBaseConstraints(2));
- content.add(new JScrollPane(pnlMain), BorderLayout.CENTER);
+ content.add(new JScrollPaneWithSpeed(pnlMain), BorderLayout.CENTER);
content.add(createActionButtons(), BorderLayout.SOUTH);
pack();
@@ -345,7 +346,7 @@ private JPanel createUnitsPanel() {
unitTable.setIntercellSpacing(new Dimension(0, 0));
unitTable.setShowGrid(false);
- scrollUnitList = new JScrollPane(unitTable);
+ scrollUnitList = new JScrollPaneWithSpeed(unitTable);
scrollUnitList.setMinimumSize(new Dimension(350, 200));
scrollUnitList.setPreferredSize(new Dimension(350, 200));
@@ -394,7 +395,7 @@ private JPanel createPartsPanel() {
partsTable.setIntercellSpacing(new Dimension(0, 0));
partsTable.setShowGrid(false);
- scrollPartsTable = new JScrollPane(partsTable);
+ scrollPartsTable = new JScrollPaneWithSpeed(partsTable);
scrollPartsTable.setMinimumSize(new Dimension(350, 200));
scrollPartsTable.setPreferredSize(new Dimension(350, 200));
diff --git a/MekHQ/src/mekhq/gui/dialog/ManageAssetsDialog.java b/MekHQ/src/mekhq/gui/dialog/ManageAssetsDialog.java
index 875a414408..3feaf47d7e 100644
--- a/MekHQ/src/mekhq/gui/dialog/ManageAssetsDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/ManageAssetsDialog.java
@@ -51,6 +51,7 @@
import mekhq.campaign.event.AssetRemovedEvent;
import mekhq.campaign.finances.Asset;
import mekhq.gui.model.DataTableModel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Taharqa
@@ -117,7 +118,7 @@ private void initComponents() {
assetTable.setShowGrid(false);
assetTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
assetTable.getSelectionModel().addListSelectionListener(this::assetTableValueChanged);
- scrollAssetTable = new JScrollPane(assetTable);
+ scrollAssetTable = new JScrollPaneWithSpeed(assetTable);
getContentPane().add(scrollAssetTable, BorderLayout.CENTER);
btnOK.setText(resourceMap.getString("btnOK.text"));
diff --git a/MekHQ/src/mekhq/gui/dialog/MassMothballDialog.java b/MekHQ/src/mekhq/gui/dialog/MassMothballDialog.java
index 4233af0057..b8604ff9d8 100644
--- a/MekHQ/src/mekhq/gui/dialog/MassMothballDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/MassMothballDialog.java
@@ -49,6 +49,7 @@
import mekhq.campaign.personnel.Person;
import mekhq.campaign.unit.Unit;
import mekhq.gui.adapter.UnitTableMouseAdapter;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* This class handles the display of the Mass Mothball/Reactivate dialog
@@ -115,7 +116,7 @@ public MassMothballDialog(final JFrame frame, final Unit[] units, final Campaign
gbc.gridy++;
addExecuteButton(activating, gbc);
- JScrollPane scrollPane = new JScrollPane();
+ JScrollPane scrollPane = new JScrollPaneWithSpeed();
scrollPane.setViewportView(contentPanel);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setMaximumSize(new Dimension(600, 600));
@@ -196,7 +197,7 @@ private void addUnitTypePanel(int unitType, GridBagConstraints gbc) {
techList.setBorder(new LineBorder(Color.GRAY, 1));
techList.setCellRenderer(new TechListCellRenderer());
- JScrollPane techListPane = new JScrollPane();
+ JScrollPane techListPane = new JScrollPaneWithSpeed();
techListPane.setViewportView(techList);
techListPane.setMaximumSize(new Dimension(200, 100));
techListPane.setPreferredSize(new Dimension(200, 50));
diff --git a/MekHQ/src/mekhq/gui/dialog/MedicalViewDialog.java b/MekHQ/src/mekhq/gui/dialog/MedicalViewDialog.java
index 75e916c7ef..b4a8582c1a 100644
--- a/MekHQ/src/mekhq/gui/dialog/MedicalViewDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/MedicalViewDialog.java
@@ -34,6 +34,7 @@
import mekhq.campaign.personnel.InjuryType;
import mekhq.campaign.personnel.Person;
import mekhq.campaign.personnel.enums.InjuryLevel;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.view.Paperdoll;
import javax.swing.*;
@@ -167,7 +168,7 @@ public MedicalViewDialog(Window parent, Campaign c, Person p) {
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
Container scrollPanel = new JPanel();
- getContentPane().add(new JScrollPane(scrollPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ getContentPane().add(new JScrollPaneWithSpeed(scrollPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
initComponents(scrollPanel);
diff --git a/MekHQ/src/mekhq/gui/dialog/MekViewDialog.java b/MekHQ/src/mekhq/gui/dialog/MekViewDialog.java
index 2f6abc24eb..9ad4de2d84 100644
--- a/MekHQ/src/mekhq/gui/dialog/MekViewDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/MekViewDialog.java
@@ -35,6 +35,7 @@
import megamek.common.MekView;
import megamek.logging.MMLogger;
import mekhq.MekHQ;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Jay Lawson (jaylawson39 at yahoo.com)
@@ -58,7 +59,7 @@ public MekViewDialog(JFrame parent, boolean modal, MekView mv) {
private void initComponents() {
- jScrollPane2 = new JScrollPane();
+ jScrollPane2 = new JScrollPaneWithSpeed();
txtMek = new JTextPane();
btnOkay = new JButton();
diff --git a/MekHQ/src/mekhq/gui/dialog/NewContractDialog.java b/MekHQ/src/mekhq/gui/dialog/NewContractDialog.java
index a3de37ef32..8ed053fe05 100644
--- a/MekHQ/src/mekhq/gui/dialog/NewContractDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/NewContractDialog.java
@@ -49,6 +49,7 @@
import mekhq.campaign.personnel.SkillType;
import mekhq.campaign.universe.PlanetarySystem;
import mekhq.campaign.universe.Systems;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.utilities.JSuggestField;
import mekhq.gui.utilities.MarkdownEditorPanel;
import mekhq.gui.view.ContractPaymentBreakdown;
@@ -185,7 +186,7 @@ protected void initComponents() {
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
newContractPanel.add(btnClose, gridBagConstraints);
- JScrollPane scrollPane = new JScrollPane(newContractPanel);
+ JScrollPane scrollPane = new JScrollPaneWithSpeed(newContractPanel);
getContentPane().add(scrollPane);
diff --git a/MekHQ/src/mekhq/gui/dialog/NewLoanDialog.java b/MekHQ/src/mekhq/gui/dialog/NewLoanDialog.java
index 8540ba1e2b..0af6093b80 100644
--- a/MekHQ/src/mekhq/gui/dialog/NewLoanDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/NewLoanDialog.java
@@ -20,24 +20,6 @@
*/
package mekhq.gui.dialog;
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.text.NumberFormat;
-import java.util.ResourceBundle;
-
-import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.text.DefaultFormatterFactory;
-import javax.swing.text.NumberFormatter;
-
import megamek.client.ui.baseComponents.MMComboBox;
import megamek.client.ui.preferences.JWindowPreference;
import megamek.client.ui.preferences.PreferencesNode;
@@ -48,6 +30,20 @@
import mekhq.campaign.finances.Money;
import mekhq.campaign.finances.enums.FinancialTerm;
+import javax.swing.*;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.DefaultFormatterFactory;
+import javax.swing.text.NumberFormatter;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.text.NumberFormat;
+import java.util.Objects;
+import java.util.ResourceBundle;
+
/**
* @author Taharqa
*/
@@ -627,11 +623,11 @@ public void actionPerformed(ActionEvent e) {
@Override
public void stateChanged(ChangeEvent e) {
if (campaign.getCampaignOptions().isUseLoanLimits()) {
- if (e.getSource() == sldInterest) {
+ if (Objects.equals(e.getSource(), sldInterest)) {
sldCollateral.removeChangeListener(this);
sldCollateral.setValue(Loan.recalculateCollateralFromInterest(rating, sldInterest.getValue()));
sldCollateral.addChangeListener(this);
- } else if (e.getSource() == sldCollateral) {
+ } else if (Objects.equals(e.getSource(), sldCollateral)) {
sldInterest.removeChangeListener(this);
sldInterest.setValue(Loan.recalculateInterestFromCollateral(rating, sldCollateral.getValue()));
sldInterest.addChangeListener(this);
diff --git a/MekHQ/src/mekhq/gui/dialog/NewRecruitDialog.java b/MekHQ/src/mekhq/gui/dialog/NewRecruitDialog.java
index 6f8bbd91c0..309974609a 100644
--- a/MekHQ/src/mekhq/gui/dialog/NewRecruitDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/NewRecruitDialog.java
@@ -48,6 +48,7 @@
import mekhq.campaign.personnel.randomEvents.PersonalityController;
import mekhq.gui.CampaignGUI;
import mekhq.gui.displayWrappers.RankDisplay;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.gui.view.PersonViewPanel;
/**
@@ -82,7 +83,7 @@ private void refreshView() {
}
private void initComponents() {
- scrollView = new JScrollPane();
+ scrollView = new JScrollPaneWithSpeed();
choiceRanks = new JComboBox<>();
final ResourceBundle resourceMap = ResourceBundle.getBundle("mekhq.resources.NewRecruitDialog",
diff --git a/MekHQ/src/mekhq/gui/dialog/ObjectiveEditPanel.java b/MekHQ/src/mekhq/gui/dialog/ObjectiveEditPanel.java
index 63873cb8aa..7174361363 100644
--- a/MekHQ/src/mekhq/gui/dialog/ObjectiveEditPanel.java
+++ b/MekHQ/src/mekhq/gui/dialog/ObjectiveEditPanel.java
@@ -27,6 +27,7 @@
import mekhq.campaign.mission.ScenarioObjective;
import mekhq.campaign.mission.ScenarioObjective.ObjectiveCriterion;
import mekhq.campaign.mission.ScenarioObjective.TimeLimitType;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
import mekhq.campaign.mission.ScenarioTemplate;
import javax.swing.*;
@@ -185,7 +186,7 @@ private void addSaveCloseButtons(GridBagConstraints gbc) {
private void addDescriptionUI(GridBagConstraints gbc) {
lblShortDescription = new JLabel("Short Description:");
- JScrollPane txtScroll = new JScrollPane();
+ JScrollPane txtScroll = new JScrollPaneWithSpeed();
txtShortDescription = new JTextArea();
txtShortDescription.setColumns(40);
txtShortDescription.setRows(5);
diff --git a/MekHQ/src/mekhq/gui/dialog/PartsReportDialog.java b/MekHQ/src/mekhq/gui/dialog/PartsReportDialog.java
index 19f1f1fcdb..b1cf0f1e5a 100644
--- a/MekHQ/src/mekhq/gui/dialog/PartsReportDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/PartsReportDialog.java
@@ -57,6 +57,7 @@
import mekhq.gui.model.PartsInUseTableModel;
import mekhq.gui.sorter.FormattedNumberSorter;
import mekhq.gui.sorter.TwoNumbersSorter;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* A dialog to show parts in use, ordered, in transit with actionable buttons for buying or adding more
@@ -260,7 +261,7 @@ public void actionPerformed(ActionEvent e) {
PartsInUseTableModel.COL_BUTTON_GMADD_BULK);
- JScrollPane tableScroll = new JScrollPane(overviewPartsInUseTable);
+ JScrollPane tableScroll = new JScrollPaneWithSpeed(overviewPartsInUseTable);
ignoreMothballedCheck = new JCheckBox(resourceMap.getString("chkIgnoreMothballed.text"));
ignoreMothballedCheck.addActionListener(evt -> refreshOverviewPartsInUse());
diff --git a/MekHQ/src/mekhq/gui/dialog/PartsStoreDialog.java b/MekHQ/src/mekhq/gui/dialog/PartsStoreDialog.java
index 0cd896a886..eeba1f1e6e 100644
--- a/MekHQ/src/mekhq/gui/dialog/PartsStoreDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/PartsStoreDialog.java
@@ -58,6 +58,7 @@
import mekhq.gui.CampaignGUI;
import mekhq.gui.dialog.PartsStoreDialog.PartsTableModel.PartProxy;
import mekhq.gui.sorter.PartsDetailSorter;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* @author Taharqa
@@ -140,7 +141,7 @@ private void initComponents() {
}
partsTable.setIntercellSpacing(new Dimension(0, 0));
partsTable.setShowGrid(false);
- JScrollPane scrollPartsTable = new JScrollPane();
+ JScrollPane scrollPartsTable = new JScrollPaneWithSpeed();
scrollPartsTable.setName("scrollPartsTable");
scrollPartsTable.setViewportView(partsTable);
getContentPane().add(scrollPartsTable, BorderLayout.CENTER);
diff --git a/MekHQ/src/mekhq/gui/dialog/PayCollateralDialog.java b/MekHQ/src/mekhq/gui/dialog/PayCollateralDialog.java
index d8b52dd32c..62b5a6c577 100644
--- a/MekHQ/src/mekhq/gui/dialog/PayCollateralDialog.java
+++ b/MekHQ/src/mekhq/gui/dialog/PayCollateralDialog.java
@@ -47,6 +47,7 @@
import mekhq.campaign.parts.AmmoStorage;
import mekhq.campaign.parts.Part;
import mekhq.campaign.unit.Unit;
+import mekhq.gui.utilities.JScrollPaneWithSpeed;
/**
* A dialog to decide how you want to pay off collateral when you
@@ -134,7 +135,7 @@ private void initComponents() {
pnlUnits.add(box, gridBagConstraints);
i++;
}
- JScrollPane scrUnits = new JScrollPane();
+ JScrollPane scrUnits = new JScrollPaneWithSpeed();
scrUnits.setViewportView(pnlUnits);
scrUnits.setMinimumSize(new Dimension(400, 300));
scrUnits.setPreferredSize(new Dimension(400, 300));
@@ -181,7 +182,7 @@ private void initComponents() {
+ p.getActualValue().toAmountAndSymbolString() + "