Create a Lowered BevelBorder in Java
Description
The following code shows how to create a Lowered BevelBorder.
Example
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.Border;
/* w w w .j a v a 2 s. c o m*/
public class Main {
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);
frame.add(button);
frame.setSize(300, 100);
frame.setVisible(true);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Swing »
Java Tutorial »
Swing »