Skip to content

Commit 480149d

Browse files
authored
Merge pull request #4106 from AaronGullickson/tab-scenario-dialog
Use tabs in customize scenario dialog
2 parents 6c0cc03 + a903277 commit 480149d

File tree

3 files changed

+27
-37
lines changed

3 files changed

+27
-37
lines changed

MekHQ/resources/mekhq/resources/CustomizeScenarioDialog.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
panTab.basic=Basic Information
2+
panTab.rewards=Objectives and Rewards
3+
panTab.otherforces=Other Forces
14
btnCancel.text=Cancel
25
btnOkay.text=Done
36
lblName.text=<html><b><nobr>Scenario Name:</nobr></b></html>

MekHQ/src/mekhq/gui/dialog/CustomizeScenarioDialog.java

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ private void initComponents() {
206206
setTitle(resourceMap.getString("title"));
207207
}
208208

209-
JPanel panMain = new JPanel(new GridBagLayout());
209+
JTabbedPane panTabs = new JTabbedPane();
210+
211+
JPanel panBasic = new JPanel(new GridBagLayout());
212+
JPanel panRewards = new JPanel(new GridLayout(2, 0));
213+
210214
JPanel panInfo = new JPanel(new GridBagLayout());
211215
JPanel panWrite = new JPanel(new GridBagLayout());
212216
JPanel panBtn = new JPanel(new FlowLayout());
@@ -215,7 +219,7 @@ private void initComponents() {
215219
gbc.gridx = 0;
216220
gbc.gridy = 0;
217221
gbc.gridwidth = 1;
218-
gbc.anchor = GridBagConstraints.WEST;
222+
gbc.anchor = GridBagConstraints.NORTHWEST;
219223
gbc.insets = new Insets(5, 5, 5, 5);
220224
panInfo.add(new JLabel(resourceMap.getString("lblName.text")), gbc);
221225

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

315319
initMapPanel(resourceMap);
316320
gbc.gridy++;
321+
gbc.weighty = 1.0;
317322
panInfo.add(panMap, gbc);
318323

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

333338
initOtherForcesPanel(resourceMap);
334-
panOtherForces.setBorder(BorderFactory.createCompoundBorder(
335-
BorderFactory.createEmptyBorder(0, 0, 10, 0),
336-
BorderFactory.createTitledBorder(resourceMap.getString("panOtherForces.title"))));
337-
panOtherForces.setPreferredSize(new Dimension(600,250));
338-
panOtherForces.setMinimumSize(new Dimension(600,250));
339+
panOtherForces.setPreferredSize(new Dimension(600,300));
340+
panOtherForces.setMinimumSize(new Dimension(600,300));
339341

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

399-
getContentPane().add(panMain, BorderLayout.CENTER);
400-
getContentPane().add(panBtn, BorderLayout.PAGE_END);
401-
402-
JPanel panNW = new JPanel(new GridBagLayout());
403401
gbc = new GridBagConstraints();
404402
gbc.gridx = 0;
405403
gbc.gridy = 0;
406-
gbc.gridheight = 2;
407-
gbc.anchor = GridBagConstraints.NORTHWEST;
408-
gbc.fill = GridBagConstraints.HORIZONTAL;
409-
gbc.weightx = 1.0;
404+
gbc.weightx = 0.0;
410405
gbc.weighty = 1.0;
411-
panNW.add(panInfo, gbc);
412-
gbc.gridx = 1;
413-
gbc.gridheight = 1;
414-
gbc.fill = GridBagConstraints.BOTH;
415-
panNW.add(panObjectives, gbc);
416-
gbc.gridy = 1;
417-
panNW.add(panLoot, gbc);
418-
419-
gbc = new GridBagConstraints();
420-
gbc.gridx = 0;
421-
gbc.gridy = 0;
422-
gbc.weightx = 1.0;
423-
gbc.weighty = 0.0;
424406
gbc.anchor = GridBagConstraints.NORTHWEST;
425407
gbc.fill = GridBagConstraints.BOTH;
426-
panMain.add(panNW, gbc);
408+
panBasic.add(panInfo, gbc);
427409
gbc.gridx = 1;
428410
gbc.gridy = 0;
429-
gbc.gridheight = 2;
430-
gbc.weighty = 1.0;
431-
panMain.add(panWrite, gbc);
432-
gbc.gridx = 0;
433-
gbc.gridy = 1;
434-
gbc.gridheight = 1;
435-
panMain.add(panOtherForces, gbc);
411+
gbc.weightx = 1.0;
412+
panBasic.add(panWrite, gbc);
413+
414+
panRewards.add(panObjectives);
415+
panRewards.add(panLoot);
416+
417+
panTabs.add(resourceMap.getString("panTab.basic"), panBasic);
418+
panTabs.add(resourceMap.getString("panTab.rewards"), panRewards);
419+
panTabs.add(resourceMap.getString("panTab.otherforces"), panOtherForces);
420+
421+
getContentPane().add(panTabs, BorderLayout.CENTER);
422+
getContentPane().add(panBtn, BorderLayout.PAGE_END);
436423

437424
pack();
438425
}

MekHQ/src/mekhq/gui/dialog/CustomizeScenarioObjectiveDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ private void initObjectiveEffectPanel(ResourceBundle resourceMap) {
399399
panObjectiveEffect.add(btnAdd, gbcLeft);
400400

401401
JLabel lblSuccessEffects = new JLabel(resourceMap.getString("lblSuccessEffects.text"));
402-
JLabel lblFailureEffects = new JLabel(resourceMap.getString("lblSuccessEffects.text"));
402+
JLabel lblFailureEffects = new JLabel(resourceMap.getString("lblFailureEffects.text"));
403403

404404
successEffects = new JList<>(successEffectsModel);
405405
successEffects.addListSelectionListener(e -> btnRemoveSuccess.setEnabled(!successEffects.getSelectedValuesList().isEmpty()));

0 commit comments

Comments
 (0)