163 |
popupMenu.setBorder(defaults.getBorder("PopupMenu.border")); |
popupMenu.setBorder(defaults.getBorder("PopupMenu.border")); |
164 |
popupMenu.setFont(defaults.getFont("PopupMenu.font")); |
popupMenu.setFont(defaults.getFont("PopupMenu.font")); |
165 |
popupMenu.setForeground(defaults.getColor("PopupMenu.foreground")); |
popupMenu.setForeground(defaults.getColor("PopupMenu.foreground")); |
166 |
|
popupMenu.setOpaque(true); |
167 |
} |
} |
168 |
|
|
169 |
/** |
/** |
229 |
} |
} |
230 |
|
|
231 |
/** |
/** |
232 |
* This method returns the minimum size of the JPopupMenu. |
* This method returns the minimum size of the JPopupMenu. |
233 |
* |
* |
234 |
* @param c The JComponent to find a size for. |
* @param c The JComponent to find a size for. |
235 |
* |
* |
236 |
* @return The minimum size. |
* @return The minimum size. |
237 |
*/ |
*/ |
238 |
public Dimension getMinimumSize(JComponent c) |
public Dimension getMinimumSize(JComponent c) |
239 |
{ |
{ |
240 |
return null; |
return null; |
265 |
} |
} |
266 |
|
|
267 |
/** |
/** |
268 |
* Return true if given mouse event is a platform popup trigger, |
* Return true if given mouse event is a platform popup trigger, and false |
269 |
* and false otherwise |
* otherwise |
270 |
* |
* |
271 |
* @param e MouseEvent that is to be checked for popup trigger event |
* @param e MouseEvent that is to be checked for popup trigger event |
272 |
* |
* |
273 |
* @return true if given mouse event is a platform popup trigger, |
* @return true if given mouse event is a platform popup trigger, and false |
274 |
* and false otherwise |
* otherwise |
275 |
*/ |
*/ |
276 |
public boolean isPopupTrigger(MouseEvent e) |
public boolean isPopupTrigger(MouseEvent e) |
277 |
{ |
{ |
335 |
path[0] = popupMenu; |
path[0] = popupMenu; |
336 |
Component[] comps = popupMenu.getComponents(); |
Component[] comps = popupMenu.getComponents(); |
337 |
if (comps.length != 0 && comps[0] instanceof MenuElement) |
if (comps.length != 0 && comps[0] instanceof MenuElement) |
338 |
path[1] = (MenuElement) comps[0]; |
{ |
339 |
manager.setSelectedPath(path); |
path[1] = (MenuElement) comps[0]; |
340 |
|
manager.setSelectedPath(path); |
341 |
|
} |
342 |
} |
} |
343 |
} |
} |
344 |
} |
} |
345 |
|
|
346 |
/** |
/** |
347 |
* ComponentListener that listens to Component Events fired by the |
* ComponentListener that listens to Component Events fired by the top - |
348 |
* top - level window to which popup menu belongs. If top-level |
* level window to which popup menu belongs. If top-level window was |
349 |
* window was resized, moved or hidded then popup menu will |
* resized, moved or hidded then popup menu will be hidded and selected |
350 |
* be hidded and selected path of current menu hierarchy will be set |
* path of current menu hierarchy will be set to null. |
|
* to null. |
|
|
* |
|
351 |
*/ |
*/ |
352 |
private class TopWindowListener implements ComponentListener |
private class TopWindowListener implements ComponentListener |
353 |
{ |
{ |
354 |
/** |
/** |
355 |
* This method is invoked when top-level window is resized. |
* This method is invoked when top-level window is resized. This method |
356 |
* This method closes current menu hierarchy. |
* closes current menu hierarchy. |
357 |
* |
* |
358 |
* @param e The ComponentEvent |
* @param e The ComponentEvent |
359 |
*/ |
*/ |
364 |
} |
} |
365 |
|
|
366 |
/** |
/** |
367 |
* This method is invoked when top-level window is moved. |
* This method is invoked when top-level window is moved. This method |
368 |
* This method closes current menu hierarchy. |
* closes current menu hierarchy. |
369 |
* |
* |
370 |
* @param e The ComponentEvent |
* @param e The ComponentEvent |
371 |
*/ |
*/ |
376 |
} |
} |
377 |
|
|
378 |
/** |
/** |
379 |
* This method is invoked when top-level window is shown |
* This method is invoked when top-level window is shown This method does |
380 |
* This method does nothing by default. |
* nothing by default. |
381 |
* |
* |
382 |
* @param e The ComponentEvent |
* @param e The ComponentEvent |
383 |
*/ |
*/ |
388 |
} |
} |
389 |
|
|
390 |
/** |
/** |
391 |
* This method is invoked when top-level window is hidden |
* This method is invoked when top-level window is hidden This method |
392 |
* This method closes current menu hierarchy. |
* closes current menu hierarchy. |
393 |
* |
* |
394 |
* @param e The ComponentEvent |
* @param e The ComponentEvent |
395 |
*/ |
*/ |