ToolWindow incorrect alignments.

I create a JPanel and I want to have two columns in it. So I used grid layout with single row and two columns. Here myToolWindow is a JPanel. box and countermeasure_box should display inside this 2 columns. The following is my code and its output. As you can see it contains 3 columns and expected output spread only through 2/3 of the window width instead of displaying 2 boxes within two columns. Can anyone help to solve this problem ?

Code:


Output:

0
2 comments

Try using a BorderLayout instead and add 2 JPanels to it (one at BorderLayout.EAST and BorderLayout.WEST).

0

I tried it. But now the space is at the center.

0

Please sign in to leave a comment.