Explorar el Código

Prefs dialog no longer uses 2 panels per category for no sane reason

git-svn-id: http://svn.dmdirc.com/trunk@3401 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith hace 16 años
padre
commit
4c66bd3582
Se han modificado 1 ficheros con 10 adiciones y 14 borrados
  1. 10
    14
      src/com/dmdirc/ui/swing/dialogs/prefs/SwingPreferencesDialog.java

+ 10
- 14
src/com/dmdirc/ui/swing/dialogs/prefs/SwingPreferencesDialog.java Ver fichero

@@ -248,10 +248,10 @@ public final class SwingPreferencesDialog extends StandardDialog implements
248 248
         final JLabel label = getLabel(setting);
249 249
         final JComponent option = getComponent(setting);
250 250
 
251
-        ((JPanel) categories.get(category).getComponent(1)).add(label);
251
+        categories.get(category).add(label);
252 252
 
253 253
         label.setLabelFor(option);
254
-        ((JPanel) categories.get(category).getComponent(1)).add(option, "wrap");
254
+        categories.get(category).add(option, "wrap");
255 255
     }
256 256
 
257 257
     /**
@@ -394,13 +394,12 @@ public final class SwingPreferencesDialog extends StandardDialog implements
394 394
      */
395 395
     private void addInlineCategory(final PreferencesCategory category,
396 396
             final JPanel parent) {
397
-        final JPanel panel = new JPanel(new BorderLayout(SMALL_BORDER,
398
-                LARGE_BORDER));
397
+        final JPanel panel = new JPanel(new MigLayout("fillx, gap " + LARGE_BORDER));
399 398
         panel.setBorder(BorderFactory.createTitledBorder(category.getTitle()));
400 399
         
401 400
         categories.put(category, panel);
402 401
         
403
-        ((JPanel) parent.getComponent(1)).add(panel, "span, growx, wrap");
402
+        parent.add(panel, "span, growx, wrap");
404 403
 
405 404
         initCategory(category, panel, null, "");
406 405
     }
@@ -414,8 +413,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
414 413
      */
415 414
     private void addCategory(final PreferencesCategory category,
416 415
             final DefaultMutableTreeNode parentNode, final String namePrefix) {
417
-        final JPanel panel = new JPanel(new BorderLayout(SMALL_BORDER,
418
-                LARGE_BORDER));
416
+        final JPanel panel = new JPanel(new MigLayout("fillx, gap " + LARGE_BORDER));
419 417
         final String path = namePrefix + "/" + category.getTitle();
420 418
         DefaultMutableTreeNode newNode;
421 419
 
@@ -435,13 +433,11 @@ public final class SwingPreferencesDialog extends StandardDialog implements
435 433
     
436 434
     private void initCategory(final PreferencesCategory category, final JPanel panel,
437 435
             final DefaultMutableTreeNode newNode, final String path) {
438
-        final TextLabel infoLabel = new TextLabel(category.getDescription());
439
-        if (category.getDescription().isEmpty()) {
440
-            infoLabel.setVisible(false);
441
-        }
442 436
 
443
-        panel.add(infoLabel, BorderLayout.PAGE_START);
444
-        panel.add(new JPanel(new MigLayout("fillx, gap " + LARGE_BORDER)), BorderLayout.CENTER);        
437
+        if (!category.getDescription().isEmpty()) {
438
+            final TextLabel infoLabel = new TextLabel(category.getDescription());
439
+            panel.add(infoLabel, "span, growx, wrap");
440
+        }
445 441
 
446 442
         for (PreferencesCategory child : category.getSubcats()) {
447 443
             if (child.isInline() && category.getInlineBefore()) {
@@ -458,7 +454,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
458 454
             }
459 455
 
460 456
             panels.add((JPanel) category.getObject());
461
-            categories.get(category).add((JPanel) category.getObject(), 1);
457
+            categories.get(category).add((JPanel) category.getObject());
462 458
 
463 459
             return;
464 460
         }

Loading…
Cancelar
Guardar