JScrollPane 添加到流式布局的有多个JButton的JPanel上,如何使水平拉伸保持流式布局特点,垂直加滚动条?

JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
Creates a JScrollPane that displays the view  component in a viewport  whose view position can be controlled with a pair of scrollbars.

VERTICAL_SCROLLBAR_NEVER,HORIZONTAL_SCROLLBAR_AS_NEEDED

或者

voidsetHorizontalScrollBarPolicy(int policy)
          Determines when the horizontal scrollbar appears in the scrollpane.

void   setVerticalScrollBarPolicy(int policy) 
         Determines when the vertical scrollbar appears in the scrollpane.

你可能感兴趣的:(JavaGUI)