1 | if(position.equals(DockableWindowManager.TOP)↵ | | 1 | if(position.equals(DockableWindowManager.TOP)↵
|
2 | || position.equals(DockableWindowManager.BOTTOM))↵ | | 2 | || position.equals(DockableWindowManager.BOTTOM))↵
|
3 | {↵ | | 3 | {↵
|
4 | int width = dimension - insets.right;↵ | | 4 | int width = parent.getWidth() - insets.right;↵
|
5 | int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width);↵ | | 5 | int rowHeight = Math.max(dim.height,closeBox.getPreferredSize().width);↵
|
6 | int x = rowHeight * 2 + insets.left;↵ | | 6 | int x = rowHeight * 2 + insets.left;↵
|
7 | Dimension returnValue = new Dimension(0,rowHeight↵ | | 7 | Dimension returnValue = new Dimension(0,rowHeight↵
|
8 | + insets.top + insets.bottom);↵ | | 8 | + insets.top + insets.bottom);↵
|
|
9 | for(int i = 2; i < comp.length; i++)↵ | | 9 | for(int i = 2; i < comp.length; i++)↵
|
10 | {↵ | | 10 | {↵
|
11 | int btnWidth = comp[i].getPreferredSize().width;↵ | | 11 | int btnWidth = comp[i].getPreferredSize().width;↵
|
12 | if(btnWidth + x > width)↵ | | 12 | if(btnWidth + x > width)↵
|
13 | {↵ | | 13 | {↵
|
14 | returnValue.height += rowHeight;↵ | | 14 | returnValue.height += rowHeight;↵
|
15 | x = insets.left;↵ | | 15 | x = insets.left;↵
|
16 | }↵ | | 16 | }↵
|
|
17 | x += btnWidth;↵ | | 17 | x += btnWidth;↵
|
18 | }↵ | | 18 | }↵
|
19 | return returnValue.height;↵ | | 19 | return returnValue;↵
|
20 | }↵ | | 20 | }↵
|
21 | else↵ | | 21 | else↵
|
22 | {↵ | | 22 | {↵
|
23 | int height = dimension - insets.bottom;↵ | | 23 | int height = parent.getHeight() - insets.bottom;↵
|
24 | int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height);↵ | | 24 | int colWidth = Math.max(dim.width,closeBox.getPreferredSize().height);↵
|
25 | int y = colWidth * 2 + insets.top;↵ | | 25 | int y = colWidth * 2 + insets.top;↵
|
26 | Dimension returnValue = new Dimension(colWidth↵ | | 26 | Dimension returnValue = new Dimension(colWidth↵
|
27 | + insets.left + insets.right,0);↵ | | 27 | + insets.left + insets.right,0);↵
|
|
28 | for(int i = 2; i < comp.length; i++)↵ | | 28 | for(int i = 2; i < comp.length; i++)↵
|
29 | {↵ | | 29 | {↵
|
30 | int btnHeight = comp[i].getPreferredSize().height;↵ | | 30 | int btnHeight = comp[i].getPreferredSize().height;↵
|
31 | if(btnHeight + y > height)↵ | | 31 | if(btnHeight + y > height)↵
|
32 | {↵ | | 32 | {↵
|
33 | returnValue.width += colWidth;↵ | | 33 | returnValue.width += colWidth;↵
|
34 | y = insets.top;↵ | | 34 | y = insets.top;↵
|
35 | }↵ | | 35 | }↵
|
|
36 | y += btnHeight;↵ | | 36 | y += btnHeight;↵
|
37 | }↵ | | 37 | }↵
|
38 | return returnValue.width;↵ | | 38 | return returnValue;↵
|
39 | } | | 39 | }
|