Which layout should I use to fill a JLayeredPane with JButtons in a order?

854 views Asked by At

I want to fill the JLayeredPane in a order so that when it reaches the right margin it should then start from the next line ans fill the entire box with buttons. I want to design a Point Of Sale screen and its hard for me to arrange the buttons manually.

1

There are 1 answers

0
Christopher Deckers On BEST ANSWER

If I understand correctly, you want the layout manager to auto wrap the components. Maybe the default behavior of the FlowLayout is enough for you.

Otherwise, it is actually fairly easy to develop your own layout manager by subclassing LayoutManager or LayoutManager2. Tip: see how other simple layout managers are implemented to judge the complexity of the task.