Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tabs in customize scenario dialog #4106

Merged
merged 2 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
panTab.basic=Basic Information
panTab.rewards=Objectives and Rewards
panTab.otherforces=Other Forces
btnCancel.text=Cancel
btnOkay.text=Done
lblName.text=<html><b><nobr>Scenario Name:</nobr></b></html>
Expand Down
59 changes: 23 additions & 36 deletions MekHQ/src/mekhq/gui/dialog/CustomizeScenarioDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ private void initComponents() {
setTitle(resourceMap.getString("title"));
}

JPanel panMain = new JPanel(new GridBagLayout());
JTabbedPane panTabs = new JTabbedPane();

JPanel panBasic = new JPanel(new GridBagLayout());
JPanel panRewards = new JPanel(new GridLayout(2, 0));

JPanel panInfo = new JPanel(new GridBagLayout());
JPanel panWrite = new JPanel(new GridBagLayout());
JPanel panBtn = new JPanel(new FlowLayout());
Expand All @@ -215,7 +219,7 @@ private void initComponents() {
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets = new Insets(5, 5, 5, 5);
panInfo.add(new JLabel(resourceMap.getString("lblName.text")), gbc);

Expand Down Expand Up @@ -314,6 +318,7 @@ public Component getListCellRendererComponent(final JList<?> list, final Object

initMapPanel(resourceMap);
gbc.gridy++;
gbc.weighty = 1.0;
panInfo.add(panMap, gbc);

initObjectivesPanel(resourceMap);
Expand All @@ -331,11 +336,8 @@ public Component getListCellRendererComponent(final JList<?> list, final Object
BorderFactory.createEmptyBorder(5,5,5,5)));

initOtherForcesPanel(resourceMap);
panOtherForces.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createEmptyBorder(0, 0, 10, 0),
BorderFactory.createTitledBorder(resourceMap.getString("panOtherForces.title"))));
panOtherForces.setPreferredSize(new Dimension(600,250));
panOtherForces.setMinimumSize(new Dimension(600,250));
panOtherForces.setPreferredSize(new Dimension(600,300));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd talked previously about making the MekHQ UI more responsive; would it be possible to use a persistent size, or a % of screen size, or something other than magic numbers here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it already got merged, but I can think about the issue in future dialog stuff.

panOtherForces.setMinimumSize(new Dimension(600,300));

txtDesc = new MarkdownEditorPanel(resourceMap.getString("txtDesc.title"));
txtDesc.setText(scenario.getDescription());
Expand Down Expand Up @@ -396,43 +398,28 @@ public Component getListCellRendererComponent(final JList<?> list, final Object
btnClose.addActionListener(this::btnCloseActionPerformed);
panBtn.add(btnClose);

getContentPane().add(panMain, BorderLayout.CENTER);
getContentPane().add(panBtn, BorderLayout.PAGE_END);

JPanel panNW = new JPanel(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridheight = 2;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.weightx = 0.0;
gbc.weighty = 1.0;
panNW.add(panInfo, gbc);
gbc.gridx = 1;
gbc.gridheight = 1;
gbc.fill = GridBagConstraints.BOTH;
panNW.add(panObjectives, gbc);
gbc.gridy = 1;
panNW.add(panLoot, gbc);

gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.BOTH;
panMain.add(panNW, gbc);
panBasic.add(panInfo, gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridheight = 2;
gbc.weighty = 1.0;
panMain.add(panWrite, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridheight = 1;
panMain.add(panOtherForces, gbc);
gbc.weightx = 1.0;
panBasic.add(panWrite, gbc);

panRewards.add(panObjectives);
panRewards.add(panLoot);

panTabs.add(resourceMap.getString("panTab.basic"), panBasic);
panTabs.add(resourceMap.getString("panTab.rewards"), panRewards);
panTabs.add(resourceMap.getString("panTab.otherforces"), panOtherForces);

getContentPane().add(panTabs, BorderLayout.CENTER);
getContentPane().add(panBtn, BorderLayout.PAGE_END);

pack();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ private void initObjectiveEffectPanel(ResourceBundle resourceMap) {
panObjectiveEffect.add(btnAdd, gbcLeft);

JLabel lblSuccessEffects = new JLabel(resourceMap.getString("lblSuccessEffects.text"));
JLabel lblFailureEffects = new JLabel(resourceMap.getString("lblSuccessEffects.text"));
JLabel lblFailureEffects = new JLabel(resourceMap.getString("lblFailureEffects.text"));

successEffects = new JList<>(successEffectsModel);
successEffects.addListSelectionListener(e -> btnRemoveSuccess.setEnabled(!successEffects.getSelectedValuesList().isEmpty()));
Expand Down
Loading