private JPanel readSplitter( JPanel panel, Element splitterElement, Ref<EditorWindow> currentWindow) { final boolean orientation = "vertical".equals(splitterElement.getAttributeValue("split-orientation")); final float proportion = Float.valueOf(splitterElement.getAttributeValue("split-proportion")).floatValue(); final Element first = splitterElement.getChild("split-first"); final Element second = splitterElement.getChild("split-second"); Splitter splitter; if (panel == null) { panel = new JPanel(new BorderLayout()); panel.setOpaque(false); splitter = new Splitter(orientation, proportion, 0.1f, 0.9f); panel.add(splitter, BorderLayout.CENTER); splitter.setFirstComponent(readExternalPanel(first, null, currentWindow)); splitter.setSecondComponent(readExternalPanel(second, null, currentWindow)); } else if (panel.getComponent(0) instanceof Splitter) { splitter = (Splitter) panel.getComponent(0); readExternalPanel(first, (JPanel) splitter.getFirstComponent(), currentWindow); readExternalPanel(second, (JPanel) splitter.getSecondComponent(), currentWindow); } else { readExternalPanel(first, panel, currentWindow); readExternalPanel(second, panel, currentWindow); } return panel; }
public void setAdText(@NotNull final String s, int alignment) { if (myAdComponent == null) { myAdComponent = HintUtil.createAdComponent(s, BorderFactory.createEmptyBorder(1, 5, 1, 5), alignment); JPanel wrapper = new JPanel(new BorderLayout()) { @Override protected void paintComponent(Graphics g) { g.setColor(Gray._135); g.drawLine(0, 0, getWidth(), 0); super.paintComponent(g); } }; wrapper.setOpaque(false); wrapper.setBorder(new EmptyBorder(1, 0, 0, 0)); wrapper.add(myAdComponent, BorderLayout.CENTER); myContent.add(wrapper, BorderLayout.SOUTH); pack(false, true); } else { myAdComponent.setText(s); myAdComponent.setHorizontalAlignment(alignment); } }