diff --git a/MekHQ/src/mekhq/gui/BriefingTab.java b/MekHQ/src/mekhq/gui/BriefingTab.java index b420870c1f..e4c54b22ec 100644 --- a/MekHQ/src/mekhq/gui/BriefingTab.java +++ b/MekHQ/src/mekhq/gui/BriefingTab.java @@ -55,6 +55,7 @@ import mekhq.gui.enums.MHQTabType; import mekhq.gui.model.ScenarioTableModel; import mekhq.gui.sorter.DateStringComparator; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.view.AtBScenarioViewPanel; import mekhq.gui.view.LanceAssignmentView; import mekhq.gui.view.MissionViewPanel; @@ -187,7 +188,7 @@ public void initTab() { btnGMGenerateScenarios.addActionListener(ev -> gmGenerateScenarios()); panMissionButtons.add(btnGMGenerateScenarios); - scrollMissionView = new JScrollPane(); + scrollMissionView = new JScrollPaneWithSpeed(); scrollMissionView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollMissionView.setViewportView(null); gridBagConstraints = new GridBagConstraints(); @@ -272,7 +273,7 @@ public void initTab() { btnClearAssignedUnits.setEnabled(false); panScenarioButtons.add(btnClearAssignedUnits); - scrollScenarioView = new JScrollPane(); + scrollScenarioView = new JScrollPaneWithSpeed(); scrollScenarioView.setViewportView(null); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; @@ -285,7 +286,7 @@ public void initTab() { /* ATB */ panLanceAssignment = new LanceAssignmentView(getCampaign()); - JScrollPane paneLanceDeployment = new JScrollPane(panLanceAssignment); + JScrollPane paneLanceDeployment = new JScrollPaneWithSpeed(panLanceAssignment); paneLanceDeployment.setMinimumSize(new Dimension(200, 300)); paneLanceDeployment.setPreferredSize(new Dimension(200, 300)); paneLanceDeployment.setVisible(getCampaign().getCampaignOptions().isUseAtB()); diff --git a/MekHQ/src/mekhq/gui/CommandCenterTab.java b/MekHQ/src/mekhq/gui/CommandCenterTab.java index da5fe5da76..99b7a36e58 100644 --- a/MekHQ/src/mekhq/gui/CommandCenterTab.java +++ b/MekHQ/src/mekhq/gui/CommandCenterTab.java @@ -45,6 +45,7 @@ import mekhq.gui.model.ProcurementTableModel; import mekhq.gui.sorter.FormattedNumberSorter; import mekhq.gui.sorter.TargetSorter; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.service.enums.MRMSMode; import mekhq.service.mrms.MRMSService; @@ -374,7 +375,7 @@ private void initObjectivesPanel() { listObjectives.setModel(new DefaultListModel<>()); refreshObjectives(); - panObjectives.add(new JScrollPane(listObjectives), BorderLayout.CENTER); + panObjectives.add(new JScrollPaneWithSpeed(listObjectives), BorderLayout.CENTER); } /** @@ -488,7 +489,7 @@ public void actionPerformed(ActionEvent e) { } }); - JScrollPane scrollProcurement = new JScrollPane(procurementTable); + JScrollPane scrollProcurement = new JScrollPaneWithSpeed(procurementTable); panProcurement = new JPanel(new GridBagLayout()); panProcurement.setBorder(BorderFactory.createTitledBorder(resourceMap.getString("panProcurement.title"))); GridBagConstraints gridBagConstraints = new GridBagConstraints(); diff --git a/MekHQ/src/mekhq/gui/DailyReportLogPanel.java b/MekHQ/src/mekhq/gui/DailyReportLogPanel.java index 322be7a034..85f7ed0f94 100644 --- a/MekHQ/src/mekhq/gui/DailyReportLogPanel.java +++ b/MekHQ/src/mekhq/gui/DailyReportLogPanel.java @@ -23,6 +23,7 @@ import megamek.codeUtilities.StringUtility; import mekhq.Utilities; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -91,7 +92,7 @@ public boolean getScrollableTracksViewportWidth() { getTxtLog().getAccessibleContext().setAccessibleName("Daily Log"); getTxtLog().addHyperlinkListener(gui.getReportHLL()); - final JScrollPane logPanel = new JScrollPane(getTxtLog()); + final JScrollPane logPanel = new JScrollPaneWithSpeed(getTxtLog()); logPanel.setBorder(new EmptyBorder(2,5,2,2)); add(logPanel, BorderLayout.CENTER); } diff --git a/MekHQ/src/mekhq/gui/FinancesTab.java b/MekHQ/src/mekhq/gui/FinancesTab.java index 2ba6a4d8ad..0c089d7075 100644 --- a/MekHQ/src/mekhq/gui/FinancesTab.java +++ b/MekHQ/src/mekhq/gui/FinancesTab.java @@ -35,6 +35,8 @@ import mekhq.gui.enums.MHQTabType; import mekhq.gui.model.FinanceTableModel; import mekhq.gui.model.LoanTableModel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; + import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; @@ -125,7 +127,7 @@ public void initTab() { } loanTable.setIntercellSpacing(new Dimension(0, 0)); loanTable.setShowGrid(false); - JScrollPane scrollLoanTable = new JScrollPane(loanTable); + JScrollPane scrollLoanTable = new JScrollPaneWithSpeed(loanTable); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; @@ -135,7 +137,7 @@ public void initTab() { gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; JPanel panBalance = new JPanel(new GridBagLayout()); - panBalance.add(new JScrollPane(financeTable), gridBagConstraints); + panBalance.add(new JScrollPaneWithSpeed(financeTable), gridBagConstraints); panBalance.setMinimumSize(new Dimension(350, 100)); panBalance.setBorder(BorderFactory.createTitledBorder("Balance Sheet")); JPanel panLoan = new JPanel(new GridBagLayout()); @@ -189,7 +191,7 @@ public void initTab() { areaNetWorth.setText(getFormattedFinancialReport()); areaNetWorth.setEditable(false); - JScrollPane descriptionScroll = new JScrollPane(areaNetWorth); + JScrollPane descriptionScroll = new JScrollPaneWithSpeed(areaNetWorth); panelFinanceRight.add(descriptionScroll, BorderLayout.CENTER); areaNetWorth.setCaretPosition(0); descriptionScroll.setMinimumSize(new Dimension(300, 200)); diff --git a/MekHQ/src/mekhq/gui/HangarTab.java b/MekHQ/src/mekhq/gui/HangarTab.java index fb70d2b2d8..43f0eed589 100644 --- a/MekHQ/src/mekhq/gui/HangarTab.java +++ b/MekHQ/src/mekhq/gui/HangarTab.java @@ -38,6 +38,7 @@ import mekhq.gui.enums.MHQTabType; import mekhq.gui.model.UnitTableModel; import mekhq.gui.sorter.*; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.view.UnitViewPanel; import javax.swing.*; @@ -187,9 +188,9 @@ public void initTab() { changeUnitView(); unitTable.getSelectionModel().addListSelectionListener(ev -> refreshUnitView()); - JScrollPane scrollUnitTable = new JScrollPane(unitTable); + JScrollPane scrollUnitTable = new JScrollPaneWithSpeed(unitTable); - scrollUnitView = new JScrollPane(); + scrollUnitView = new JScrollPaneWithSpeed(); scrollUnitView.setMinimumSize(new Dimension(UNIT_VIEW_WIDTH, 600)); scrollUnitView.setPreferredSize(new Dimension(UNIT_VIEW_WIDTH, 600)); scrollUnitView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); diff --git a/MekHQ/src/mekhq/gui/InfirmaryTab.java b/MekHQ/src/mekhq/gui/InfirmaryTab.java index 8ec1696748..abf943bf4e 100644 --- a/MekHQ/src/mekhq/gui/InfirmaryTab.java +++ b/MekHQ/src/mekhq/gui/InfirmaryTab.java @@ -31,6 +31,7 @@ import mekhq.gui.model.DocTableModel; import mekhq.gui.model.PatientTableModel; import mekhq.gui.sorter.PersonTitleSorter; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import javax.swing.*; import java.awt.*; @@ -84,7 +85,7 @@ public void initTab() { docTable.getColumnModel().getColumn(0).setCellRenderer(doctorsModel.getRenderer()); docTable.getSelectionModel().addListSelectionListener(ev -> docTableValueChanged()); docTable.setOpaque(false); - JScrollPane scrollDocTable = new JScrollPane(docTable); + JScrollPane scrollDocTable = new JScrollPaneWithSpeed(docTable); scrollDocTable.setMinimumSize(new Dimension(300, 300)); scrollDocTable.setPreferredSize(new Dimension(300, 300)); scrollDocTable.setOpaque(false); @@ -125,7 +126,7 @@ public void initTab() { listAssignedPatient.setVisibleRowCount(-1); listAssignedPatient.getSelectionModel().addListSelectionListener(ev -> updateAssignDoctorEnabled()); listAssignedPatient.setOpaque(false); - JScrollPane scrollAssignedPatient = new JScrollPane(listAssignedPatient); + JScrollPane scrollAssignedPatient = new JScrollPaneWithSpeed(listAssignedPatient); scrollAssignedPatient.setMinimumSize(new Dimension(300, 360)); scrollAssignedPatient.setPreferredSize(new Dimension(300, 360)); scrollAssignedPatient.setOpaque(false); @@ -137,7 +138,7 @@ public void initTab() { listUnassignedPatient.setVisibleRowCount(-1); listUnassignedPatient.getSelectionModel().addListSelectionListener(ev -> updateAssignDoctorEnabled()); listUnassignedPatient.setOpaque(false); - JScrollPane scrollUnassignedPatient = new JScrollPane(listUnassignedPatient); + JScrollPane scrollUnassignedPatient = new JScrollPaneWithSpeed(listUnassignedPatient); scrollUnassignedPatient.setMinimumSize(new Dimension(300, 200)); scrollUnassignedPatient.setPreferredSize(new Dimension(300, 300)); scrollUnassignedPatient.setOpaque(false); diff --git a/MekHQ/src/mekhq/gui/MapTab.java b/MekHQ/src/mekhq/gui/MapTab.java index 36a4f8d25e..03466a8596 100644 --- a/MekHQ/src/mekhq/gui/MapTab.java +++ b/MekHQ/src/mekhq/gui/MapTab.java @@ -27,6 +27,7 @@ import mekhq.campaign.universe.Planet; import mekhq.campaign.universe.PlanetarySystem; import mekhq.gui.enums.MHQTabType; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.utilities.JSuggestField; import mekhq.gui.view.JumpPathViewPanel; import mekhq.gui.view.PlanetViewPanel; @@ -136,7 +137,7 @@ public void initTab() { mapView.setMinimumSize(new Dimension(600,600)); mapView.setView(panMapView); - scrollPlanetView = new JScrollPane(); + scrollPlanetView = new JScrollPaneWithSpeed(); scrollPlanetView.setMinimumSize(new Dimension(400, 600)); scrollPlanetView.setPreferredSize(new Dimension(400, 600)); scrollPlanetView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); diff --git a/MekHQ/src/mekhq/gui/MekLabTab.java b/MekHQ/src/mekhq/gui/MekLabTab.java index d9c060f3bd..8e9ced42b4 100644 --- a/MekHQ/src/mekhq/gui/MekLabTab.java +++ b/MekHQ/src/mekhq/gui/MekLabTab.java @@ -77,6 +77,7 @@ import mekhq.campaign.parts.Refit; import mekhq.campaign.unit.Unit; import mekhq.gui.enums.MHQTabType; +import mekhq.gui.utilities.JScrollPaneWithSpeed; public class MekLabTab extends CampaignGuiTab { private static final MMLogger logger = MMLogger.create(MekLabTab.class); @@ -535,11 +536,11 @@ public void reloadTabs() { buildTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure/Armor", new JScrollPane(structureTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Assign Criticals", new JScrollPane(buildTab)); - addTab("Fluff", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Structure/Armor", new JScrollPaneWithSpeed(structureTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Assign Criticals", new JScrollPaneWithSpeed(buildTab)); + addTab("Fluff", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } @@ -664,12 +665,12 @@ public void reloadTabs() { transportTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure/Armor", new JScrollPane(structureTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Assign Criticals", new JScrollPane(buildTab)); - addTab("Transport Bays", new JScrollPane(transportTab)); - addTab("Fluff", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Structure/Armor", new JScrollPaneWithSpeed(structureTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Assign Criticals", new JScrollPaneWithSpeed(buildTab)); + addTab("Transport Bays", new JScrollPaneWithSpeed(transportTab)); + addTab("Fluff", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } @@ -792,11 +793,11 @@ public void reloadTabs() { buildTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure/Armor", new JScrollPane(structureTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Assign Critical", new JScrollPane(buildTab)); - addTab("Fluff", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Structure/Armor", new JScrollPaneWithSpeed(structureTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Assign Critical", new JScrollPaneWithSpeed(buildTab)); + addTab("Fluff", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } @@ -916,11 +917,11 @@ public void reloadTabs() { buildTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure", new JScrollPane(structureTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Build", new JScrollPane(buildTab)); - addTab("Fluff", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Structure", new JScrollPaneWithSpeed(structureTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Build", new JScrollPaneWithSpeed(buildTab)); + addTab("Fluff", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } @@ -1046,13 +1047,13 @@ void reloadTabs() { transportTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure", new JScrollPane(structureTab)); - addTab("Armor", new JScrollPane(armorTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Build", new JScrollPane(buildTab)); - addTab("Transport", new JScrollPane(transportTab)); - addTab("Fluff", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Structure", new JScrollPaneWithSpeed(structureTab)); + addTab("Armor", new JScrollPaneWithSpeed(armorTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Build", new JScrollPaneWithSpeed(buildTab)); + addTab("Transport", new JScrollPaneWithSpeed(transportTab)); + addTab("Fluff", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } @@ -1174,10 +1175,10 @@ public void reloadTabs() { buildTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure", new JScrollPane(structureTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Assign Criticals", new JScrollPane(buildTab)); - addTab("Fluff", new JScrollPane(fluffTab)); + addTab("Structure", new JScrollPaneWithSpeed(structureTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Assign Criticals", new JScrollPaneWithSpeed(buildTab)); + addTab("Fluff", new JScrollPaneWithSpeed(fluffTab)); this.repaint(); } @@ -1290,9 +1291,9 @@ public void reloadTabs() { FluffTab fluffTab = new FluffTab(this); fluffTab.setRefreshedListener(this); - addTab("Build", new JScrollPane(structureTab)); - addTab("Fluff", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Build", new JScrollPaneWithSpeed(structureTab)); + addTab("Fluff", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } @@ -1408,11 +1409,11 @@ void reloadTabs() { buildTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure/Armor", new JScrollPane(structureTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Assign Critical", new JScrollPane(buildTab)); - addTab("FluffTab", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Structure/Armor", new JScrollPaneWithSpeed(structureTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Assign Critical", new JScrollPaneWithSpeed(buildTab)); + addTab("FluffTab", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } @@ -1538,12 +1539,12 @@ void reloadTabs() { transportTab.addRefreshedListener(this); fluffTab.setRefreshedListener(this); - addTab("Structure/Armor", new JScrollPane(structureTab)); - addTab("Equipment", new JScrollPane(equipmentTab)); - addTab("Assign Criticals", new JScrollPane(buildTab)); - addTab("Transport Bays", new JScrollPane(transportTab)); - addTab("FluffTab", new JScrollPane(fluffTab)); - addTab("Preview", new JScrollPane(previewTab)); + addTab("Structure/Armor", new JScrollPaneWithSpeed(structureTab)); + addTab("Equipment", new JScrollPaneWithSpeed(equipmentTab)); + addTab("Assign Criticals", new JScrollPaneWithSpeed(buildTab)); + addTab("Transport Bays", new JScrollPaneWithSpeed(transportTab)); + addTab("FluffTab", new JScrollPaneWithSpeed(fluffTab)); + addTab("Preview", new JScrollPaneWithSpeed(previewTab)); this.repaint(); } diff --git a/MekHQ/src/mekhq/gui/PersonnelTab.java b/MekHQ/src/mekhq/gui/PersonnelTab.java index bc167eb3ba..3034c170b7 100644 --- a/MekHQ/src/mekhq/gui/PersonnelTab.java +++ b/MekHQ/src/mekhq/gui/PersonnelTab.java @@ -54,6 +54,7 @@ import mekhq.gui.enums.PersonnelTabView; import mekhq.gui.enums.PersonnelTableModelColumn; import mekhq.gui.model.PersonnelTableModel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.view.PersonViewPanel; /** @@ -210,13 +211,13 @@ public Component getListCellRendererComponent(final JList list, final Object changePersonnelView(); personnelTable.getSelectionModel().addListSelectionListener(ev -> refreshPersonnelView()); - scrollPersonnelView = new JScrollPane(); + scrollPersonnelView = new JScrollPaneWithSpeed(); scrollPersonnelView.setMinimumSize(new Dimension(PERSONNEL_VIEW_WIDTH, 600)); scrollPersonnelView.setPreferredSize(new Dimension(PERSONNEL_VIEW_WIDTH, 600)); scrollPersonnelView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPersonnelView.setViewportView(null); - JScrollPane scrollPersonnelTable = new JScrollPane(personnelTable); + JScrollPane scrollPersonnelTable = new JScrollPaneWithSpeed(personnelTable); splitPersonnel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPersonnelTable, scrollPersonnelView); splitPersonnel.setOneTouchExpandable(true); diff --git a/MekHQ/src/mekhq/gui/RepairTab.java b/MekHQ/src/mekhq/gui/RepairTab.java index 6150faf858..0efdd07092 100644 --- a/MekHQ/src/mekhq/gui/RepairTab.java +++ b/MekHQ/src/mekhq/gui/RepairTab.java @@ -71,6 +71,7 @@ import mekhq.gui.sorter.TechSorter; import mekhq.gui.sorter.UnitStatusSorter; import mekhq.gui.sorter.UnitTypeSorter; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.service.PartsAcquisitionService; import mekhq.service.enums.MRMSMode; import mekhq.service.mrms.MRMSService; @@ -239,14 +240,14 @@ public void initTab() { servicedUnitTable.setShowGrid(false); servicedUnitTable.getSelectionModel().addListSelectionListener(this::servicedUnitTableValueChanged); ServicedUnitsTableMouseAdapter.connect(getCampaignGui(), servicedUnitTable, servicedUnitModel); - JScrollPane scrollServicedUnitTable = new JScrollPane(servicedUnitTable); + JScrollPane scrollServicedUnitTable = new JScrollPaneWithSpeed(servicedUnitTable); scrollServicedUnitTable.setMinimumSize(new Dimension(350, 200)); scrollServicedUnitTable.setPreferredSize(new Dimension(350, 200)); txtServicedUnitView = new JTextPane(); txtServicedUnitView.setEditable(false); txtServicedUnitView.setContentType("text/html"); - scrollServicedUnitView = new JScrollPane(txtServicedUnitView); + scrollServicedUnitView = new JScrollPaneWithSpeed(txtServicedUnitView); scrollServicedUnitView.setMinimumSize(new Dimension(350, 400)); scrollServicedUnitView.setPreferredSize(new Dimension(350, 400)); @@ -275,7 +276,7 @@ public void initTab() { sortKeys = new ArrayList<>(); sortKeys.add(new RowSorter.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)); @@ -340,7 +341,7 @@ public void initTab() { textTarget.setWrapStyleWord(true); textTarget.setBorder(null); textTarget.setName("textTarget"); - scrTextTarget = new JScrollPane(textTarget); + scrTextTarget = new JScrollPaneWithSpeed(textTarget); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; @@ -393,7 +394,7 @@ public void initTab() { sortKeys.add(new RowSorter.SortKey(0, SortOrder.ASCENDING)); taskSorter.setSortKeys(sortKeys); TaskTableMouseAdapter.connect(getCampaignGui(), taskTable, taskModel); - JScrollPane scrollTaskTable = new JScrollPane(taskTable); + JScrollPane scrollTaskTable = new JScrollPaneWithSpeed(taskTable); scrollTaskTable.setMinimumSize(new Dimension(200, 200)); scrollTaskTable.setPreferredSize(new Dimension(300, 300)); diff --git a/MekHQ/src/mekhq/gui/StratconTab.java b/MekHQ/src/mekhq/gui/StratconTab.java index 0fdaf6da9d..66fb5db9d6 100644 --- a/MekHQ/src/mekhq/gui/StratconTab.java +++ b/MekHQ/src/mekhq/gui/StratconTab.java @@ -26,6 +26,7 @@ import mekhq.campaign.stratcon.StratconTrackState; import mekhq.gui.enums.MHQTabType; import mekhq.gui.stratcon.CampaignManagementDialog; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import javax.swing.*; import java.awt.Dialog.ModalityType; @@ -105,7 +106,7 @@ public void mousePressed(MouseEvent me) { initializeInfoPanel(); cmd = new CampaignManagementDialog(this); - JScrollPane infoScrollPane = new JScrollPane(infoPanel); + JScrollPane infoScrollPane = new JScrollPaneWithSpeed(infoPanel); this.add(infoScrollPane); MekHQ.registerHandler(this); @@ -127,7 +128,7 @@ private void initializeInfoPanel() { btnManageCampaignState.addActionListener(this::showCampaignStateManagement); infoPanel.add(btnManageCampaignState); - expandedObjectivePanel = new JScrollPane(objectiveStatusText); + expandedObjectivePanel = new JScrollPaneWithSpeed(objectiveStatusText); expandedObjectivePanel.setMaximumSize(new Dimension(400, 300)); expandedObjectivePanel.setAlignmentX(LEFT_ALIGNMENT); infoPanel.add(expandedObjectivePanel); diff --git a/MekHQ/src/mekhq/gui/TOETab.java b/MekHQ/src/mekhq/gui/TOETab.java index 596566f180..6d2332aa1c 100644 --- a/MekHQ/src/mekhq/gui/TOETab.java +++ b/MekHQ/src/mekhq/gui/TOETab.java @@ -29,6 +29,7 @@ import mekhq.gui.handler.TOETransferHandler; import mekhq.gui.model.CrewListModel; import mekhq.gui.model.OrgTreeModel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.view.ForceViewPanel; import mekhq.gui.view.PersonViewPanel; import mekhq.gui.view.UnitViewPanel; @@ -84,7 +85,7 @@ public void initTab() { panForceView.setPreferredSize(new Dimension(550, 600)); panForceView.setLayout(new BorderLayout()); - JScrollPane scrollOrg = new JScrollPane(orgTree); + JScrollPane scrollOrg = new JScrollPaneWithSpeed(orgTree); splitOrg = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollOrg, panForceView); splitOrg.setOneTouchExpandable(true); splitOrg.setResizeWeight(1.0); @@ -132,7 +133,7 @@ public void refreshForceView() { if (crewSize > 0) { JPanel crewPanel = new JPanel(new BorderLayout()); crewPanel.getAccessibleContext().setAccessibleName("Crew for " + u.getName()); - final JScrollPane scrollPerson = new JScrollPane(); + final JScrollPane scrollPerson = new JScrollPaneWithSpeed(); crewPanel.add(scrollPerson, BorderLayout.CENTER); CrewListModel model = new CrewListModel(); model.setData(u); @@ -160,7 +161,7 @@ public Dimension getPreferredScrollableViewportSize() { }); crewList.setSelectedIndex(0); if (crewSize > 1) { - crewPanel.add(new JScrollPane(crewList), BorderLayout.NORTH); + crewPanel.add(new JScrollPaneWithSpeed(crewList), BorderLayout.NORTH); } String name = "Crew"; if (u.usesSoloPilot()) { @@ -170,14 +171,14 @@ public Dimension getPreferredScrollableViewportSize() { tabUnit.add(name, crewPanel); SwingUtilities.invokeLater(() -> scrollPerson.getVerticalScrollBar().setValue(0)); } - final JScrollPane scrollUnit = new JScrollPane(new UnitViewPanel(u, getCampaign())); + final JScrollPane scrollUnit = new JScrollPaneWithSpeed(new UnitViewPanel(u, getCampaign())); tabUnit.add("Unit", scrollUnit); panForceView.add(tabUnit, BorderLayout.CENTER); SwingUtilities.invokeLater(() -> scrollUnit.getVerticalScrollBar().setValue(0)); tabUnit.setSelectedIndex(tabUnitLastSelectedIndex); tabUnit.addChangeListener(evt -> forceViewTabChange()); // added late so it won't overwrite } else if (node instanceof Force) { - final JScrollPane scrollForce = new JScrollPane(new ForceViewPanel((Force) node, getCampaign())); + final JScrollPane scrollForce = new JScrollPaneWithSpeed(new ForceViewPanel((Force) node, getCampaign())); panForceView.add(scrollForce, BorderLayout.CENTER); SwingUtilities.invokeLater(() -> scrollForce.getVerticalScrollBar().setValue(0)); } diff --git a/MekHQ/src/mekhq/gui/WarehouseTab.java b/MekHQ/src/mekhq/gui/WarehouseTab.java index e01c40ac9b..10b6ea407f 100644 --- a/MekHQ/src/mekhq/gui/WarehouseTab.java +++ b/MekHQ/src/mekhq/gui/WarehouseTab.java @@ -55,6 +55,7 @@ import mekhq.gui.sorter.FormattedNumberSorter; import mekhq.gui.sorter.PartsDetailSorter; import mekhq.gui.sorter.TechSorter; +import mekhq.gui.utilities.JScrollPaneWithSpeed; /** * Displays all spare parts in stock, parts on order, and permits repair of @@ -200,7 +201,7 @@ public void initTab() { }); PartsTableMouseAdapter.connect(getCampaignGui(), partsTable, partsModel); - JScrollPane scrollPartsTable = new JScrollPane(partsTable); + JScrollPane scrollPartsTable = new JScrollPaneWithSpeed(partsTable); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; @@ -245,7 +246,7 @@ public void initTab() { textTargetWarehouse.setText(""); textTargetWarehouse.setWrapStyleWord(true); textTargetWarehouse.setBorder(null); - JScrollPane scrTargetWarehouse = new JScrollPane(textTargetWarehouse); + JScrollPane scrTargetWarehouse = new JScrollPaneWithSpeed(textTargetWarehouse); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; @@ -283,7 +284,7 @@ public void initTab() { ArrayList 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 e538dd321b..95425dfa7a 100644 --- a/MekHQ/src/mekhq/gui/dialog/ContractMarketDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/ContractMarketDialog.java @@ -34,6 +34,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.*; @@ -120,8 +121,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(); 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/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 b58d2e4fd8..fb2bd0960d 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 680e61d88d..dde8593383 100644 --- a/MekHQ/src/mekhq/gui/dialog/MRMSDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/MRMSDialog.java @@ -60,6 +60,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; @@ -298,7 +299,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(); @@ -356,7 +357,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)); @@ -405,7 +406,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/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() + ""), gridBagConstraints); i++; } - JScrollPane scrParts = new JScrollPane(); + JScrollPane scrParts = new JScrollPaneWithSpeed(); scrParts.setViewportView(pnlParts); scrParts.setMinimumSize(new Dimension(400, 300)); scrParts.setPreferredSize(new Dimension(400, 300)); @@ -228,7 +229,7 @@ private void initComponents() { pnlAssets.add(box, gridBagConstraints); i++; } - JScrollPane scrAssets = new JScrollPane(pnlAssets); + JScrollPane scrAssets = new JScrollPaneWithSpeed(pnlAssets); scrAssets.setMinimumSize(new Dimension(400, 300)); scrAssets.setPreferredSize(new Dimension(400, 300)); diff --git a/MekHQ/src/mekhq/gui/dialog/PersonnelMarketDialog.java b/MekHQ/src/mekhq/gui/dialog/PersonnelMarketDialog.java index e9be5763fd..ab93be87a6 100644 --- a/MekHQ/src/mekhq/gui/dialog/PersonnelMarketDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/PersonnelMarketDialog.java @@ -70,6 +70,7 @@ import mekhq.gui.enums.PersonnelFilter; import mekhq.gui.enums.PersonnelTableModelColumn; import mekhq.gui.model.PersonnelTableModel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.view.PersonViewPanel; /** @@ -131,8 +132,8 @@ public PersonnelMarketDialog(final JFrame frame, final CampaignGUI view, final C } private void initComponents() { - scrollTablePersonnel = new JScrollPane(); - scrollPersonnelView = new JScrollPane(); + scrollTablePersonnel = new JScrollPaneWithSpeed(); + scrollPersonnelView = new JScrollPaneWithSpeed(); tablePersonnel = new JTable(); panelMain = new JPanel(); panelFilterBtns = new JPanel(); diff --git a/MekHQ/src/mekhq/gui/dialog/QuirksDialog.java b/MekHQ/src/mekhq/gui/dialog/QuirksDialog.java index 000705ea81..289d746914 100644 --- a/MekHQ/src/mekhq/gui/dialog/QuirksDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/QuirksDialog.java @@ -44,6 +44,7 @@ import megamek.common.options.WeaponQuirks; import megamek.logging.MMLogger; import mekhq.MekHQ; +import mekhq.gui.utilities.JScrollPaneWithSpeed; /** * @author Deric Page (dericpage@users.sourceforge.net) @@ -86,7 +87,7 @@ private void initGUI() { qpanel.refreshQuirks(); // Set up the display of this dialog. - JScrollPane scroller = new JScrollPane(qpanel); + JScrollPane scroller = new JScrollPaneWithSpeed(qpanel); scroller.setPreferredSize(new Dimension(300, 200)); setLayout(new BorderLayout()); add(scroller, BorderLayout.CENTER); diff --git a/MekHQ/src/mekhq/gui/dialog/ResolveScenarioWizardDialog.java b/MekHQ/src/mekhq/gui/dialog/ResolveScenarioWizardDialog.java index d7629a9033..ebc559c546 100644 --- a/MekHQ/src/mekhq/gui/dialog/ResolveScenarioWizardDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/ResolveScenarioWizardDialog.java @@ -47,6 +47,7 @@ import mekhq.campaign.stratcon.StratconRulesManager; import mekhq.campaign.unit.TestUnit; import mekhq.campaign.unit.Unit; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.utilities.MarkdownEditorPanel; import mekhq.gui.view.PersonViewPanel; @@ -790,12 +791,12 @@ private void initComponents() { */ pnlPreview = new JPanel(); choiceStatus = new JComboBox<>(); - JScrollPane scrRecoveredUnits = new JScrollPane(); - JScrollPane scrRecoveredPilots = new JScrollPane(); - JScrollPane scrMissingUnits = new JScrollPane(); - JScrollPane scrMissingPilots = new JScrollPane(); - JScrollPane scrDeadPilots = new JScrollPane(); - JScrollPane scrSalvage = new JScrollPane(); + JScrollPane scrRecoveredUnits = new JScrollPaneWithSpeed(); + JScrollPane scrRecoveredPilots = new JScrollPaneWithSpeed(); + JScrollPane scrMissingUnits = new JScrollPaneWithSpeed(); + JScrollPane scrMissingPilots = new JScrollPaneWithSpeed(); + JScrollPane scrDeadPilots = new JScrollPaneWithSpeed(); + JScrollPane scrSalvage = new JScrollPaneWithSpeed(); txtInstructions = new JTextArea(); txtReport = new MarkdownEditorPanel("After-Action Report"); txtRecoveredUnits = new JTextArea(); @@ -852,7 +853,7 @@ private void initComponents() { gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new Insets(5, 5, 0, 0); - pnlPreview.add(new JScrollPane(txtRewards), gridBagConstraints); + pnlPreview.add(new JScrollPaneWithSpeed(txtRewards), gridBagConstraints); txtReport.setText(""); txtReport.setPreferredSize(new Dimension(500, 300)); @@ -990,7 +991,7 @@ private void initComponents() { pnlMain.add(pnlPreview, PREVIEWPANEL); - scrMain = new JScrollPane(pnlMain); + scrMain = new JScrollPaneWithSpeed(pnlMain); scrMain.setMinimumSize(new Dimension(600, 500)); scrMain.setPreferredSize(new Dimension(600, 500)); getContentPane().add(scrMain, BorderLayout.CENTER); @@ -1754,7 +1755,7 @@ private void showPerson(PersonStatus status, boolean isPrisoner) { gridBagConstraints.weighty = 1.0; //scroll panel - JScrollPane scrollPersonnelView = new JScrollPane(); + JScrollPane scrollPersonnelView = new JScrollPaneWithSpeed(); scrollPersonnelView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPersonnelView.setViewportView(personViewPanel); dialog.getContentPane().add(scrollPersonnelView, gridBagConstraints); diff --git a/MekHQ/src/mekhq/gui/dialog/RetirementDefectionDialog.java b/MekHQ/src/mekhq/gui/dialog/RetirementDefectionDialog.java index 599d9c501d..bc058a8477 100644 --- a/MekHQ/src/mekhq/gui/dialog/RetirementDefectionDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/RetirementDefectionDialog.java @@ -67,6 +67,7 @@ import mekhq.gui.sorter.FormattedNumberSorter; import mekhq.gui.sorter.PersonRankStringSorter; import mekhq.gui.sorter.WeightClassSorter; +import mekhq.gui.utilities.JScrollPaneWithSpeed; /** * @author Neoancient @@ -277,7 +278,7 @@ private void initComponents(boolean doRetirement) { }); setBonusAndShareTotals(getTotalBonus()); - JScrollPane scroll = new JScrollPane(); + JScrollPane scroll = new JScrollPaneWithSpeed(); scroll.setViewportView(personnelTable); scroll.setPreferredSize(new Dimension(500, 500)); panOverview.add(scroll, BorderLayout.CENTER); @@ -391,7 +392,7 @@ private void initComponents(boolean doRetirement) { JPanel panResults = new JPanel(); panResults.setLayout(new BoxLayout(panResults, BoxLayout.X_AXIS)); - JScrollPane scroll = new JScrollPane(); + JScrollPane scroll = new JScrollPaneWithSpeed(); scroll.setViewportView(retireeTable); panResults.add(scroll); JPanel panAddRemoveBtns = new JPanel(); @@ -406,7 +407,7 @@ private void initComponents(boolean doRetirement) { panAddRemoveBtns.add(btnRemoveUnit); panResults.add(panAddRemoveBtns); - scroll = new JScrollPane(); + scroll = new JScrollPaneWithSpeed(); scroll.setViewportView(unitAssignmentTable); panResults.add(scroll); diff --git a/MekHQ/src/mekhq/gui/dialog/ScenarioTemplateEditorDialog.java b/MekHQ/src/mekhq/gui/dialog/ScenarioTemplateEditorDialog.java index dfd3239cd0..3aecc2fdc1 100644 --- a/MekHQ/src/mekhq/gui/dialog/ScenarioTemplateEditorDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/ScenarioTemplateEditorDialog.java @@ -61,6 +61,7 @@ import mekhq.campaign.stratcon.StratconBiomeManifest; import mekhq.gui.FileDialogs; import mekhq.gui.baseComponents.DefaultMHQScrollablePanel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; /** * Handles editing, saving and loading of scenario template definitions. @@ -175,7 +176,7 @@ protected void initComponents() { globalPanel = new DefaultMHQScrollablePanel(frame, "globalPanel", new GridBagLayout()); - JScrollPane globalScrollPane = new JScrollPane(globalPanel); + JScrollPane globalScrollPane = new JScrollPaneWithSpeed(globalPanel); globalScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); globalScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); getContentPane().add(globalScrollPane); @@ -233,7 +234,7 @@ private void setupTopFluff(GridBagConstraints gbc) { txtScenarioBriefing.setEditable(true); txtScenarioBriefing.setLineWrap(true); txtScenarioBriefing.setText(scenarioTemplate.shortBriefing); - JScrollPane scrScenarioBriefing = new JScrollPane(txtScenarioBriefing); + JScrollPane scrScenarioBriefing = new JScrollPaneWithSpeed(txtScenarioBriefing); gbc.gridy++; globalPanel.add(scrScenarioBriefing, gbc); @@ -245,7 +246,7 @@ private void setupTopFluff(GridBagConstraints gbc) { txtLongBriefing.setEditable(true); txtLongBriefing.setLineWrap(true); txtLongBriefing.setText(scenarioTemplate.detailedBriefing); - JScrollPane scrLongBriefing = new JScrollPane(txtLongBriefing); + JScrollPane scrLongBriefing = new JScrollPaneWithSpeed(txtLongBriefing); gbc.gridy++; globalPanel.add(scrLongBriefing, gbc); } @@ -281,7 +282,7 @@ private void setupObjectiveEditUI(GridBagConstraints gbc) { objectiveList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); objectiveList.setVisibleRowCount(5); objectiveList.setFixedCellWidth(400); - objectiveScrollPane = new JScrollPane(); + objectiveScrollPane = new JScrollPaneWithSpeed(); objectiveScrollPane.setViewportView(objectiveList); btnRemoveObjective = new JButton("Remove"); @@ -471,7 +472,7 @@ private void setupForceEditor(GridBagConstraints externalGBC) { lstMuls = new JList<>(); DefaultListModel mulModel = new DefaultListModel<>(); - JScrollPane scrMulList = new JScrollPane(lstMuls); + JScrollPane scrMulList = new JScrollPaneWithSpeed(lstMuls); File mulDir = new File(MHQConstants.STRATCON_MUL_FILES_DIRECTORY); if (mulDir.exists() && mulDir.isDirectory()) { @@ -706,7 +707,7 @@ private void initializeForceList(GridBagConstraints gbc) { renderForceList(); - forceScrollPane = new JScrollPane(panForceList); + forceScrollPane = new JScrollPaneWithSpeed(panForceList); forceScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); forceScrollPane.setVisible(false); @@ -898,7 +899,7 @@ private void setupMapParameters(GridBagConstraints gbc) { selectedModifiersList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); reloadSelectedModifiers(); - JScrollPane modifierScrollPane = new JScrollPane(selectedModifiersList); + JScrollPane modifierScrollPane = new JScrollPaneWithSpeed(selectedModifiersList); modifierScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); pnlMapParameters.add(modifierScrollPane, localGbc); diff --git a/MekHQ/src/mekhq/gui/dialog/StoryArcSelectionDialog.java b/MekHQ/src/mekhq/gui/dialog/StoryArcSelectionDialog.java index dc54e265ca..bddb96bd46 100644 --- a/MekHQ/src/mekhq/gui/dialog/StoryArcSelectionDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/StoryArcSelectionDialog.java @@ -22,6 +22,7 @@ import mekhq.campaign.storyarc.StoryArcStub; import mekhq.gui.baseComponents.AbstractMHQButtonDialog; import mekhq.gui.panes.StoryArcSelectionPane; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.utilities.MarkdownRenderer; import javax.swing.*; @@ -86,7 +87,7 @@ protected Container createCenterPane() { descriptionPane.setMinimumSize(new Dimension(400, 400)); descriptionPane.setPreferredSize(new Dimension(400, 400)); descriptionPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); - mainPanel.add(new JScrollPane(descriptionPane)); + mainPanel.add(new JScrollPaneWithSpeed(descriptionPane)); return mainPanel; } diff --git a/MekHQ/src/mekhq/gui/dialog/StoryChoiceDialog.java b/MekHQ/src/mekhq/gui/dialog/StoryChoiceDialog.java index df6d24b335..b9492ca2a6 100644 --- a/MekHQ/src/mekhq/gui/dialog/StoryChoiceDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/StoryChoiceDialog.java @@ -22,6 +22,7 @@ import mekhq.campaign.storyarc.storypoint.ChoiceStoryPoint; import mekhq.gui.baseComponents.DefaultMHQScrollablePanel; import mekhq.gui.panels.StoryChoicePanel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.utilities.MarkdownRenderer; import javax.swing.*; @@ -116,7 +117,7 @@ protected Container getMainPanel() { gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; - JScrollPane scrollPane = new JScrollPane(rightPanel); + JScrollPane scrollPane = new JScrollPaneWithSpeed(rightPanel); scrollPane.setMinimumSize(new Dimension(200, 150)); scrollPane.setPreferredSize(new Dimension(200, 150)); mainPanel.add(scrollPane, gbc); diff --git a/MekHQ/src/mekhq/gui/dialog/StoryNarrativeDialog.java b/MekHQ/src/mekhq/gui/dialog/StoryNarrativeDialog.java index b282e0c044..d040c1477d 100644 --- a/MekHQ/src/mekhq/gui/dialog/StoryNarrativeDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/StoryNarrativeDialog.java @@ -20,6 +20,7 @@ import mekhq.campaign.storyarc.StoryArc; import mekhq.campaign.storyarc.storypoint.NarrativeStoryPoint; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.utilities.MarkdownRenderer; import javax.swing.*; @@ -60,7 +61,7 @@ protected Container getMainPanel() { String text = StoryArc.replaceTokens(((NarrativeStoryPoint) getStoryPoint()).getNarrative(), getStoryPoint().getCampaign()); txtDesc.setText(MarkdownRenderer.getRenderedHtml(text)); txtDesc.setCaretPosition(0); - JScrollPane scrollPane = new JScrollPane(txtDesc); + JScrollPane scrollPane = new JScrollPaneWithSpeed(txtDesc); mainPanel.add(scrollPane, gbc); return mainPanel; diff --git a/MekHQ/src/mekhq/gui/dialog/reportDialogs/AbstractReportDialog.java b/MekHQ/src/mekhq/gui/dialog/reportDialogs/AbstractReportDialog.java index a119fc2585..42205a8a90 100644 --- a/MekHQ/src/mekhq/gui/dialog/reportDialogs/AbstractReportDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/reportDialogs/AbstractReportDialog.java @@ -19,6 +19,7 @@ package mekhq.gui.dialog.reportDialogs; import mekhq.gui.baseComponents.AbstractMHQDialog; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -39,7 +40,7 @@ protected AbstractReportDialog(final JFrame frame, final String name, final Stri //region Initialization @Override protected Container createCenterPane() { - final JScrollPane scrollPane = new JScrollPane(createTxtReport()); + final JScrollPane scrollPane = new JScrollPaneWithSpeed(createTxtReport()); scrollPane.setBorder(new EmptyBorder(2, 10, 2, 2)); scrollPane.setName("reportPane"); diff --git a/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java b/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java index c4c4a75acd..3a4f3579f2 100644 --- a/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java +++ b/MekHQ/src/mekhq/gui/panes/CampaignOptionsPane.java @@ -73,6 +73,7 @@ import mekhq.gui.dialog.iconDialogs.UnitIconDialog; import mekhq.gui.displayWrappers.FactionDisplay; import mekhq.gui.panels.RandomOriginOptionsPanel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.module.PersonnelMarketServiceManager; import mekhq.module.api.PersonnelMarketMethod; @@ -888,7 +889,7 @@ private JScrollPane createGeneralTab() { gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; panGeneral.add(btnIcon, gridBagConstraints); - return new JScrollPane(panGeneral); + return new JScrollPaneWithSpeed(panGeneral); } private JScrollPane createRepairAndMaintenanceTab() { @@ -1170,7 +1171,7 @@ private JScrollPane createRepairAndMaintenanceTab() { gridBagConstraints.weighty = 1.0; panSubMaintenance.add(logMaintenance, gridBagConstraints); - return new JScrollPane(panRepair); + return new JScrollPaneWithSpeed(panRepair); } private JScrollPane createSuppliesAndAcquisitionsTab() { @@ -1542,7 +1543,7 @@ private JScrollPane createSuppliesAndAcquisitionsTab() { gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; panSubPlanetAcquire.add(panSocioIndustrialBonus, gridBagConstraints); - return new JScrollPane(panSupplies); + return new JScrollPaneWithSpeed(panSupplies); } private JScrollPane createTechLimitsTab() { @@ -1675,7 +1676,7 @@ private JScrollPane createTechLimitsTab() { gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; panTech.add(useAmmoByTypeBox, gridBagConstraints); - return new JScrollPane(panTech); + return new JScrollPaneWithSpeed(panTech); } private JScrollPane createFinancesTab(boolean reverseQualities) { @@ -1905,7 +1906,7 @@ public Component getListCellRendererComponent(JList list, Object value, int i gridBagConstraints.gridheight = 20; panFinances.add(createSharesPanel(), gridBagConstraints); - return new JScrollPane(panFinances); + return new JScrollPaneWithSpeed(panFinances); } private JScrollPane createMercenaryTab() { @@ -2036,7 +2037,7 @@ private JScrollPane createMercenaryTab() { groupContract.add(btnContractEquipment); groupContract.add(btnContractPersonnel); - return new JScrollPane(panMercenary); + return new JScrollPaneWithSpeed(panMercenary); } private JScrollPane createExperienceTab() { @@ -2395,7 +2396,7 @@ private JScrollPane createExperienceTab() { tableXP.setColumnSelectionAllowed(false); tableXP.setCellSelectionEnabled(true); tableXP.setShowGrid(true); - final JScrollPane scrXP = new JScrollPane(tableXP); + final JScrollPane scrXP = new JScrollPaneWithSpeed(tableXP); scrXP.setMinimumSize(new Dimension(500, ((tableXP.getRowCount() * 25) + 50))); scrXP.setPreferredSize(new Dimension(500, ((tableXP.getRowCount() * 25) + 50))); JTable rowTable = new RowNamesTable(tableXP); @@ -2415,7 +2416,7 @@ private JScrollPane createExperienceTab() { gridBagConstraints.insets = new Insets(5, 5, 5, 5); panXP.add(scrXP, gridBagConstraints); - return new JScrollPane(panXP); + return new JScrollPaneWithSpeed(panXP); } private JScrollPane createSkillsTab() { @@ -2498,7 +2499,7 @@ private JScrollPane createSkillsTab() { gridBagConstraints.gridy++; } - final JScrollPane scrSkill = new JScrollPane(panSkill); + final JScrollPane scrSkill = new JScrollPaneWithSpeed(panSkill); scrSkill.setPreferredSize(new Dimension(500, 400)); return scrSkill; } @@ -2521,7 +2522,7 @@ private JScrollPane createSpecialAbilitiesTab() { recreateSPAPanel(!getUnusedSPA().isEmpty()); - JScrollPane scrSPA = new JScrollPane(panSpecialAbilities); + JScrollPane scrSPA = new JScrollPaneWithSpeed(panSpecialAbilities); scrSPA.setPreferredSize(new Dimension(500, 400)); return scrSPA; } @@ -2791,7 +2792,7 @@ private JScrollPane createSkillRandomizationTab() { gridBagConstraints.insets = new Insets(5, 5, 5, 5); panRandomSkill.add(panOtherBonuses, gridBagConstraints); - JScrollPane scrRandomSkill = new JScrollPane(panRandomSkill); + JScrollPane scrRandomSkill = new JScrollPaneWithSpeed(panRandomSkill); scrRandomSkill.setPreferredSize(new Dimension(500, 400)); return scrRandomSkill; } @@ -2940,7 +2941,7 @@ private JScrollPane createNameAndPortraitGenerationTab() { gridBagConstraints.anchor = GridBagConstraints.WEST; panNameGen.add(chkAssignPortraitOnRoleChange, gridBagConstraints); - return new JScrollPane(panNameGen); + return new JScrollPaneWithSpeed(panNameGen); } private JScrollPane createAgainstTheBotTab() { @@ -3470,7 +3471,7 @@ private JScrollPane createAgainstTheBotTab() { gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; panSubAtBScenario.add(panScenarioMod, gridBagConstraints); - JScrollPane scrAtB = new JScrollPane(panAtB); + JScrollPane scrAtB = new JScrollPaneWithSpeed(panAtB); scrAtB.setPreferredSize(new Dimension(500, 410)); return scrAtB; } @@ -3534,7 +3535,7 @@ private JScrollPane createPersonnelTab() { gbc.gridwidth = 2; personnelPanel.add(createSalaryPanel(), gbc); - final JScrollPane scrollPersonnel = new JScrollPane(personnelPanel); + final JScrollPane scrollPersonnel = new JScrollPaneWithSpeed(personnelPanel); scrollPersonnel.setPreferredSize(new Dimension(500, 400)); return scrollPersonnel; @@ -3570,7 +3571,7 @@ private JScrollPane createTurnoverAndRetentionTab() { gbc.gridx++; turnoverAndRetentionPanel.add(createTurnoverAndRetentionUnitCohesionPanel(), gbc); - final JScrollPane scrollPersonnel = new JScrollPane(turnoverAndRetentionPanel); + final JScrollPane scrollPersonnel = new JScrollPaneWithSpeed(turnoverAndRetentionPanel); scrollPersonnel.setPreferredSize(new Dimension(500, 400)); return scrollPersonnel; @@ -3627,7 +3628,7 @@ private JScrollPane createLifePathsPanel() { gbc.gridwidth = 2; lifePathsPanel.add(createDeathPanel(), gbc); - final JScrollPane scrollLifePaths = new JScrollPane(lifePathsPanel); + final JScrollPane scrollLifePaths = new JScrollPaneWithSpeed(lifePathsPanel); scrollLifePaths.setPreferredSize(new Dimension(400, 400)); return scrollLifePaths; @@ -4039,7 +4040,7 @@ public Component getListCellRendererComponent(final JList list, final Object txtAwardSetFilterList.setName("txtAwardSetFilterList"); txtAwardSetFilterList.setText(""); - JScrollPane scrollAwardSetFilterList = new JScrollPane(txtAwardSetFilterList); + JScrollPane scrollAwardSetFilterList = new JScrollPaneWithSpeed(txtAwardSetFilterList); scrollAwardSetFilterList.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollAwardSetFilterList.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); @@ -7734,7 +7735,7 @@ private JScrollPane createMarketsTab() { gbc.gridy++; marketsPanel.add(createUnitMarketPanel(), gbc); - JScrollPane scrollMarkets = new JScrollPane(marketsPanel); + JScrollPane scrollMarkets = new JScrollPaneWithSpeed(marketsPanel); scrollMarkets.setPreferredSize(new Dimension(500, 400)); return scrollMarkets; @@ -8161,7 +8162,7 @@ private JScrollPane createRATTab() { btnUseStaticRATs.setSelected(true); btnUseStaticRATs.doClick(); - return new JScrollPane(panel); + return new JScrollPaneWithSpeed(panel); } private void createTraditionalRATPanel(final JDisableablePanel panel) { diff --git a/MekHQ/src/mekhq/gui/panes/RankSystemsPane.java b/MekHQ/src/mekhq/gui/panes/RankSystemsPane.java index e890477e0c..fe305f05b7 100644 --- a/MekHQ/src/mekhq/gui/panes/RankSystemsPane.java +++ b/MekHQ/src/mekhq/gui/panes/RankSystemsPane.java @@ -52,6 +52,7 @@ import mekhq.gui.baseComponents.SortedComboBoxModel; import mekhq.gui.dialog.CustomRankSystemCreationDialog; import mekhq.gui.model.RankTableModel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; public class RankSystemsPane extends AbstractMHQScrollPane { private static final MMLogger logger = MMLogger.create(RankSystemsPane.class); @@ -328,7 +329,7 @@ private JScrollPane createRanksTablePane() { } // Create the Scroll Pane - final JScrollPane pane = new JScrollPane(getRanksTable()); + final JScrollPane pane = new JScrollPaneWithSpeed(getRanksTable()); pane.setName("ranksTableScrollPane"); pane.setMinimumSize(new Dimension(1200, 400)); pane.setPreferredSize(new Dimension(1200, 500)); diff --git a/MekHQ/src/mekhq/gui/panes/UnitMarketPane.java b/MekHQ/src/mekhq/gui/panes/UnitMarketPane.java index 7856fb8b68..bacf267f7e 100644 --- a/MekHQ/src/mekhq/gui/panes/UnitMarketPane.java +++ b/MekHQ/src/mekhq/gui/panes/UnitMarketPane.java @@ -54,6 +54,7 @@ import mekhq.gui.baseComponents.AbstractMHQSplitPane; import mekhq.gui.model.UnitMarketTableModel; import mekhq.gui.sorter.WeightClassSorter; +import mekhq.gui.utilities.JScrollPaneWithSpeed; public class UnitMarketPane extends AbstractMHQSplitPane { private static final MMLogger logger = MMLogger.create(UnitMarketPane.class); @@ -347,7 +348,7 @@ private JScrollPane createMarketTablePane() { !getCampaign().getCampaignOptions().isInstantUnitMarketDelivery()); getMarketTable().getSelectionModel().addListSelectionListener(evt -> updateDisplay()); - final JScrollPane marketTableScrollPane = new JScrollPane(getMarketTable(), + final JScrollPane marketTableScrollPane = new JScrollPaneWithSpeed(getMarketTable(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); marketTableScrollPane.setName("marketTableScrollPane"); marketTableScrollPane.setMinimumSize(new Dimension(500, 400)); diff --git a/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java b/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java index b305727c8e..190bfead7a 100644 --- a/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java +++ b/MekHQ/src/mekhq/gui/stratcon/StratconScenarioWizard.java @@ -32,6 +32,7 @@ import mekhq.campaign.stratcon.StratconScenario.ScenarioState; import mekhq.campaign.stratcon.StratconTrackState; import mekhq.campaign.unit.Unit; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import javax.swing.*; import javax.swing.event.ListSelectionEvent; @@ -270,7 +271,7 @@ private void setLeadershipUI(GridBagConstraints gbc, List eligibleUnits, i */ private JList addAvailableForceList(JPanel parent, GridBagConstraints gbc, ScenarioForceTemplate forceTemplate) { - JScrollPane forceListContainer = new JScrollPane(); + JScrollPane forceListContainer = new JScrollPaneWithSpeed(); ScenarioWizardLanceModel lanceModel; @@ -332,7 +333,7 @@ private JList addIndividualUnitSelector(List units, GridBagConstrain availableUnits.addListSelectionListener( e -> availableUnitSelectorChanged(e, unitSelectionLabel, unitStatusLabel, maxSelectionSize)); - JScrollPane infantryContainer = new JScrollPane(); + JScrollPane infantryContainer = new JScrollPaneWithSpeed(); infantryContainer.setViewportView(availableUnits); localGridBagConstraints.gridy++; unitPanel.add(infantryContainer, localGridBagConstraints); diff --git a/MekHQ/src/mekhq/gui/stratcon/TrackForceAssignmentUI.java b/MekHQ/src/mekhq/gui/stratcon/TrackForceAssignmentUI.java index f0f95fecb9..55bf38c547 100644 --- a/MekHQ/src/mekhq/gui/stratcon/TrackForceAssignmentUI.java +++ b/MekHQ/src/mekhq/gui/stratcon/TrackForceAssignmentUI.java @@ -21,6 +21,7 @@ import mekhq.campaign.stratcon.StratconCoords; import mekhq.campaign.stratcon.StratconRulesManager; import mekhq.gui.StratconPanel; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import javax.swing.*; import java.awt.*; @@ -69,7 +70,7 @@ private void initializeUI() { getContentPane().add(forceAssignmentInstructions, gbc); gbc.gridy++; - JScrollPane forceListContainer = new JScrollPane(); + JScrollPane forceListContainer = new JScrollPaneWithSpeed(); ScenarioWizardLanceModel lanceModel; diff --git a/MekHQ/src/mekhq/gui/utilities/JScrollPaneWithSpeed.java b/MekHQ/src/mekhq/gui/utilities/JScrollPaneWithSpeed.java new file mode 100644 index 0000000000..37684bc40b --- /dev/null +++ b/MekHQ/src/mekhq/gui/utilities/JScrollPaneWithSpeed.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019-2024 - The MegaMek Team. All Rights Reserved. + * + * This file is part of MekHQ. + * + * MekHQ is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MekHQ is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MekHQ. If not, see . + */ +package mekhq.gui.utilities; + +import java.awt.*; + +import javax.swing.*; + +import megamek.client.ui.swing.GUIPreferences; + +/** + * It's a JScrollPane that manages its scrollspeed based on the UI scale + */ +public class JScrollPaneWithSpeed extends JScrollPane { + final static int BASE_INCREMENT = 16; + + /** + * @see JPanel#JPanel() + */ + public JScrollPaneWithSpeed() { + super(); + setScaleIncrement(); + } + + /** + * @see JPanel#JPanel(Component) + */ + public JScrollPaneWithSpeed(Component view) { + super(view); + setScaleIncrement(); + } + + /** + * @see JPanel#JPanel(Component, int, int) + */ + public JScrollPaneWithSpeed(Component view, int vsbPolicy, int hsbPolicy) { + super(view, vsbPolicy, hsbPolicy); + setScaleIncrement(); + } + + private void setScaleIncrement() { + float scale = GUIPreferences.getInstance().getGUIScale(); + + int increment = (int) (scale * BASE_INCREMENT); + + getVerticalScrollBar().setUnitIncrement(increment); + getHorizontalScrollBar().setUnitIncrement(increment); + } +} diff --git a/MekHQ/src/mekhq/gui/utilities/JSuggestField.java b/MekHQ/src/mekhq/gui/utilities/JSuggestField.java index 54c4692adb..1e95513219 100644 --- a/MekHQ/src/mekhq/gui/utilities/JSuggestField.java +++ b/MekHQ/src/mekhq/gui/utilities/JSuggestField.java @@ -205,7 +205,7 @@ public void mouseEntered(MouseEvent e) { public void mouseClicked(MouseEvent e) { } }); - d.add(new JScrollPane(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + d.add(new JScrollPaneWithSpeed(list, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); d.pack(); addKeyListener(new KeyListener() { diff --git a/MekHQ/src/mekhq/gui/utilities/MarkdownEditorPanel.java b/MekHQ/src/mekhq/gui/utilities/MarkdownEditorPanel.java index 280dba3a01..2e6c617bcd 100644 --- a/MekHQ/src/mekhq/gui/utilities/MarkdownEditorPanel.java +++ b/MekHQ/src/mekhq/gui/utilities/MarkdownEditorPanel.java @@ -19,6 +19,7 @@ package mekhq.gui.utilities; import javax.swing.*; + import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; @@ -65,7 +66,7 @@ public MarkdownEditorPanel(String title) { editor.setEditable(true); editor.setLineWrap(true); editor.setWrapStyleWord(true); - scrollEditor = new JScrollPane(editor); + scrollEditor = new JScrollPaneWithSpeed(editor); scrollEditor.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //set up buttons @@ -133,7 +134,7 @@ public MarkdownEditorPanel(String title) { viewer = new JTextPane(); viewer.setEditable(false); viewer.setContentType("text/html"); - scrollViewer = new JScrollPane(viewer); + scrollViewer = new JScrollPaneWithSpeed(viewer); scrollViewer.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); tabPane.add("Preview", scrollViewer); diff --git a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java index c8051d18ca..87b79c98f0 100644 --- a/MekHQ/src/mekhq/gui/view/MissionViewPanel.java +++ b/MekHQ/src/mekhq/gui/view/MissionViewPanel.java @@ -26,6 +26,7 @@ import mekhq.gui.CampaignGUI; import mekhq.gui.baseComponents.JScrollablePanel; import mekhq.gui.enums.MHQTabType; +import mekhq.gui.utilities.JScrollPaneWithSpeed; import mekhq.gui.utilities.MarkdownRenderer; import javax.swing.*; @@ -127,7 +128,7 @@ private void initComponents() { gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; add(pnlStats, gridBagConstraints); - JScrollPane scrollScenarioTable = new JScrollPane(scenarioTable); + JScrollPane scrollScenarioTable = new JScrollPaneWithSpeed(scenarioTable); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1;