Java by API/javax.swing.border/CompoundBorder
Версия от 17:43, 31 мая 2010; (обсуждение)
new CompoundBorder(Border outsideBorder, Border insideBorder)
import java.awt.Color;
import java.awt.Container;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.Border;
import javax.swing.border.rupoundBorder;
public class MainClass {
public static void main(final String args[]) {
JFrame frame = new JFrame("Justified Titled Borders");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Border greenBorder = BorderFactory.createLineBorder(Color.GREEN, 2);
Border blueBorder = BorderFactory.createLineBorder(Color.BLUE, 2);
Border magentaBorder = BorderFactory.createLineBorder(Color.MAGENTA, 2);
Border twoColorBorder = new CompoundBorder(magentaBorder, blueBorder);
Border threeColorBorder = new CompoundBorder(twoColorBorder, greenBorder);
JButton rainbowButton = new JButton("Rainbow");
rainbowButton.setBorder(threeColorBorder);
Container contentPane = frame.getContentPane();
contentPane.add(rainbowButton);
frame.setSize(300, 200);
frame.setVisible(true);
}
}