1 | package installer;↵ | | 1 | package org.gjt.sp.jedit.gui;↵
|
|
|
2 | import java.awt.*;↵ | | 2 | import java.awt.*;↵
|
|
3 | // This is copied from jEdit's org.gjt.sp.jedit.gui package.↵ | | |
|
|
4 | /**↵ | | 3 | /**↵
|
5 | * The <code>VariableGridLayout</code> class is a layout manager↵ | | 4 | * The <code>VariableGridLayout</code> class is a layout manager↵
|
6 | * that lays out a container's components in a rectangular grid↵ | | 5 | * that lays out a container's components in a rectangular grid↵
|
7 | * with variable cell sizes.<p>↵ | | 6 | * with variable cell sizes.<p>↵
|
8 | *↵ | | 7 | *↵
|
9 | * The container is divided into rectangles, and one component is placed↵ | | 8 | * The container is divided into rectangles, and one component is placed↵
|
10 | * in each rectangle. Each row is as large as the largest component in↵ | | 9 | * in each rectangle. Each row is as large as the largest component in↵
|
11 | * that row, and each column is as wide as the widest component in↵ | | 10 | * that row, and each column is as wide as the widest component in↵
|
12 | * that column.<p>↵ | | 11 | * that column.<p>↵
|
13 | *↵ | | 12 | *↵
|
14 | * This behavior is basically the same as in↵ | | 13 | * This behavior is basically the same as in↵
|
15 | * <code>java.awt.GridLayout</code>, but with different row heights and↵ | | 14 | * <code>java.awt.GridLayout</code>, but with different row heights and↵
|
16 | * column widths for each row/column.<p>↵ | | 15 | * column widths for each row/column.<p>↵
|
17 | *↵ | | 16 | *↵
|
18 | * For example, the following is an applet that lays out six buttons↵ | | 17 | * For example, the following is an applet that lays out six buttons↵
|
19 | * into three rows and two columns:<p>↵ | | 18 | * into three rows and two columns:<p>↵
|
20 | *↵ | | 19 | *↵
|
21 | * <blockquote><pre>↵ | | 20 | * <blockquote><pre>↵
|
22 | * import java.awt.*;↵ | | 21 | * import java.awt.*;↵
|
23 | * import java.applet.Applet;↵ | | 22 | * import java.applet.Applet;↵
|
24 | * public class ButtonGrid extends Applet {↵ | | 23 | * public class ButtonGrid extends Applet {↵
|
25 | * public void init() {↵ | | 24 | * public void init() {↵
|
26 | * setLayout(new VariableGridLayout(VariableGridLayout.FIXED_NUM_COLUMNS, 2));↵ | | 25 | * setLayout(new VariableGridLayout(VariableGridLayout.FIXED_NUM_COLUMNS, 2));↵
|
27 | * add(new Button("1"));↵ | | 26 | * add(new Button("1"));↵
|
28 | * add(new Button("2"));↵ | | 27 | * add(new Button("2"));↵
|
29 | * add(new Button("3"));↵ | | 28 | * add(new Button("3"));↵
|
30 | * add(new Button("4"));↵ | | 29 | * add(new Button("4"));↵
|
31 | * add(new Button("5"));↵ | | 30 | * add(new Button("5"));↵
|
32 | * add(new Button("6"));↵ | | 31 | * add(new Button("6"));↵
|
33 | * }↵ | | 32 | * }↵
|
34 | * }↵ | | 33 | * }↵
|
35 | * </pre></blockquote><p>↵ | | 34 | * </pre></blockquote><p>↵
|
36 | *↵ | | 35 | *↵
|
37 | * <b>Programmer's remark:</b> VariableGridLayout could be faster, if it would↵ | | 36 | * <b>Programmer's remark:</b> VariableGridLayout could be faster, if it would↵
|
38 | * reside in the package java.awt, because then it could access some↵ | | 37 | * reside in the package java.awt, because then it could access some↵
|
39 | * package private fields of <code>Container</code> or↵ | | 38 | * package private fields of <code>Container</code> or↵
|
40 | * <code>Component</code>. Instead, it has to call↵ | | 39 | * <code>Component</code>. Instead, it has to call↵
|
41 | * <code>Component.getSize()</code>,↵ | | 40 | * <code>Component.getSize()</code>,↵
|
42 | * which allocates memory on the heap.<p>↵ | | 41 | * which allocates memory on the heap.<p>↵
|
43 | *↵ | | 42 | *↵
|
44 | * <b>Todo:</b>↵ | | 43 | * <b>Todo:</b>↵
|
45 | * <ul>↵ | | 44 | * <ul>↵
|
46 | * <li>Use alignmentX/Y property if the grid cell is larger than the preferred size of the component.↵ | | 45 | * <li>Use alignmentX/Y property if the grid cell is larger than the preferred size of the component.↵
|
47 | * <li>Ability to span components over more than one cell horizontally↵ | | 46 | * <li>Ability to span components over more than one cell horizontally↵
|
48 | * </ul>↵ | | 47 | * </ul>↵
|
49 | *↵ | | 48 | *↵
|
50 | * @author Dirk Moebius↵ | | 49 | * @author Dirk Moebius↵
|
51 | * @version 1.0↵ | | 50 | * @version 1.0↵
|
52 | * @see java.awt.GridLayout↵ | | 51 | * @see java.awt.GridLayout↵
|
53 | */↵ | | 52 | */↵
|
54 | public class VariableGridLayout implements LayoutManager2, java.io.Serializable↵ | | 53 | public class VariableGridLayout implements LayoutManager2, java.io.Serializable↵
|
55 | {↵ | | 54 | {↵
|
|
56 | public static final int FIXED_NUM_ROWS = 1;↵ | | 55 | public static final int FIXED_NUM_ROWS = 1;↵
|
57 | public static final int FIXED_NUM_COLUMNS = 2;↵ | | 56 | public static final int FIXED_NUM_COLUMNS = 2;↵
|
|
|
58 | public VariableGridLayout(int mode, int size, int hgap, int vgap) {↵ | | 57 | public VariableGridLayout(int mode, int size, int hgap, int vgap) {↵
|
59 | if (mode != FIXED_NUM_ROWS && mode != FIXED_NUM_COLUMNS) {↵ | | 58 | if (mode != FIXED_NUM_ROWS && mode != FIXED_NUM_COLUMNS) {↵
|
60 | throw new IllegalArgumentException("illegal mode; value is " + mode);↵ | | 59 | throw new IllegalArgumentException("illegal mode; value is " + mode);↵
|
61 | }↵ | | 60 | }↵
|
62 | if (size <= 0) {↵ | | 61 | if (size <= 0) {↵
|
63 | throw new IllegalArgumentException("size cannot be zero or less; value is " + size);↵ | | 62 | throw new IllegalArgumentException("size cannot be zero or less; value is " + size);↵
|
64 | }↵ | | 63 | }↵
|
65 | if (hgap < 0) {↵ | | 64 | if (hgap < 0) {↵
|
66 | throw new IllegalArgumentException("hgap cannot be negative; value is " + hgap);↵ | | 65 | throw new IllegalArgumentException("hgap cannot be negative; value is " + hgap);↵
|
67 | }↵ | | 66 | }↵
|
68 | if (vgap < 0) {↵ | | 67 | if (vgap < 0) {↵
|
69 | throw new IllegalArgumentException("vgap cannot be negative; value is " + vgap);↵ | | 68 | throw new IllegalArgumentException("vgap cannot be negative; value is " + vgap);↵
|
70 | }↵ | | 69 | }↵
|
71 | this.mode = mode;↵ | | 70 | this.mode = mode;↵
|
72 | this.size = size;↵ | | 71 | this.size = size;↵
|
73 | this.hgap = hgap;↵ | | 72 | this.hgap = hgap;↵
|
74 | this.vgap = vgap;↵ | | 73 | this.vgap = vgap;↵
|
75 | }↵ | | 74 | }↵
|
|
|
76 | /**↵ | | 75 | /**↵
|
77 | * Creates a variable grid layout manager with the specified mode↵ | | 76 | * Creates a variable grid layout manager with the specified mode↵
|
78 | * and zero horizontal and vertical gap.↵ | | 77 | * and zero horizontal and vertical gap.↵
|
79 | */↵ | | 78 | */↵
|
80 | public VariableGridLayout(int mode, int size) {↵ | | 79 | public VariableGridLayout(int mode, int size) {↵
|
81 | this(mode, size, 0, 0);↵ | | 80 | this(mode, size, 0, 0);↵
|
82 | }↵ | | 81 | }↵
|
|
|
83 | /**↵ | | 82 | /**↵
|
84 | * Creates a variable grid layout manager with mode FIXED_NUM_ROWS,↵ | | 83 | * Creates a variable grid layout manager with mode FIXED_NUM_ROWS,↵
|
85 | * number of rows == 1 and zero horizontal and vertical gap.↵ | | 84 | * number of rows == 1 and zero horizontal and vertical gap.↵
|
86 | */↵ | | 85 | */↵
|
87 | public VariableGridLayout() {↵ | | 86 | public VariableGridLayout() {↵
|
88 | this(FIXED_NUM_ROWS, 1, 0, 0);↵ | | 87 | this(FIXED_NUM_ROWS, 1, 0, 0);↵
|
89 | }↵ | | 88 | }↵
|
|
|
90 | /**↵ | | 89 | /**↵
|
91 | * Not used in this class.↵ | | 90 | * Not used in this class.↵
|
92 | */↵ | | 91 | */↵
|
93 | public void addLayoutComponent(String name, Component component) { }↵ | | 92 | public void addLayoutComponent(String name, Component component) { }↵
|
|
|
94 | /**↵ | | 93 | /**↵
|
95 | * Not used in this class.↵ | | 94 | * Not used in this class.↵
|
96 | */↵ | | 95 | */↵
|
97 | public void addLayoutComponent(Component component, Object constraints) { }↵ | | 96 | public void addLayoutComponent(Component component, Object constraints) { }↵
|
|
|
98 | /**↵ | | 97 | /**↵
|
99 | * Not used in this class.↵ | | 98 | * Not used in this class.↵
|
100 | */↵ | | 99 | */↵
|
101 | public void removeLayoutComponent(Component component) { }↵ | | 100 | public void removeLayoutComponent(Component component) { }↵
|
|
|
102 | /**↵ | | 101 | /**↵
|
103 | * Always returns 0.5.↵ | | 102 | * Always returns 0.5.↵
|
104 | */↵ | | 103 | */↵
|
105 | public float getLayoutAlignmentX(Container container) {↵ | | 104 | public float getLayoutAlignmentX(Container container) {↵
|
106 | return 0.5f;↵ | | 105 | return 0.5f;↵
|
107 | }↵ | | 106 | }↵
|
|
|
108 | /**↵ | | 107 | /**↵
|
109 | * Always returns 0.5.↵ | | 108 | * Always returns 0.5.↵
|
110 | */↵ | | 109 | */↵
|
111 | public float getLayoutAlignmentY(Container container) {↵ | | 110 | public float getLayoutAlignmentY(Container container) {↵
|
112 | return 0.5f;↵ | | 111 | return 0.5f;↵
|
113 | }↵ | | 112 | }↵
|
|
|
114 | public Dimension preferredLayoutSize(Container parent) {↵ | | 113 | public Dimension preferredLayoutSize(Container parent) {↵
|
115 | return getLayoutSize(parent, 2);↵ | | 114 | return getLayoutSize(parent, 2);↵
|
116 | }↵ | | 115 | }↵
|
|
|
117 | public Dimension minimumLayoutSize(Container parent) {↵ | | 116 | public Dimension minimumLayoutSize(Container parent) {↵
|
118 | return getLayoutSize(parent, 0);↵ | | 117 | return getLayoutSize(parent, 0);↵
|
119 | }↵ | | 118 | }↵
|
|
|
120 | public Dimension maximumLayoutSize(Container parent) {↵ | | 119 | public Dimension maximumLayoutSize(Container parent) {↵
|
121 | return getLayoutSize(parent, 1);↵ | | 120 | return getLayoutSize(parent, 1);↵
|
122 | }↵ | | 121 | }↵
|
|
|
123 | public void layoutContainer(Container parent) {↵ | | 122 | public void layoutContainer(Container parent) {↵
|
124 | synchronized (parent.getTreeLock()) {↵ | | 123 | synchronized (parent.getTreeLock()) {↵
|
125 | update(parent);↵ | | 124 | update(parent);↵
|
|
126 | int ncomponents = parent.getComponentCount();↵ | | 125 | int ncomponents = parent.getComponentCount();↵
|
|
127 | if (ncomponents == 0) {↵ | | 126 | if (ncomponents == 0) {↵
|
128 | return;↵ | | 127 | return;↵
|
129 | }↵ | | 128 | }↵
|
|
130 | // Pass 1: compute preferred row heights / column widths↵ | | 129 | // Pass 1: compute preferred row heights / column widths↵
|
131 | int total_height = 0;↵ | | 130 | int total_height = 0;↵
|
132 | for (int r = 0, i = 0; r < nrows; r++) {↵ | | 131 | for (int r = 0, i = 0; r < nrows; r++) {↵
|
133 | for (int c = 0; c < ncols; c++, i++) {↵ | | 132 | for (int c = 0; c < ncols; c++, i++) {↵
|
134 | if (i < ncomponents) {↵ | | 133 | if (i < ncomponents) {↵
|
135 | Dimension d = parent.getComponent(i).getPreferredSize();↵ | | 134 | Dimension d = parent.getComponent(i).getPreferredSize();↵
|
136 | row_heights[r] = Math.max(row_heights[r], d.height);↵ | | 135 | row_heights[r] = Math.max(row_heights[r], d.height);↵
|
137 | col_widths[c] = Math.max(col_widths[c], d.width);↵ | | 136 | col_widths[c] = Math.max(col_widths[c], d.width);↵
|
138 | } else {↵ | | 137 | } else {↵
|
139 | break;↵ | | 138 | break;↵
|
140 | }↵ | | 139 | }↵
|
141 | }↵ | | 140 | }↵
|
142 | total_height += row_heights[r];↵ | | 141 | total_height += row_heights[r];↵
|
143 | }↵ | | 142 | }↵
|
|
144 | int total_width = 0;↵ | | 143 | int total_width = 0;↵
|
145 | for (int c = 0; c < ncols; c++) {↵ | | 144 | for (int c = 0; c < ncols; c++) {↵
|
146 | total_width += col_widths[c];↵ | | 145 | total_width += col_widths[c];↵
|
147 | }↵ | | 146 | }↵
|
|
148 | // Pass 2: redistribute free space↵ | | 147 | // Pass 2: redistribute free space↵
|
149 | Dimension parent_size = parent.getSize();↵ | | 148 | Dimension parent_size = parent.getSize();↵
|
150 | Insets insets = parent.getInsets();↵ | | 149 | Insets insets = parent.getInsets();↵
|
151 | int free_height = parent_size.height - insets.top - insets.bottom - (nrows - 1) * vgap;↵ | | 150 | int free_height = parent_size.height - insets.top - insets.bottom - (nrows - 1) * vgap;↵
|
152 | int free_width = parent_size.width - insets.left - insets.right - (ncols - 1) * hgap;↵ | | 151 | int free_width = parent_size.width - insets.left - insets.right - (ncols - 1) * hgap;↵
|
|
153 | if (total_height != free_height) {↵ | | 152 | if (total_height != free_height) {↵
|
154 | double dy = (double)free_height / (double)total_height;↵ | | 153 | double dy = (double)free_height / (double)total_height;↵
|
155 | for (int r = 0; r < nrows; r++) {↵ | | 154 | for (int r = 0; r < nrows; r++) {↵
|
156 | row_heights[r] = (int) ((double)row_heights[r] * dy);↵ | | 155 | row_heights[r] = (int) ((double)row_heights[r] * dy);↵
|
157 | }↵ | | 156 | }↵
|
158 | }↵ | | 157 | }↵
|
|
159 | if (total_width != free_width) {↵ | | 158 | if (total_width != free_width) {↵
|
160 | double dx = ((double)free_width) / ((double)total_width);↵ | | 159 | double dx = ((double)free_width) / ((double)total_width);↵
|
161 | for (int c = 0; c < ncols; c++) {↵ | | 160 | for (int c = 0; c < ncols; c++) {↵
|
162 | col_widths[c] = (int) ((double)col_widths[c] * dx);↵ | | 161 | col_widths[c] = (int) ((double)col_widths[c] * dx);↵
|
163 | }↵ | | 162 | }↵
|
164 | }↵ | | 163 | }↵
|
|
165 | // Pass 3: layout components↵ | | 164 | // Pass 3: layout components↵
|
166 | for (int r = 0, y = insets.top, i = 0; r < nrows; y += row_heights[r] + vgap, r++) {↵ | | 165 | for (int r = 0, y = insets.top, i = 0; r < nrows; y += row_heights[r] + vgap, r++) {↵
|
167 | for (int c = 0, x = insets.left; c < ncols; x += col_widths[c] + hgap, c++, i++) {↵ | | 166 | for (int c = 0, x = insets.left; c < ncols; x += col_widths[c] + hgap, c++, i++) {↵
|
168 | if (i < ncomponents) {↵ | | 167 | if (i < ncomponents) {↵
|
169 | parent.getComponent(i).setBounds(x, y, col_widths[c], row_heights[r]);↵ | | 168 | parent.getComponent(i).setBounds(x, y, col_widths[c], row_heights[r]);↵
|
170 | }↵ | | 169 | }↵
|
171 | }↵ | | 170 | }↵
|
172 | }↵ | | 171 | }↵
|
|
173 | } // synchronized↵ | | 172 | } // synchronized↵
|
174 | }↵ | | 173 | }↵
|
|
|
175 | public void invalidateLayout(Container container) {}↵ | | 174 | public void invalidateLayout(Container container) {}↵
|
|
|
176 | /**↵ | | 175 | /**↵
|
177 | * Returns the string representation of this variable grid layout's values.↵ | | 176 | * Returns the string representation of this variable grid layout's values.↵
|
178 | * @return a string representation of this variable grid layout.↵ | | 177 | * @return a string representation of this variable grid layout.↵
|
179 | */↵ | | 178 | */↵
|
180 | public String toString() {↵ | | 179 | public String toString() {↵
|
181 | return getClass().getName() + "[mode=" + mode + ",size=" + size↵ | | 180 | return getClass().getName() + "[mode=" + mode + ",size=" + size↵
|
182 | + ",hgap=" + hgap + ",vgap=" + vgap + "]";↵ | | 181 | + ",hgap=" + hgap + ",vgap=" + vgap + "]";↵
|
183 | }↵ | | 182 | }↵
|
|
|
184 | /**↵ | | 183 | /**↵
|
185 | * @param which if 0 compute minimum layout size,↵ | | 184 | * @param which if 0 compute minimum layout size,↵
|
186 | * if 1 compute maximum layout size,↵ | | 185 | * if 1 compute maximum layout size,↵
|
187 | * otherwise compute preferred layout size.↵ | | 186 | * otherwise compute preferred layout size.↵
|
188 | */↵ | | 187 | */↵
|
189 | private Dimension getLayoutSize(Container parent, int which) {↵ | | 188 | private Dimension getLayoutSize(Container parent, int which) {↵
|
190 | synchronized (parent.getTreeLock()){↵ | | 189 | synchronized (parent.getTreeLock()){↵
|
191 | update(parent);↵ | | 190 | update(parent);↵
|
|
192 | int ncomponents = parent.getComponentCount();↵ | | 191 | int ncomponents = parent.getComponentCount();↵
|
193 | int h = 0;↵ | | 192 | int h = 0;↵
|
194 | int w = 0;↵ | | 193 | int w = 0;↵
|
|
195 | for (int r = 0, i = 0; r < nrows; r++) {↵ | | 194 | for (int r = 0, i = 0; r < nrows; r++) {↵
|
196 | int row_height = 0;↵ | | 195 | int row_height = 0;↵
|
197 | for (int c = 0; c < ncols; c++, i++) {↵ | | 196 | for (int c = 0; c < ncols; c++, i++) {↵
|
198 | if (i < ncomponents) {↵ | | 197 | if (i < ncomponents) {↵
|
199 | switch (which) {↵ | | 198 | switch (which) {↵
|
200 | case 0:↵ | | 199 | case 0:↵
|
201 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);↵ | | 200 | row_height = Math.max(row_height, parent.getComponent(i).getMinimumSize().height);↵
|
202 | break;↵ | | 201 | break;↵
|
203 | case 1:↵ | | 202 | case 1:↵
|
204 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);↵ | | 203 | row_height = Math.max(row_height, parent.getComponent(i).getMaximumSize().height);↵
|
205 | break;↵ | | 204 | break;↵
|
206 | default:↵ | | 205 | default:↵
|
207 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);↵ | | 206 | row_height = Math.max(row_height, parent.getComponent(i).getPreferredSize().height);↵
|
208 | break;↵ | | 207 | break;↵
|
209 | }↵ | | 208 | }↵
|
210 | } else {↵ | | 209 | } else {↵
|
211 | break;↵ | | 210 | break;↵
|
212 | }↵ | | 211 | }↵
|
213 | }↵ | | 212 | }↵
|
214 | h += row_height;↵ | | 213 | h += row_height;↵
|
215 | }↵ | | 214 | }↵
|
|
216 | for (int c = 0; c < ncols; c++) {↵ | | 215 | for (int c = 0; c < ncols; c++) {↵
|
217 | int col_width = 0;↵ | | 216 | int col_width = 0;↵
|
218 | for (int r = 0; r < nrows; r++) {↵ | | 217 | for (int r = 0; r < nrows; r++) {↵
|
219 | int i = r * ncols + c;↵ | | 218 | int i = r * ncols + c;↵
|
220 | if (i < ncomponents) {↵ | | 219 | if (i < ncomponents) {↵
|
221 | switch (which) {↵ | | 220 | switch (which) {↵
|
222 | case 0:↵ | | 221 | case 0:↵
|
223 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);↵ | | 222 | col_width = Math.max(col_width, parent.getComponent(i).getMinimumSize().width);↵
|
224 | break;↵ | | 223 | break;↵
|
225 | case 1:↵ | | 224 | case 1:↵
|
226 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);↵ | | 225 | col_width = Math.max(col_width, parent.getComponent(i).getMaximumSize().width);↵
|
227 | break;↵ | | 226 | break;↵
|
228 | default:↵ | | 227 | default:↵
|
229 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);↵ | | 228 | col_width = Math.max(col_width, parent.getComponent(i).getPreferredSize().width);↵
|
230 | break;↵ | | 229 | break;↵
|
231 | }↵ | | 230 | }↵
|
232 | } else {↵ | | 231 | } else {↵
|
233 | break;↵ | | 232 | break;↵
|
234 | }↵ | | 233 | }↵
|
235 | }↵ | | 234 | }↵
|
236 | w += col_width;↵ | | 235 | w += col_width;↵
|
237 | }↵ | | 236 | }↵
|
|
238 | Insets insets = parent.getInsets();↵ | | 237 | Insets insets = parent.getInsets();↵
|
239 | return new Dimension(w + insets.left + insets.right + ((ncols - 1) * hgap),↵ | | 238 | return new Dimension(w + insets.left + insets.right + ((ncols - 1) * hgap),↵
|
240 | h + insets.top + insets.bottom + ((nrows - 1) * vgap));↵ | | 239 | h + insets.top + insets.bottom + ((nrows - 1) * vgap));↵
|
241 | }↵ | | 240 | }↵
|
242 | }↵ | | 241 | }↵
|
|
|
243 | private void update(Container container) {↵ | | 242 | private void update(Container container) {↵
|
244 | int ncomponents = container.getComponentCount();↵ | | 243 | int ncomponents = container.getComponentCount();↵
|
245 | int old_nrows = nrows;↵ | | 244 | int old_nrows = nrows;↵
|
246 | int old_ncols = ncols;↵ | | 245 | int old_ncols = ncols;↵
|
247 | if (this.mode == FIXED_NUM_ROWS) {↵ | | 246 | if (this.mode == FIXED_NUM_ROWS) {↵
|
248 | nrows = this.size;↵ | | 247 | nrows = this.size;↵
|
249 | ncols = (ncomponents + nrows - 1) / nrows;↵ | | 248 | ncols = (ncomponents + nrows - 1) / nrows;↵
|
250 | } else {↵ | | 249 | } else {↵
|
251 | ncols = this.size;↵ | | 250 | ncols = this.size;↵
|
252 | nrows = (ncomponents + ncols - 1) / ncols;↵ | | 251 | nrows = (ncomponents + ncols - 1) / ncols;↵
|
253 | }↵ | | 252 | }↵
|
254 | if (old_nrows != nrows) {↵ | | 253 | if (old_nrows != nrows) {↵
|
255 | row_heights = new int[nrows];↵ | | 254 | row_heights = new int[nrows];↵
|
256 | }↵ | | 255 | }↵
|
257 | if (old_ncols != ncols) {↵ | | 256 | if (old_ncols != ncols) {↵
|
258 | col_widths = new int[ncols];↵ | | 257 | col_widths = new int[ncols];↵
|
259 | }↵ | | 258 | }↵
|
260 | }↵ | | 259 | }↵
|
|
|
261 | private int mode;↵ | | 260 | private int mode;↵
|
262 | private int size;↵ | | 261 | private int size;↵
|
263 | private int hgap;↵ | | 262 | private int hgap;↵
|
264 | private int vgap;↵ | | 263 | private int vgap;↵
|
265 | private transient int nrows = -1;↵ | | 264 | private transient int nrows = -1;↵
|
266 | private transient int ncols = -1;↵ | | 265 | private transient int ncols = -1;↵
|
267 | private transient int[] row_heights = null;↵ | | 266 | private transient int[] row_heights = null;↵
|
268 | private transient int[] col_widths = null;↵ | | 267 | private transient int[] col_widths = null;↵
|
269 | } | | 268 | }
|