296 /** |
296 /** |
297 * @see XBaseMenuWindow#getSubmenuBounds |
297 * @see XBaseMenuWindow#getSubmenuBounds |
298 */ |
298 */ |
299 protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) { |
299 protected Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) { |
300 Rectangle globalBounds = toGlobal(itemBounds); |
300 Rectangle globalBounds = toGlobal(itemBounds); |
301 Dimension screenSize = graphicsConfig.getBounds().getSize(); |
301 Rectangle screenBounds = getCurrentGraphicsConfiguration().getBounds(); |
302 Rectangle res; |
302 Rectangle res; |
303 res = fitWindowBelow(globalBounds, windowSize, screenSize); |
303 res = fitWindowBelow(globalBounds, windowSize, screenBounds); |
304 if (res != null) { |
304 if (res != null) { |
305 return res; |
305 return res; |
306 } |
306 } |
307 res = fitWindowAbove(globalBounds, windowSize, screenSize); |
307 res = fitWindowAbove(globalBounds, windowSize, screenBounds); |
308 if (res != null) { |
308 if (res != null) { |
309 return res; |
309 return res; |
310 } |
310 } |
311 res = fitWindowRight(globalBounds, windowSize, screenSize); |
311 res = fitWindowRight(globalBounds, windowSize, screenBounds); |
312 if (res != null) { |
312 if (res != null) { |
313 return res; |
313 return res; |
314 } |
314 } |
315 res = fitWindowLeft(globalBounds, windowSize, screenSize); |
315 res = fitWindowLeft(globalBounds, windowSize, screenBounds); |
316 if (res != null) { |
316 if (res != null) { |
317 return res; |
317 return res; |
318 } |
318 } |
319 return fitWindowToScreen(windowSize, screenSize); |
319 return fitWindowToScreen(windowSize, screenBounds); |
320 } |
320 } |
321 |
321 |
322 /** |
322 /** |
323 * This function is called when it's likely that |
323 * This function is called when it's likely that |
324 * size of items has changed. |
324 * size of items has changed. |