Browse Source

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 16 years ago
parent
commit
4c66bd3582
1 changed files with 10 additions and 14 deletions
  1. 10
    14
      src/com/dmdirc/ui/swing/dialogs/prefs/SwingPreferencesDialog.java

+ 10
- 14
src/com/dmdirc/ui/swing/dialogs/prefs/SwingPreferencesDialog.java View File

248
         final JLabel label = getLabel(setting);
248
         final JLabel label = getLabel(setting);
249
         final JComponent option = getComponent(setting);
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
         label.setLabelFor(option);
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
      */
394
      */
395
     private void addInlineCategory(final PreferencesCategory category,
395
     private void addInlineCategory(final PreferencesCategory category,
396
             final JPanel parent) {
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
         panel.setBorder(BorderFactory.createTitledBorder(category.getTitle()));
398
         panel.setBorder(BorderFactory.createTitledBorder(category.getTitle()));
400
         
399
         
401
         categories.put(category, panel);
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
         initCategory(category, panel, null, "");
404
         initCategory(category, panel, null, "");
406
     }
405
     }
414
      */
413
      */
415
     private void addCategory(final PreferencesCategory category,
414
     private void addCategory(final PreferencesCategory category,
416
             final DefaultMutableTreeNode parentNode, final String namePrefix) {
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
         final String path = namePrefix + "/" + category.getTitle();
417
         final String path = namePrefix + "/" + category.getTitle();
420
         DefaultMutableTreeNode newNode;
418
         DefaultMutableTreeNode newNode;
421
 
419
 
435
     
433
     
436
     private void initCategory(final PreferencesCategory category, final JPanel panel,
434
     private void initCategory(final PreferencesCategory category, final JPanel panel,
437
             final DefaultMutableTreeNode newNode, final String path) {
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
         for (PreferencesCategory child : category.getSubcats()) {
442
         for (PreferencesCategory child : category.getSubcats()) {
447
             if (child.isInline() && category.getInlineBefore()) {
443
             if (child.isInline() && category.getInlineBefore()) {
458
             }
454
             }
459
 
455
 
460
             panels.add((JPanel) category.getObject());
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
             return;
459
             return;
464
         }
460
         }

Loading…
Cancel
Save