日期:2014-05-20 浏览次数:20817 次
public class TestIco extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SubstanceImageWatermark watermark = new SubstanceImageWatermark(
TestIco.class.getResourceAsStream("img/03.jpg"));
// watermark.setKind(ImageWatermarkKind.SCREEN_CENTER_SCALE);
watermark.setOpacity(0.5f);// 设置水印透明度
SubstanceSkin skin = new OfficeBlue2007Skin()
.withWatermark(watermark); // 初始化有水印的皮肤
UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel());
SubstanceLookAndFeel.setSkin(skin); // 设置皮肤
TestIco frame = new TestIco();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public TestIco() {
Image icon2 = this.getToolkit().getImage("img/03.jpg");
this.setIconImage(icon2);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JButton btnNewButton = new JButton("New button");
contentPane.add(btnNewButton, BorderLayout.WEST);
}
}