189 |
*/ |
*/ |
190 |
if (containerSize.width == 0 && containerSize.height == 0) |
if (containerSize.width == 0 && containerSize.height == 0) |
191 |
{ |
{ |
192 |
if (menuBar != null) |
if (menuBar != null) |
193 |
{ |
{ |
194 |
int maxWidth; |
int maxWidth; |
195 |
menuBarSize = menuBar.getPreferredSize(); |
menuBarSize = menuBar.getPreferredSize(); |
196 |
maxWidth = Math.max(menuBarSize.width, contentPaneSize.width); |
maxWidth = Math.max(menuBarSize.width, contentPaneSize.width); |
197 |
menuBar.setBounds(0, 0, maxWidth, menuBarSize.height); |
menuBar.setBounds(0, 0, maxWidth, menuBarSize.height); |
198 |
glassPane.setBounds(0, menuBarSize.height, maxWidth, |
glassPane.setBounds(0, menuBarSize.height, maxWidth, |
199 |
contentPaneSize.height); |
contentPaneSize.height); |
200 |
contentPane.setBounds(0, menuBarSize.height, maxWidth, |
contentPane.setBounds(0, menuBarSize.height, maxWidth, |
201 |
contentPaneSize.height); |
contentPaneSize.height); |
202 |
layeredPane.setSize(maxWidth, |
layeredPane.setSize(maxWidth, |
203 |
menuBarSize.height + contentPaneSize.height); |
menuBarSize.height + contentPaneSize.height); |
204 |
} |
} |
205 |
else |
else |
206 |
{ |
{ |
207 |
glassPane.setBounds(0, 0, contentPaneSize.width, |
glassPane.setBounds(0, 0, contentPaneSize.width, |
208 |
contentPaneSize.height); |
contentPaneSize.height); |
209 |
contentPane.setBounds(0, 0, contentPaneSize.width, |
contentPane.setBounds(0, 0, contentPaneSize.width, |
210 |
contentPaneSize.height); |
contentPaneSize.height); |
211 |
layeredPane.setSize(contentPaneSize.width, contentPaneSize.height); |
layeredPane.setSize(contentPaneSize.width, contentPaneSize.height); |
212 |
} |
} |
213 |
} |
} |
214 |
else |
else |
215 |
{ |
{ |
216 |
if (menuBar != null) |
if (menuBar != null) |
217 |
{ |
{ |
218 |
menuBarSize = menuBar.getPreferredSize(); |
menuBarSize = menuBar.getPreferredSize(); |
219 |
if (menuBarSize.height > containerSize.height) |
if (menuBarSize.height > containerSize.height) |
220 |
menuBarSize.height = containerSize.height; |
menuBarSize.height = containerSize.height; |
221 |
menuBar.setBounds(0, 0, containerSize.width, menuBarSize.height); |
menuBar.setBounds(0, 0, menuBarSize.width, menuBarSize.height); |
222 |
int remainingHeight = containerSize.height - menuBarSize.height; |
int remainingHeight = containerSize.height - menuBarSize.height; |
223 |
glassPane.setBounds(0, menuBarSize.height, containerSize.width, |
glassPane.setBounds(0, menuBarSize.height, containerSize.width, |
224 |
containerSize.height - menuBarSize.height); |
containerSize.height - menuBarSize.height); |
225 |
contentPane.setBounds(0, menuBarSize.height, |
contentPane.setBounds(0, menuBarSize.height, |
226 |
containerSize.width, |
containerSize.width, |
227 |
(containerSize.height - menuBarSize.height)); |
(containerSize.height - menuBarSize.height)); |
228 |
} |
} |
229 |
else |
else |
230 |
{ |
{ |
231 |
glassPane.setBounds(0, 0, containerSize.width, |
glassPane.setBounds(0, 0, containerSize.width, |
232 |
containerSize.height); |
containerSize.height); |
233 |
contentPane.setBounds(0, 0, containerSize.width, |
contentPane.setBounds(0, 0, containerSize.width, |
234 |
containerSize.height); |
containerSize.height); |
235 |
} |
} |
236 |
|
|
237 |
layeredPane.setSize(containerSize.width, containerSize.height); |
layeredPane.setSize(containerSize.width, containerSize.height); |
238 |
} |
} |
239 |
} |
} |
240 |
|
|
279 |
|
|
280 |
if (containerSize.width == 0 && containerSize.height == 0) |
if (containerSize.width == 0 && containerSize.height == 0) |
281 |
{ |
{ |
282 |
if (menuBar != null) |
if (menuBar != null) |
283 |
{ |
{ |
284 |
int maxWidth; |
int maxWidth; |
285 |
menuBarSize = menuBar.getPreferredSize(); |
menuBarSize = menuBar.getPreferredSize(); |
286 |
maxWidth = Math.max(menuBarSize.width, contentPaneSize.width); |
maxWidth = Math.max(menuBarSize.width, contentPaneSize.width); |
287 |
prefSize = new Dimension(maxWidth, |
prefSize = new Dimension(maxWidth, |
288 |
contentPaneSize.height |
contentPaneSize.height |
289 |
+ menuBarSize.height); |
+ menuBarSize.height); |
290 |
} |
} |
291 |
else |
else |
292 |
prefSize = contentPaneSize; |
prefSize = contentPaneSize; |
293 |
} |
} |
294 |
else |
else |
295 |
prefSize = c.getSize(); |
prefSize = c.getSize(); |
296 |
|
|
297 |
return prefSize; |
return prefSize; |
298 |
} |
} |
319 |
public static final int FILE_CHOOSER_DIALOG = 6; |
public static final int FILE_CHOOSER_DIALOG = 6; |
320 |
public static final int QUESTION_DIALOG = 7; |
public static final int QUESTION_DIALOG = 7; |
321 |
public static final int WARNING_DIALOG = 8; |
public static final int WARNING_DIALOG = 8; |
322 |
|
|
323 |
/** DOCUMENT ME! */ |
/** DOCUMENT ME! */ |
324 |
protected Component glassPane; |
protected Component glassPane; |
325 |
|
|
609 |
public void setWindowDecorationStyle(int style) |
public void setWindowDecorationStyle(int style) |
610 |
{ |
{ |
611 |
if (style != NONE |
if (style != NONE |
612 |
&& style != FRAME |
&& style != FRAME |
613 |
&& style != INFORMATION_DIALOG |
&& style != INFORMATION_DIALOG |
614 |
&& style != ERROR_DIALOG |
&& style != ERROR_DIALOG |
615 |
&& style != COLOR_CHOOSER_DIALOG |
&& style != COLOR_CHOOSER_DIALOG |
616 |
&& style != FILE_CHOOSER_DIALOG |
&& style != FILE_CHOOSER_DIALOG |
617 |
&& style != QUESTION_DIALOG |
&& style != QUESTION_DIALOG |
618 |
&& style != WARNING_DIALOG) |
&& style != WARNING_DIALOG) |
619 |
throw new IllegalArgumentException("invalid style"); |
throw new IllegalArgumentException("invalid style"); |
620 |
|
|
621 |
int oldStyle = windowDecorationStyle; |
int oldStyle = windowDecorationStyle; |