public static JSeparator createToolBarSeparator() { JSeparator toolBarSeparator = new JSeparator(JSeparator.VERTICAL); Dimension dim = new Dimension(4, 22); toolBarSeparator.setPreferredSize(dim); toolBarSeparator.setSize(dim); toolBarSeparator.setMinimumSize(dim); toolBarSeparator.setMaximumSize(dim); return toolBarSeparator; }
public void resetDetailPane() { detailPane.removeAll(); Dimension d = new Dimension(0, 3); detailPane.setOpaque(false); detPaneHolder.setOpaque(false); if (selectedContact != null && selectedContact.getProperties() != null) { String[][] properties = selectedContact.getProperties(); for (String[] property : properties) { javax.swing.JSeparator space = new JSeparator(SwingConstants.HORIZONTAL); space.setSize(d); detailPane.add(space); DetInnerPaneBlocks dipb = new DetInnerPaneBlocks(property[0], property[1]); detailPane.add(dipb); } detailPane.add(Box.createGlue()); detailPane.setSize(0, (DetInnerPaneBlocks.height + d.height) * properties.length); } else { detailPane.setSize(0, 0); } resetDetPaneHolderSize(); }
@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { int labelX = x + outsideInsets.left; int labelY = y + outsideInsets.top; TitledSeparator titledSeparator = getTitledSeparator(c); JLabel label = titledSeparator.getLabel(); Dimension labelSize = label.getPreferredSize(); label.setSize(labelSize); g.translate(labelX, labelY); label.paint(g); int separatorX = labelX + labelSize.width + TitledSeparator.SEPARATOR_LEFT_INSET; int separatorY = labelY + (UIUtil.isUnderAquaLookAndFeel() ? 2 : labelSize.height / 2 - 1); int separatorW = Math.max(0, width - separatorX - TitledSeparator.SEPARATOR_RIGHT_INSET); int separatorH = 2; JSeparator separator = titledSeparator.getSeparator(); separator.setSize(separatorW, separatorH); g.translate(separatorX - labelX, separatorY - labelY); separator.paint(g); g.translate(-separatorX, -separatorY); }