@Override protected void paintComponent(final Graphics g) { super.paintComponent(g); if (myToolbar != null && myToolbar.getParent() == this && myContent != null && myContent.getParent() == this) { g.setColor(UIUtil.getBorderSeparatorColor()); if (myVertical) { final int y = (int) myToolbar.getBounds().getMaxY(); g.drawLine(0, y, getWidth(), y); } else { int x = (int) myToolbar.getBounds().getMaxX(); g.drawLine(x, 0, x, getHeight()); } } }
/** Find the top focusable Window, Applet, or InternalFrame */ private static Container getTopAncestor(JComponent c) { for (Container p = c.getParent(); p != null; p = p.getParent()) { if (p instanceof Window && ((Window) p).isFocusableWindow() || p instanceof Applet || p instanceof JInternalFrame) { return p; } } return null; }