20 package net.sf.gridarta.textedit.textarea;
22 import java.awt.Component;
23 import java.awt.Container;
24 import java.awt.Dimension;
25 import java.awt.Insets;
26 import java.awt.LayoutManager;
27 import java.util.ArrayList;
28 import java.util.Collection;
29 import org.jetbrains.annotations.NotNull;
30 import org.jetbrains.annotations.Nullable;
34 public static final String
CENTER =
"center";
36 public static final String
RIGHT =
"right";
38 public static final String
BOTTOM =
"bottom";
106 final Dimension dim =
new Dimension();
107 final Insets insets =
textArea.getInsets();
108 dim.width = insets.left + insets.right;
109 dim.height = insets.top + insets.bottom;
112 final Dimension centerPref =
center.getPreferredSize();
113 dim.width += centerPref.width;
114 dim.height += centerPref.height;
117 final Dimension rightPref =
right.getPreferredSize();
118 dim.width += rightPref.width;
121 final Dimension bottomPref =
bottom.getPreferredSize();
122 dim.height += bottomPref.height;
131 final Dimension dim =
new Dimension();
132 final Insets insets =
textArea.getInsets();
133 dim.width = insets.left + insets.right;
134 dim.height = insets.top + insets.bottom;
137 final Dimension centerPref =
center.getMinimumSize();
138 dim.width += centerPref.width;
139 dim.height += centerPref.height;
142 final Dimension rightPref =
right.getMinimumSize();
143 dim.width += rightPref.width;
146 final Dimension bottomPref =
bottom.getMinimumSize();
147 dim.height += bottomPref.height;
155 final Dimension size = parent.getSize();
156 final Insets insets = parent.getInsets();
157 final int insetsTop = insets.top;
158 int insetsLeft = insets.left;
159 final int insetsBottom = insets.bottom;
160 final int insetsRight = insets.right;
162 final int rightWidth =
right ==
null ? 0 :
right.getPreferredSize().width;
163 final int bottomHeight =
bottom ==
null ? 0 :
bottom.getPreferredSize().height;
164 final int centerWidth = size.width - rightWidth - insetsLeft - insetsRight;
165 final int centerHeight = size.height - bottomHeight - insetsTop - insetsBottom;
168 center.setBounds(insetsLeft, insetsTop, centerWidth, centerHeight);
172 right.setBounds(insetsLeft + centerWidth, insetsTop, rightWidth, centerHeight);
177 final Dimension dim = comp.getPreferredSize();
178 comp.setBounds(insetsLeft, insetsTop + centerHeight, dim.width, bottomHeight);
179 insetsLeft += dim.width;
183 bottom.setBounds(insetsLeft, insetsTop + centerHeight, size.width - rightWidth - insetsLeft - insetsRight, bottomHeight);