我用的5.0版本的,不知道为什么总是显示不出来水印
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);
}
}
麻烦各位帮忙看看我遇到的问题跟楼主一样,马克求解。会不会win7系统的缘故,试了两天网上的各种版本,都未果啊!来个人帮帮忙。。。