286 final int desiredLocationY = -(getHeight() + 6);
287
288 Container parent = invoker.getParent();
289
290 for (Container p = parent; p != null; p = p.getParent()) {
291 if (p instanceof JRootPane) {
292 if (p.getParent() instanceof JInternalFrame) continue;
293 parent = ((JRootPane)p).getLayeredPane();
294 for (p = parent.getParent(); p != null && (!(p instanceof java.awt.Window)); p = p.getParent());
295 break;
296 }
297 }
298
299 final Point p = SwingUtilities.convertPoint(invoker, desiredLocationX, desiredLocationY, parent);
300 setLocation(p.x, p.y);
301 if (parent instanceof JLayeredPane) {
302 ((JLayeredPane)parent).add(this, JLayeredPane.POPUP_LAYER, 0);
303 }
304 }
305
306 public void hide() {
307 final Container parent = getParent();
308 final Rectangle r = this.getBounds();
309 if (parent == null) return;
310 parent.remove(this);
311 parent.repaint(r.x, r.y, r.width, r.height);
312 }
313 }
314 }
|
286 final int desiredLocationY = -(getHeight() + 6);
287
288 Container parent = invoker.getParent();
289
290 for (Container p = parent; p != null; p = p.getParent()) {
291 if (p instanceof JRootPane) {
292 if (p.getParent() instanceof JInternalFrame) continue;
293 parent = ((JRootPane)p).getLayeredPane();
294 for (p = parent.getParent(); p != null && (!(p instanceof java.awt.Window)); p = p.getParent());
295 break;
296 }
297 }
298
299 final Point p = SwingUtilities.convertPoint(invoker, desiredLocationX, desiredLocationY, parent);
300 setLocation(p.x, p.y);
301 if (parent instanceof JLayeredPane) {
302 ((JLayeredPane)parent).add(this, JLayeredPane.POPUP_LAYER, 0);
303 }
304 }
305
306 @SuppressWarnings("deprecation")
307 public void hide() {
308 final Container parent = getParent();
309 final Rectangle r = this.getBounds();
310 if (parent == null) return;
311 parent.remove(this);
312 parent.repaint(r.x, r.y, r.width, r.height);
313 }
314 }
315 }
|