Example usage for javax.swing BorderFactory createLoweredBevelBorder

List of usage examples for javax.swing BorderFactory createLoweredBevelBorder

Introduction

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

Prototype

public static Border createLoweredBevelBorder() 

Source Link

Document

Creates a border with a lowered beveled edge, using brighter shades of the component's current background color for highlighting, and darker shading for shadows.

Usage

From source file:Main.java

public static void main(String[] argv) {
    BevelBorder loweredBevelBorder = (BevelBorder) BorderFactory.createLoweredBevelBorder();
    JLabel component = new JLabel("label");
    component.setBorder(loweredBevelBorder);

}

From source file:ABevelBorderLoweredBevelBorder.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Bevel Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Border loweredBorder = BorderFactory.createLoweredBevelBorder();

    JButton button = new JButton("Raised");
    button.setBorder(loweredBorder);// ww w . java2 s. c  om
    frame.add(button);

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

From source file:Main.java

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

    Border loweredBorder = BorderFactory.createLoweredBevelBorder();
    JButton loweredButton = new JButton("Lowered");
    loweredButton.setBorder(loweredBorder);

    Container contentPane = frame.getContentPane();
    contentPane.add(loweredButton);//from  w  w w. j  av a 2  s .c  o  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);/*ww  w . j a  va 2s.co  m*/
    contentPane.add(loweredButton);
    contentPane.add(myRaisedButton);
    contentPane.add(myLoweredButton);
    frame.setSize(300, 100);
    frame.setVisible(true);
}

From source file:EditabilityExample.java

public static void main(String[] args) {
    try {//  www.j  av a 2s  . c  o  m
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception evt) {
    }

    JFrame f = new JFrame("Editability Example");
    f.getContentPane().setLayout(new BoxLayout(f.getContentPane(), BoxLayout.Y_AXIS));
    f.getContentPane().add(firstField);

    JTextField tf = new JTextField("A read-only text field", 20);
    tf.setEditable(false);
    f.getContentPane().add(tf);

    JTextArea ta = new JTextArea("An editable\ntext area", 2, 20);
    ta.setBorder(BorderFactory.createLoweredBevelBorder());
    f.getContentPane().add(ta);

    ta = new JTextArea("A read-only\ntext area", 2, 20);
    ta.setBorder(BorderFactory.createLoweredBevelBorder());
    ta.setEditable(false);
    f.getContentPane().add(ta);

    f.pack();
    f.show();

    if (args.length == 1 && args[0].equals("disable")) {
        // Toggle the enabled state of the first
        // text field every 10 seconds
        Timer t = new Timer(10000, new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                firstField.setEnabled(!firstField.isEnabled());
                firstField.setText(firstFieldText + (firstField.isEnabled() ? "" : " (disabled)"));
            }
        });
        t.start();
    }
}

From source file:Borders.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Borders");

    int center = SwingConstants.CENTER;
    JLabel labelOne = new JLabel("raised BevelBorder", center);
    labelOne.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    JLabel labelTwo = new JLabel("EtchedBorder", center);
    labelTwo.setBorder(BorderFactory.createEtchedBorder());
    JLabel labelThree = new JLabel("MatteBorder", center);
    labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink));
    JLabel labelFour = new JLabel("TitledBorder", center);
    Border etch = BorderFactory.createEtchedBorder();
    labelFour.setBorder(BorderFactory.createTitledBorder(etch, "Title"));
    JLabel labelFive = new JLabel("TitledBorder", center);
    Border low = BorderFactory.createLoweredBevelBorder();
    labelFive//  ww w.  j av a  2  s  .c  o  m
            .setBorder(BorderFactory.createTitledBorder(low, "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM));
    JLabel labelSix = new JLabel("CompoundBorder", center);
    Border one = BorderFactory.createEtchedBorder();
    Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue);
    labelSix.setBorder(BorderFactory.createCompoundBorder(one, two));

    frame.setLayout(new GridLayout(3, 2));
    frame.add(labelOne);
    frame.add(labelTwo);
    frame.add(labelThree);
    frame.add(labelFour);
    frame.add(labelFive);
    frame.add(labelSix);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}

From source file:BorderTest.java

public BorderTest() {
    JPanel p = new JPanel();
    Border[] border = new Border[] { BorderFactory.createEtchedBorder(),
            BorderFactory.createTitledBorder("Border types"), BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createRaisedBevelBorder(), BorderFactory.createEtchedBorder(),
            BorderFactory.createLineBorder(Color.blue),
            BorderFactory.createMatteBorder(10, 10, 10, 10, Color.blue), BorderFactory.createEmptyBorder()

    };//w w  w .  j  a v  a 2s.co m
    p.setLayout(new GridLayout(border.length, 0, 3, 3));

    for (int i = 0; i < border.length; i++) {
        JPanel borderPanel = new JPanel();
        borderPanel.setBorder(border[i]);
        p.add(borderPanel);
    }
    getContentPane().add(p, "Center");
    setTitle("BorderTest");
    setSize(600, 400);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
}

From source file:Main.java

public static Border getNativeLoweredBorder() {
    Border border = UIManager.getBorder("InsetBorder.aquaVariant");
    if (border == null)
        border = BorderFactory.createLoweredBevelBorder();
    return border;
}

From source file:Main.java

public Main() {
    JPanel simplePanel = new JPanel(new GridLayout(7, 1, 5, 5));

    simplePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(),
            BorderFactory.createLoweredBevelBorder()));
    simplePanel.add(new JLabel("Examples"), JLabel.CENTER);

    add(simplePanel);//ww w .j  a  v  a2 s.  com
}

From source file:Main.java

public Main() {
    JPanel simplePanel = new JPanel(new GridLayout(7, 1, 5, 5));

    JLabel bevelLowBorderLabel = new JLabel("Lowered Bevel Border", JLabel.CENTER);
    bevelLowBorderLabel.setBorder(BorderFactory.createLoweredBevelBorder());
    simplePanel.add(bevelLowBorderLabel);

    add(simplePanel);/*from  w  ww.j a  v  a2 s.  c om*/
}