Skip to content

Commit

Permalink
JScrollPaneWithSpeed created and MekHQ updated to use it almost every…
Browse files Browse the repository at this point in the history
…where
  • Loading branch information
WeaverThree committed Oct 21, 2024
1 parent f4ebf81 commit 20b9526
Show file tree
Hide file tree
Showing 67 changed files with 332 additions and 195 deletions.
7 changes: 4 additions & 3 deletions MekHQ/src/mekhq/gui/BriefingTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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());
Expand Down
5 changes: 3 additions & 2 deletions MekHQ/src/mekhq/gui/CommandCenterTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion MekHQ/src/mekhq/gui/DailyReportLogPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import megamek.codeUtilities.StringUtility;
import mekhq.Utilities;
import mekhq.gui.utilities.JScrollPaneWithSpeed;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 5 additions & 3 deletions MekHQ/src/mekhq/gui/FinancesTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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());
Expand Down Expand Up @@ -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));
Expand Down
5 changes: 3 additions & 2 deletions MekHQ/src/mekhq/gui/HangarTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions MekHQ/src/mekhq/gui/InfirmaryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion MekHQ/src/mekhq/gui/MapTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
93 changes: 47 additions & 46 deletions MekHQ/src/mekhq/gui/MekLabTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down
5 changes: 3 additions & 2 deletions MekHQ/src/mekhq/gui/PersonnelTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 20b9526

Please sign in to comment.