Example usage for javax.swing BorderFactory createBevelBorder

List of usage examples for javax.swing BorderFactory createBevelBorder

Introduction

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

Prototype

public static Border createBevelBorder(int type, Color highlight, Color shadow) 

Source Link

Document

Creates a beveled border of the specified type, using the specified highlighting and shadowing.

Usage

From source file:ABevelBorderLoweredBevelBorderRAISED.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Bevel Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED);
    //    Border myLoweredBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.PINK,
    //      Color.RED);

    JButton button = new JButton("Raised");
    button.setBorder(myRaisedBorder);// w ww  .  j av a 2s .com
    frame.add(button);

    frame.setSize(300, 100);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("Justified Titled Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED);
    JButton myRaisedButton = new JButton("My Raised");
    myRaisedButton.setBorder(myRaisedBorder);

    Container contentPane = frame.getContentPane();
    contentPane.add(myRaisedButton);/*w ww .  java2s.  co  m*/
    frame.setSize(300, 200);
    frame.setVisible(true);

}

From source file:ABevelBorder.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Bevel Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Border raisedBorder = BorderFactory.createRaisedBevelBorder();
    Border loweredBorder = BorderFactory.createLoweredBevelBorder();
    Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.pink, Color.red);
    Border myLoweredBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.pink, Color.red);
    JButton raisedButton = new JButton("Raised");
    raisedButton.setBorder(raisedBorder);
    JButton loweredButton = new JButton("Lowered");
    loweredButton.setBorder(loweredBorder);
    JButton myRaisedButton = new JButton("My Raised");
    myRaisedButton.setBorder(myRaisedBorder);
    JButton myLoweredButton = new JButton("My Lowered");
    myLoweredButton.setBorder(myLoweredBorder);
    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new GridLayout(2, 2, 5, 5));
    contentPane.add(raisedButton);/*from w  w w  .  java  2s.  c o  m*/
    contentPane.add(loweredButton);
    contentPane.add(myRaisedButton);
    contentPane.add(myLoweredButton);
    frame.setSize(300, 100);
    frame.setVisible(true);
}

From source file:org.pentaho.ui.xul.swing.tags.SwingDialog.java

private void createDialog() {

    if (getParent() instanceof XulDialog) {
        Object parentObj = ((SwingDialog) getParent()).getDialog();
        dialog = new JDialog((Dialog) parentObj);
        centerComp = (Component) parentObj;
    } else if (getParent() instanceof XulWindow) {

        Object parentObj = getParent().getManagedObject();
        dialog = new JDialog((Frame) parentObj);
        centerComp = (Component) parentObj;
    } else {//from w ww  .j  ava  2  s  . c o m

        Document doc = getDocument();
        Element rootElement = doc.getRootElement();
        XulWindow window = null;
        if (rootElement != this) { // dialog is root, no JFrame Parent
            window = (XulWindow) rootElement;
        }

        if (window != null) {
            frame = (JFrame) window.getManagedObject();
            dialog = new JDialog(frame);
            centerComp = frame;
        } else {

            final Object context = domContainer.getOuterContext();
            if (context instanceof JFrame) {
                frame = (JFrame) context;
                centerComp = (Component) context;
                dialog = new JDialog(frame);
            } else if (context instanceof JDialog) {
                dialog = new JDialog((JDialog) context);
                centerComp = (Component) context;
            } else if (context instanceof JComponent) {
                dialog = new JDialog();
                centerComp = (Component) context;
            } else {
                dialog = new JDialog();
            }
        }
    }

    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setResizable(getResizable());
    dialog.setLayout(new BorderLayout());

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setOpaque(true);
    int pad = (this.getPadding() > -1) ? getPadding() : 3;
    mainPanel.setBorder(BorderFactory.createEmptyBorder(pad, pad, pad, pad));

    dialog.setTitle(title);
    dialog.setModal(isModal());
    dialog.add(mainPanel, BorderLayout.CENTER);
    mainPanel.add(container, BorderLayout.CENTER);
    container.setOpaque(false);

    if (this.header != null) {

        JPanel headerPanel = new JPanel(new BorderLayout());
        headerPanel.setBackground(Color.decode("#5F86C0"));
        headerPanel.setOpaque(true);
        JPanel headerPanelInner = new JPanel(new BorderLayout());
        headerPanelInner.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
        headerPanelInner.setOpaque(false);

        headerPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.decode("#8FB1E5"),
                Color.decode("#446CA9")));

        JLabel title = new JLabel(this.header.getTitle());

        title.setForeground(Color.white);
        headerPanelInner.add(title, BorderLayout.WEST);

        JLabel desc = new JLabel(this.header.getDescription());
        desc.setForeground(Color.white);
        headerPanelInner.add(desc, BorderLayout.EAST);

        headerPanel.add(headerPanelInner, BorderLayout.CENTER);

        mainPanel.add(headerPanel, BorderLayout.NORTH);
    }

    populateButtonPanel();
    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
    dialog.setSize(new Dimension(getWidth(), getHeight()));
    dialog.setPreferredSize(new Dimension(getWidth(), getHeight()));
    dialog.setMinimumSize(new Dimension(getWidth(), getHeight()));

    if (this.getBgcolor() != null) {
        mainPanel.setBackground(Color.decode(this.getBgcolor()));
    }

}

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

/**
 * Create the <code>JLabel</code> used to render the messages.
 * <p>//w  ww .j a  v a  2s . 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;
}