Example usage for javax.swing BorderFactory createCompoundBorder

List of usage examples for javax.swing BorderFactory createCompoundBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createCompoundBorder.

Prototype

public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder) 

Source Link

Document

Creates a compound border specifying the border objects to use for the outside and inside edges.

Usage

From source file:org.rdv.ui.TimeSlider.java

/**
 * Creates the tooltip for the component. This changes the default tooltip by
 * setting a different border.//w w  w. ja  va  2s.co m
 * 
 * @return  the tooltip created
 */
public JToolTip createToolTip() {
    JToolTip toolTip = super.createToolTip();
    toolTip.setBackground(Color.decode("#FFFFFC"));
    toolTip.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    return toolTip;
}

From source file:org.scify.talkandplay.gui.users.UserFormPanel.java

private void disableTextField(JTextField textField) {
    textField.setEnabled(false);//from  ww w .jav  a2s.  co  m
    textField.setForeground(Color.decode(UIConstants.disabledColor));
    textField.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.decode(UIConstants.disabledColor)));
    textField.setBorder(BorderFactory.createCompoundBorder(textField.getBorder(),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
}

From source file:org.scify.talkandplay.gui.users.UserFormPanel.java

private void enableTextField(JTextField textField) {
    textField.setEnabled(true);//ww  w.java  2 s. c  o  m
    textField.setForeground(Color.decode(UIConstants.green));
    textField.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.decode(UIConstants.green)));
    textField.setBorder(BorderFactory.createCompoundBorder(textField.getBorder(),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
}

From source file:org.springframework.richclient.application.statusbar.support.DefaultStatusBar.java

/**
 * Create the <code>JLabel</code> used to render the messages.
 * <p>/*from  ww  w  .  j av a2s .c o  m*/
 * Can safely be overridden to customize the label
 *
 * @return the <code>JLabel</code>
 */
protected JLabel createMessageLabel() {
    JLabel messageLabel = new JLabel(" ");
    messageLabel.setName("message");
    Border bevelBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED,
            UIManager.getColor("controlHighlight"), UIManager.getColor("controlShadow"));
    Border emptyBorder = BorderFactory.createEmptyBorder(1, 3, 1, 3);
    messageLabel.setBorder(BorderFactory.createCompoundBorder(bevelBorder, emptyBorder));

    return messageLabel;
}

From source file:org.springframework.richclient.factory.DefaultComponentFactory.java

public JComponent createTitledBorderFor(String labelKey, JComponent component) {
    component.setBorder(//from   ww  w.  j  av  a  2  s .  c o m
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(getRequiredMessage(labelKey)),
                    GuiStandardUtils.createEvenlySpacedBorder(UIConstants.ONE_SPACE)));
    return component;
}

From source file:org.ut.biolab.medsavant.client.view.Menu.java

public Menu(JPanel panel) {

    resetMap();//  w ww  . j  a v a 2s  .c  o  m

    setLayout(new BorderLayout());

    primaryMenuButtons = new ButtonGroup();

    primaryMenu = ViewUtil.getPrimaryBannerPanel();

    secondaryMenu = new JPanel();
    secondaryMenu.setBackground(ViewUtil.getSecondaryMenuColor());

    tertiaryMenu = new JPanel();
    tertiaryMenu.setBorder(ViewUtil.getBottomLineBorder());
    tertiaryMenu.setBackground(Color.white);
    // tertiaryMenu.setBorder(ViewUtil.getMediumBorder());
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenu);
    //tertiaryMenu.setMinimumSize(new Dimension(9999, 30));
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenu);

    int padding = 5;

    primaryMenu.setLayout(new BoxLayout(primaryMenu, BoxLayout.X_AXIS));
    primaryMenu.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(150, 150, 150)),
            BorderFactory.createEmptyBorder(padding, padding, padding, padding)));

    primaryMenuSectionButtonContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(primaryMenuSectionButtonContainer);

    NotificationsPanel n = NotificationsPanel.getNotifyPanel(NotificationsPanel.JOBS_PANEL_NAME);

    JPanel appStorePanel = ViewUtil.getClearPanel();
    JButton appStoreButton = ViewUtil
            .getIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.MENU_STORE));
    ViewUtil.applyHorizontalBoxLayout(appStorePanel);
    appStorePanel.add(ViewUtil.subTextComponent(appStoreButton, "App Store"));

    appStoreButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            MedSavantFrame.getInstance().showAppStore();
        }

    });

    int componentpadding = 10;
    primaryMenu.add(Box.createHorizontalStrut(componentpadding));
    primaryMenu.add(primaryMenuSectionButtonContainer);
    primaryMenu.add(Box.createHorizontalGlue());

    FlowLayout fl = new FlowLayout(FlowLayout.RIGHT, componentpadding, 1);
    JPanel rightSidePanel = ViewUtil.getClearPanel();
    rightSidePanel.setLayout(fl);
    rightSidePanel.add(updatesPanel);
    rightSidePanel.add(n);
    rightSidePanel.add(appStorePanel);
    rightSidePanel.add(getLoginMenuItem());
    primaryMenu.add(rightSidePanel);
    /*
    primaryMenu.add(updatesPanel);
    primaryMenu.add(ViewUtil.getMediumSeparator());
            
    primaryMenu.add(n);
    primaryMenu.add(ViewUtil.getMediumSeparator());
            
    primaryMenu.add(appStorePanel);
    primaryMenu.add(ViewUtil.getMediumSeparator());
    primaryMenu.add(getLoginMenuItem());
    */
    add(primaryMenu, BorderLayout.NORTH);

    secondaryMenu.setLayout(new BoxLayout(secondaryMenu, BoxLayout.Y_AXIS));
    //secondaryMenu.setBorder(ViewUtil.getRightLineBorder());

    secondaryMenu.setPreferredSize(new Dimension(150, 100));

    contentContainer = panel;

    ReferenceController.getInstance().addListener(new Listener<ReferenceEvent>() {
        @Override
        public void handleEvent(ReferenceEvent event) {
            if (event.getType() == ReferenceEvent.Type.CHANGED) {
                updateSections();
            }
        }
    });

    ProjectController.getInstance().addListener(new Listener<ProjectEvent>() {
        @Override
        public void handleEvent(ProjectEvent evt) {
            if (!GeneticsSection.isInitialized && evt.getType() == ProjectEvent.Type.CHANGED) {
                //once this section is initialized, referencecombobox fires
                //referencechanged event on every project change
                updateSections();
            }
        }
    });

    LoginController.getInstance().addListener(new Listener<LoginEvent>() {
        @Override
        public void handleEvent(LoginEvent evt) {
            if (evt.getType() == LoginEvent.Type.LOGGED_OUT) {
                contentContainer.removeAll();
                ViewController.getInstance().changeSubSectionTo(null);
                currentView = null;
                resetMap();
            }
        }
    });

    tertiaryMenuPanelVisibilityContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenuPanelVisibilityContainer);

    tertiaryMenuPanelAccessoryContainer = ViewUtil.getClearPanel();
    ViewUtil.applyHorizontalBoxLayout(tertiaryMenuPanelAccessoryContainer);

    clearMenu();
}

From source file:pcgen.gui2.dialog.ExportDialog.java

private void initLayout() {
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    Box topPanel = Box.createHorizontalBox();
    topPanel.add(new JLabel("Select Character:"));
    topPanel.add(Box.createHorizontalStrut(5));
    topPanel.add(characterBox);/*from w  ww  .jav a 2 s  .c om*/
    topPanel.add(Box.createHorizontalStrut(5));
    topPanel.add(partyBox);
    topPanel.add(Box.createHorizontalGlue());
    topPanel.add(Box.createHorizontalStrut(50));
    topPanel.add(new JLabel("Export to:"));
    topPanel.add(Box.createHorizontalStrut(5));
    topPanel.add(exportBox);
    contentPane.add(topPanel, BorderLayout.NORTH);

    JScrollPane scrollPane = new JScrollPane(fileList);
    scrollPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Templates"),
            scrollPane.getBorder()));
    contentPane.add(scrollPane, BorderLayout.CENTER);

    Box bottomPanel = Box.createHorizontalBox();
    bottomPanel.add(progressBar);
    bottomPanel.add(Box.createHorizontalGlue());
    bottomPanel.add(Box.createHorizontalStrut(5));
    bottomPanel.add(exportButton);
    bottomPanel.add(Box.createHorizontalStrut(5));
    bottomPanel.add(closeButton);
    contentPane.add(bottomPanel, BorderLayout.SOUTH);

    topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    bottomPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    pack();
}

From source file:savant.plugin.ToolSettingsPanel.java

ToolSettingsPanel(Tool t) {
    tool = t;/*from  w  w w.  j  a  v  a2s.c  o  m*/
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridy = 0;
    try {
        tool.parseDescriptor();
        commandLine = new JLabel("", SwingConstants.CENTER);
        commandLine.setFont(new Font("Serif", Font.PLAIN, 14));
        commandLine.setBorder(
                BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                        BorderFactory.createEmptyBorder(5, 5, 5, 5)));
        gbc.insets = new Insets(10, 10, 10, 10);
        gbc.fill = GridBagConstraints.HORIZONTAL;
        add(commandLine, gbc);

        JButton executeButton = new JButton("Execute");
        executeButton.addActionListener(executeListener);
        gbc.insets = new Insets(5, 5, 5, 5);
        gbc.gridy = 1;
        gbc.fill = GridBagConstraints.NONE;
        add(executeButton, gbc);

        for (ToolArgument a : tool.arguments) {
            addArgumentToPanel(a, ++gbc.gridy);
        }
        gbc.gridx = 0;
        gbc.gridy++;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        add(new JPanel(), gbc);

        tool.displayCommandLine(commandLine);
    } catch (Exception x) {
        Tool.LOG.info(String.format("Unable to load %s.", tool.getDescriptor().getFile()), x);
        add(new JLabel(String.format("<html>Unable to load <i>%s</i><br>%s</html>",
                tool.getDescriptor().getFile(), x)), gbc);
    }
}

From source file:shuffle.fwk.service.roster.EditRosterService.java

private void setBorderFor(JPanel c, boolean doBorder) {
    if (c != null) {
        ConfigManager manager = getUser().getPreferencesManager();
        int borderThick = manager.getIntegerValue(KEY_ROSTER_CELL_BORDER_THICK, DEFAULT_BORDER_WIDTH);
        borderThick = getUser().scaleBorderThickness(borderThick);
        int outlineThick = manager.getIntegerValue(KEY_ROSTER_CELL_OUTLINE_THICK, DEFAULT_BORDER_OUTLINE);
        outlineThick = getUser().scaleBorderThickness(outlineThick);
        int marginThick = manager.getIntegerValue(KEY_ROSTER_CELL_MARGIN_THICK, DEFAULT_BORDER_MARGIN);
        marginThick = getUser().scaleBorderThickness(marginThick);
        Border main;//from w w w  . ja v a  2 s .c  o  m
        Border margin = new EmptyBorder(marginThick, marginThick, marginThick, marginThick);
        if (doBorder) {
            main = new LineBorder(Color.BLACK, borderThick);
        } else {
            main = new EmptyBorder(borderThick, borderThick, borderThick, borderThick);
        }
        Border greyOutline = new LineBorder(Color.gray, outlineThick);
        Border innerChunk = BorderFactory.createCompoundBorder(greyOutline, margin);
        Border outerChunk = BorderFactory.createCompoundBorder(main, margin);
        Border finalBorder = BorderFactory.createCompoundBorder(outerChunk, innerChunk);
        c.setBorder(finalBorder);
    }
}

From source file:shuffle.fwk.service.teams.EditTeamService.java

private void setBorderFor(JComponent c, boolean isSelected, boolean haveSelect) {
    if (c != null) {
        ConfigManager manager = getUser().getPreferencesManager();
        int borderThick = manager.getIntegerValue(KEY_ROSTER_CELL_BORDER_THICK, DEFAULT_BORDER_WIDTH);
        borderThick = getUser().scaleBorderThickness(borderThick);
        int outlineThick = manager.getIntegerValue(KEY_ROSTER_CELL_OUTLINE_THICK, DEFAULT_BORDER_OUTLINE);
        outlineThick = getUser().scaleBorderThickness(outlineThick);
        int marginThick = manager.getIntegerValue(KEY_ROSTER_CELL_MARGIN_THICK, DEFAULT_BORDER_MARGIN);
        marginThick = getUser().scaleBorderThickness(marginThick);
        Border margin = new EmptyBorder(marginThick, marginThick, marginThick, marginThick);
        Border greyOutline = new LineBorder(Color.gray, outlineThick);
        Border innerChunk = BorderFactory.createCompoundBorder(greyOutline, margin);
        Border toSet;/*from  w  w  w  . j a  v  a2  s. co m*/
        if (haveSelect) {
            Border main;
            if (isSelected) {
                main = new LineBorder(Color.BLACK, borderThick);
            } else {
                main = new EmptyBorder(borderThick, borderThick, borderThick, borderThick);
            }
            Border outerChunk = BorderFactory.createCompoundBorder(main, margin);
            Border finalBorder = BorderFactory.createCompoundBorder(outerChunk, innerChunk);
            toSet = finalBorder;
        } else {
            toSet = innerChunk;
        }
        c.setBorder(toSet);
    }
}