use of javax.swing.border.CompoundBorder in project intellij-community by JetBrains.
the class DialogWrapper method createSouthPanel.
@NotNull
private JPanel createSouthPanel(@NotNull List<JButton> leftSideButtons, @NotNull List<JButton> rightSideButtons, boolean hasHelpToMoveToLeftSide) {
JPanel panel = new JPanel(new BorderLayout()) {
@Override
public Color getBackground() {
final Color bg = UIManager.getColor("DialogWrapper.southPanelBackground");
if (getStyle() == DialogStyle.COMPACT && bg != null) {
return bg;
}
return super.getBackground();
}
};
if (myDoNotAsk != null) {
myCheckBoxDoNotShowDialog = new JCheckBox(myDoNotAsk.getDoNotShowMessage());
myCheckBoxDoNotShowDialog.setVisible(myDoNotAsk.canBeHidden());
myCheckBoxDoNotShowDialog.setSelected(!myDoNotAsk.isToBeShown());
DialogUtil.registerMnemonic(myCheckBoxDoNotShowDialog, '&');
}
JComponent doNotAskCheckbox = createDoNotAskCheckbox();
final JPanel lrButtonsPanel = new NonOpaquePanel(new GridBagLayout());
//noinspection UseDPIAwareInsets
//don't wrap to JBInsets
final Insets insets = SystemInfo.isMacOSLeopard ? UIUtil.isUnderIntelliJLaF() ? JBUI.insets(0, 8) : JBUI.emptyInsets() : new Insets(8, 0, 0, 0);
if (rightSideButtons.size() > 0 || leftSideButtons.size() > 0) {
GridBag bag = new GridBag().setDefaultInsets(insets);
if (leftSideButtons.size() > 0) {
JPanel buttonsPanel = createButtonsPanel(leftSideButtons);
if (rightSideButtons.size() > 0) {
// leave some space between button groups
buttonsPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
}
lrButtonsPanel.add(buttonsPanel, bag.next());
}
// left strut
lrButtonsPanel.add(Box.createHorizontalGlue(), bag.next().weightx(1).fillCellHorizontally());
if (rightSideButtons.size() > 0) {
JPanel buttonsPanel = createButtonsPanel(rightSideButtons);
if (shouldAddErrorNearButtons()) {
lrButtonsPanel.add(myErrorText, bag.next());
lrButtonsPanel.add(Box.createHorizontalStrut(10), bag.next());
}
lrButtonsPanel.add(buttonsPanel, bag.next());
}
if (SwingConstants.CENTER == myButtonAlignment && doNotAskCheckbox == null) {
// right strut
lrButtonsPanel.add(Box.createHorizontalGlue(), bag.next().weightx(1).fillCellHorizontally());
}
}
JComponent helpButton = null;
if (hasHelpToMoveToLeftSide) {
helpButton = createHelpButton(insets);
}
if (helpButton != null || doNotAskCheckbox != null) {
JPanel leftPanel = new JPanel(new BorderLayout());
if (helpButton != null)
leftPanel.add(helpButton, BorderLayout.WEST);
if (doNotAskCheckbox != null) {
doNotAskCheckbox.setBorder(JBUI.Borders.emptyRight(20));
leftPanel.add(doNotAskCheckbox, BorderLayout.CENTER);
}
panel.add(leftPanel, BorderLayout.WEST);
}
panel.add(lrButtonsPanel, BorderLayout.CENTER);
if (getStyle() == DialogStyle.COMPACT) {
final Color color = UIManager.getColor("DialogWrapper.southPanelDivider");
Border line = new CustomLineBorder(color != null ? color : OnePixelDivider.BACKGROUND, 1, 0, 0, 0);
panel.setBorder(new CompoundBorder(line, JBUI.Borders.empty(8, 12)));
} else {
panel.setBorder(JBUI.Borders.emptyTop(8));
}
return panel;
}
use of javax.swing.border.CompoundBorder in project adempiere by adempiere.
the class StackedBox method addBox.
/**
* Adds a new component to this <code>StackedBox</code>
*
* @param title
* @param component
*/
public void addBox(String title, Component component) {
final JXCollapsiblePane collapsible = new JXCollapsiblePane();
collapsible.getContentPane().setBackground(Color.WHITE);
collapsible.add(component);
collapsible.setBorder(new CompoundBorder(separatorBorder, collapsible.getBorder()));
Action toggleAction = collapsible.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION);
// use the collapse/expand icons from the JTree UI
toggleAction.putValue(JXCollapsiblePane.COLLAPSE_ICON, UIManager.getIcon("Tree.expandedIcon"));
toggleAction.putValue(JXCollapsiblePane.EXPAND_ICON, UIManager.getIcon("Tree.collapsedIcon"));
JXHyperlink link = new JXHyperlink(toggleAction);
link.setText(title);
link.setFont(link.getFont().deriveFont(Font.BOLD));
link.setOpaque(true);
link.setBackground(getTitleBackgroundColor());
link.setFocusPainted(false);
link.setUnclickedColor(getTitleForegroundColor());
link.setClickedColor(getTitleForegroundColor());
link.setBorder(new CompoundBorder(separatorBorder, BorderFactory.createEmptyBorder(2, 4, 2, 4)));
link.setBorderPainted(true);
add(link);
add(collapsible);
}
use of javax.swing.border.CompoundBorder in project jdk8u_jdk by JetBrains.
the class ContrastMetalTheme method addCustomEntriesToTable.
@Override
public void addCustomEntriesToTable(UIDefaults table) {
Border blackLineBorder = new BorderUIResource(new LineBorder(getBlack()));
Border whiteLineBorder = new BorderUIResource(new LineBorder(getWhite()));
Object textBorder = new BorderUIResource(new CompoundBorder(blackLineBorder, new BasicBorders.MarginBorder()));
table.put("ToolTip.border", blackLineBorder);
table.put("TitledBorder.border", blackLineBorder);
table.put("Table.focusCellHighlightBorder", whiteLineBorder);
table.put("Table.focusCellForeground", getWhite());
table.put("TextField.border", textBorder);
table.put("PasswordField.border", textBorder);
table.put("TextArea.border", textBorder);
table.put("TextPane.font", textBorder);
}
use of javax.swing.border.CompoundBorder in project JMRI by JMRI.
the class PositionablePopupUtil method setBorderSize.
public void setBorderSize(int border) {
borderSize = border;
if (borderColor != null) {
outlineBorder = new LineBorder(borderColor, borderSize);
_parent.setBorder(new CompoundBorder(outlineBorder, borderMargin));
//setHorizontalAlignment(CENTRE);
}
_parent.updateSize();
}
use of javax.swing.border.CompoundBorder in project JMRI by JMRI.
the class PositionablePopupUtil method setMargin.
public void setMargin(int m) {
margin = m;
if (_parent.isOpaque()) {
borderMargin = new LineBorder(getBackground(), m);
} else {
borderMargin = BorderFactory.createEmptyBorder(m, m, m, m);
}
if (_showBorder) {
_parent.setBorder(new CompoundBorder(outlineBorder, borderMargin));
}
_parent.updateSize();
}
Aggregations