Java by API/javax.swing.border/SoftBevelBorder
Содержание
new SoftBevelBorder(int bevelType, Color highlightOuterColor, Color highlightInnerColor, Color shadowOuterColor, Color shadowInnerColor)
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;
import javax.swing.border.SoftBevelBorder;
public class Main {
public static void main(String args[]) {
JFrame frame = new JFrame("Sample Borders");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Border softBevelBorder = new SoftBevelBorder(BevelBorder.RAISED, Color.RED, Color.RED.darker(),
Color.PINK, Color.PINK.brighter());
JLabel aLabel = new JLabel("Bevel");
aLabel.setBorder(softBevelBorder);
aLabel.setHorizontalAlignment(JLabel.CENTER);
frame.add(aLabel);
frame.setSize(400, 200);
frame.setVisible(true);
}
}
new SoftBevelBorder(int style)
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 MainClass {
public static void main(String[] a) {
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);
}
}
SoftBevelBorder.LOWERED
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 MainClass {
public static void main(String[] a) {
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);
}
}
SoftBevelBorder.RAISED
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 MainClass {
public static void main(String[] a) {
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);
}
}