@Override
    public void doLayout() {
      // align vertically
      Rectangle r = getBounds();
      Insets insets = getInsets();
      int x = insets.left;
      Dimension preferredSize = myScrollPane.getPreferredSize();
      myScrollPane.setBounds(x, (r.height - preferredSize.height) / 2, r.width - insets.left - insets.right, preferredSize.height);
    }
@Override
    public void doLayout()