| 1757 | /// |
| 1758 | /// the layered pane instance |
| 1759 | public Container getFormLayeredPane(Class c, boolean top) { |
| 1760 | if (formLayeredPane == null) { |
| 1761 | formLayeredPane = new Container(new LayeredLayout()) { |
| 1762 | @Override |
| 1763 | protected void paintBackground(Graphics g) { |
| 1764 | if (getComponentCount() > 0) { |
| 1765 | if (super.isVisible()) { |
| 1766 | super.setVisible(false); |
| 1767 | Form.this.paint(g); |
| 1768 | super.setVisible(true); |
| 1769 | } |
| 1770 | } |
| 1771 | } |
| 1772 | |
| 1773 | @Override |
| 1774 | public void paintBackgrounds(Graphics g) { |
| 1775 | } |
| 1776 | }; |
| 1777 | formLayeredPane.setName("FormLayeredPane"); |
| 1778 | addComponentToForm(BorderLayout.OVERLAY, formLayeredPane); |
| 1779 | formLayeredPane.setWidth(getWidth()); |
| 1780 | formLayeredPane.setHeight(getHeight()); |
| 1781 | formLayeredPane.setShouldLayout(false); |
| 1782 | } |
| 1783 | Container flp = formLayeredPane; |
| 1784 | if (c == null) { |
| 1785 | // NOTE: We need to use getChildrenAsList(true) rather than simply iterating |
| 1786 | // over layeredPaneImpl because the latter won't find components while an animation |
| 1787 | // is in progress.... We could end up adding a whole bunch of layered panes |
| 1788 | // by accident |
| 1789 | for (Component cmp : flp.getChildrenAsList(true)) { |
| 1790 | if (cmp.getClientProperty("cn1$_cls") == null) { |
| 1791 | return (Container) cmp; |
| 1792 | } |
| 1793 | } |
| 1794 | |
| 1795 | Container cnt = new Container(); |
| 1796 | cnt.setWidth(getWidth()); |
| 1797 | cnt.setHeight(getHeight()); |
| 1798 | cnt.setShouldLayout(false); |
| 1799 | cnt.setName("FormLayer: null"); |
| 1800 | flp.add(cnt); |
| 1801 | return cnt; |
| 1802 | } |
| 1803 | String n = c.getName(); |
| 1804 | // NOTE: We need to use getChildrenAsList(true) rather than simply iterating |
| 1805 | // over layeredPaneImpl because the latter won't find components while an animation |
| 1806 | // is in progress.... We could end up adding a whole bunch of layered panes |
| 1807 | // by accident |
| 1808 | for (Component cmp : flp.getChildrenAsList(true)) { |
| 1809 | if (n.equals(cmp.getClientProperty("cn1$_cls"))) { |
| 1810 | return (Container) cmp; |
| 1811 | } |
| 1812 | } |
| 1813 | Container cnt = new Container(); |
| 1814 | cnt.setWidth(getWidth()); |
| 1815 | cnt.setHeight(getHeight()); |
| 1816 | cnt.setShouldLayout(false); |