Shink toolbar height. BLD200402051900
authorpkuzel@netbeans.org
Thu, 05 Feb 2004 17:59:14 +0000
changeset 4118cd4b43d0f959
parent 4117 84f8bc79f72f
child 4119 f38471bf1a4f
Shink toolbar height.
tasklist.core/src/org/netbeans/modules/tasklist/core/TaskListView.java
tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/SourceTasksView.java
     1.1 --- a/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskListView.java	Thu Feb 05 17:03:42 2004 +0000
     1.2 +++ b/tasklist.core/src/org/netbeans/modules/tasklist/core/TaskListView.java	Thu Feb 05 17:59:14 2004 +0000
     1.3 @@ -85,6 +85,8 @@
     1.4       */
     1.5      private transient static Map views = null;
     1.6  
     1.7 +    protected static int TOOLBAR_HEIGHT_ADJUSTMENT = -2;
     1.8 +
     1.9      /**
    1.10       * Registers a view
    1.11       *
    1.12 @@ -290,7 +292,12 @@
    1.13      }
    1.14  
    1.15      private JLabel createMiniStatus() {
    1.16 -        return new JLabel();
    1.17 +        JLabel ret =  new JLabel();
    1.18 +        ret.setBorder(BorderFactory.createEmptyBorder());
    1.19 +        Dimension dim = ret.getPreferredSize();
    1.20 +        dim.height += TOOLBAR_HEIGHT_ADJUSTMENT;
    1.21 +        ret.setPreferredSize(dim);
    1.22 +        return ret;
    1.23      }
    1.24  
    1.25      protected final void setMiniStatus(String text) {
     2.1 --- a/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/SourceTasksView.java	Thu Feb 05 17:03:42 2004 +0000
     2.2 +++ b/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/SourceTasksView.java	Thu Feb 05 17:59:14 2004 +0000
     2.3 @@ -25,6 +25,7 @@
     2.4  
     2.5  import javax.swing.*;
     2.6  import javax.swing.border.Border;
     2.7 +import javax.swing.border.CompoundBorder;
     2.8  import javax.accessibility.AccessibleContext;
     2.9  
    2.10  import org.openide.util.NbBundle;
    2.11 @@ -93,6 +94,8 @@
    2.12      private static final int RECENT_ITEMS_COUNT = 4;
    2.13      private ArrayList recentFolders = new ArrayList(RECENT_ITEMS_COUNT); // XXX it'd be nice to persist it
    2.14  
    2.15 +    private static Border buttonBorder;
    2.16 +
    2.17      /**
    2.18       * Externalization entry point (readExternal).
    2.19       */
    2.20 @@ -575,7 +578,7 @@
    2.21  
    2.22          public Dimension getPreferredSize() {
    2.23              Dimension dim = getAllFiles().getPreferredSize();
    2.24 -            return new Dimension(11, 28);
    2.25 +            return new Dimension(11, dim.height);
    2.26          }
    2.27      }
    2.28  
    2.29 @@ -744,11 +747,33 @@
    2.30      }
    2.31  
    2.32      /** Toolbar controls must be smaller*/
    2.33 -    private static void adjustHeight(AbstractButton c) {
    2.34 -        Insets in = c.getMargin();
    2.35 -        in.top = 0;
    2.36 -        in.bottom = 0;
    2.37 -        c.setMargin(in);
    2.38 +    private static void adjustHeight(AbstractButton button) {
    2.39 +
    2.40 +        button.setMargin(new Insets(0, 3, 0, 3));
    2.41 +
    2.42 +//        if (button instanceof JToggleButton) {
    2.43 +//            if (buttonBorder == null) { // for some l&f's, core will supply one
    2.44 +//                buttonBorder = UIManager.getBorder("nb.tabbutton.border"); //NOI18N
    2.45 +//            }
    2.46 +//
    2.47 +//            if (buttonBorder == null) {
    2.48 +//                JToolBar toolbar = new JToolBar();
    2.49 +//                toolbar.setRollover(true);
    2.50 +//                toolbar.add(button);
    2.51 +//                buttonBorder = button.getBorder();
    2.52 +//                toolbar.remove(button);
    2.53 +//            }
    2.54 +//
    2.55 +//            button.setBorder(buttonBorder);
    2.56 +//        }
    2.57 +
    2.58 +        // as we cannot get the button small enough using the margin and border...
    2.59 +        if (button.getBorder() instanceof CompoundBorder) { // from BasicLookAndFeel
    2.60 +            Dimension pref = button.getPreferredSize();
    2.61 +            pref.height += TOOLBAR_HEIGHT_ADJUSTMENT;
    2.62 +            button.setPreferredSize(pref);
    2.63 +        }
    2.64 +
    2.65      }
    2.66  
    2.67      public void updateFilterCount() {