How do I make this FlowLayout wrap within its JSplitPane?

后端 未结 2 843
情书的邮戳
情书的邮戳 2021-01-07 08:41

I wrote this code sample to illustrate a problem I\'m having with my program.

I expect to be able to slide the JSplitPane\'s slider bar to the left, beyond the edge

相关标签:
2条回答
  • 2021-01-07 09:27

    Is there another layout manager besides FlowLayout that will do what I'm looking for?

    Wrap Layout should work.

    0 讨论(0)
  • 2021-01-07 09:29

    If you add this

    bottomleft.setMinimumSize(new Dimension(0, 0));
    

    before the pack() then it'll reflow. BUT, it won't re-pack the border layout, so instead of two lines you'll get one with the rest cut off. So after a resize you'll have to repack the border layout. If you omit the border layout then it'll reflow like you want.

    That said, you should avoid FlowLayout like the plague. Most of the layouts that come with Swing are poor, but FlowLayout is one of the worst offenders.

    0 讨论(0)
提交回复
热议问题