Raised and Lowered SoftBevelBorder : SoftBevelBorder « Swing « Java Tutorial






Raised and Lowered SoftBevelBorder
import java.awt.Container;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.Border;
import javax.swing.border.SoftBevelBorder;

public class ASoftBevelBorder {
  public static void main(String args[]) {
    JFrame frame = new JFrame("Soft Bevel Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Border raisedBorder = new SoftBevelBorder(SoftBevelBorder.RAISED);
    Border loweredBorder = new SoftBevelBorder(SoftBevelBorder.LOWERED);
    JButton raisedButton = new JButton("Raised");
    raisedButton.setBorder(raisedBorder);
    
    JButton loweredButton = new JButton("Lowered");
    loweredButton.setBorder(loweredBorder);
    
    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new GridLayout(1, 2));
    contentPane.add(raisedButton);
    contentPane.add(loweredButton);
    frame.setSize(300, 100);
    frame.setVisible(true);
  }
}








14.103.SoftBevelBorder
14.103.1.SoftBevelBorder has three constructors
14.103.2.Setting Border color for SoftBevelBorderSetting Border color for SoftBevelBorder
14.103.3.Raised and Lowered SoftBevelBorderRaised and Lowered SoftBevelBorder