public static int getHGap(LayoutManager layout) {
    if (layout instanceof BorderLayout) {
      return ((BorderLayout)layout).getHgap();
    }
    if (layout instanceof CardLayout) {
      return ((CardLayout)layout).getHgap();
    }
    return 0;
  }
public static int getHGap(LayoutManager layout)