public Dimension getPreferredSize() { Dimension dim = new Dimension(0,0); int width = bar.getPreferredSize().width; Dimension minSize = getMinimumSize(); if (width<minSize.width) width = minSize.width; int height = bar.getPreferredSize().height; dim = new Dimension(width, height); return dim; }
public Dimension getPreferredSize() { Dimension dim = new Dimension(0,0); int width = bar.getPreferredSize().width; Dimension minSize = getMinimumSize(); if (width<minSize.width) width = minSize.width; int height = bar.getPreferredSize().height; dim = new Dimension(width, height); return dim; }
/** * Returns the preferred size of the scrollbar. It is the same as the * preferred size of a normal scrollbar but with a thickness of * ImgScrollPane.SCROLLBAR_THICKNESS. * * @return The Scrollbar preferred size * */ public Dimension getPreferredSize() { Dimension psz = super.getPreferredSize(); if (getOrientation() == HORIZONTAL) { psz.height = ImgScrollPane.SCROLLBAR_THICKNESS; } else { psz.width = ImgScrollPane.SCROLLBAR_THICKNESS; } return psz; }
/** * Returns the preferred size of the scrollbar. It is the same as the * preferred size of a normal scrollbar but with a thickness of * ImgScrollPane.SCROLLBAR_THICKNESS. * * @return The Scrollbar preferred size * */ public Dimension getPreferredSize() { Dimension psz = super.getPreferredSize(); if (getOrientation() == HORIZONTAL) { psz.height = ImgScrollPane.SCROLLBAR_THICKNESS; } else { psz.width = ImgScrollPane.SCROLLBAR_THICKNESS; } return psz; }
@Override public Dimension getPreferredSize() { Dimension dim = new Dimension(0, 0); if (orientation == Scrollbar.HORIZONTAL) { int width = bar.getPreferredSize().width + label.getPreferredSize().width; final Dimension minSize = getMinimumSize(); if (width < minSize.width) width = minSize.width; final int height = bar.getPreferredSize().height; dim = new Dimension(width, height); } else { int height = bar.getPreferredSize().height + label.getPreferredSize().height; final Dimension minSize = getMinimumSize(); if (height < minSize.height) height = minSize.height; // int width = Math.max(bar.getPreferredSize().width, label.getPreferredSize().width); final int width = bar.getPreferredSize().width; dim = new Dimension(width, height); } return dim; }