zoukankan      html  css  js  c++  java
  • Substance 6 设置 watermark(水印)

    http://www.qumake.com/articles/2011/04/18/1303094833690.html

    ————————————————————————————————————————————————————————————————————————————

    在Substance6之前, skin 有一个withWatermark 方法来设置皮肤水印。

        try{
            SubstanceImageWatermark watermark = new SubstanceImageWatermark(this.getClass().getResourceAsStream("watermark.jpg"));
            SubstanceImageWatermark.setKind(ImageWatermarkKind.SCREEN_CENTER_SCALE);
            SubstanceSkin skin = new BusinessBlackSteelSkin().withWatermark(watermark); //初始化有水印地皮肤

            UIManager.setLookAndFeel(new SubstanceSaharaLookAndFeel());
            SubstanceLookAndFeel.setSkin(skin); //配置皮肤
        }catch(UnsupportedLookAndFeelException ex) {
            ex.printStackTrace();
        }

    在Substance 6中这个方法没有了,看到很多人都在问Substance 6中怎么设置水印,所以写一下。其实, Substance 中官方带的例子很详细,里面都有哦。

    1。首先要继承substance 中的skin, 加入自己的watermark.

    class MySkin extends org.pushingpixels.substance.api.skin.BusinessBlackSteelSkin{
        public MySkin(){
            super();
            SubstanceImageWatermark imageWatermark = new SubstanceImageWatermark(this.getClass().getResourceAsStream("/ICON-INF/watermark.jpg"));
            imageWatermark.setOpacity(0.7f);
            imageWatermark.setKind(ImageWatermarkKind.APP_ANCHOR);
            this.watermark = imageWatermark;
        }
    }

    2.然后给要水印效果的组件的设置属性。

    mainFrame.getRootPane().putClientProperty(SubstanceLookAndFeel.WATERMARK_VISIBLE, true);

    3.最后就是设置皮肤了。

    SubstanceLookAndFeel.setSkin(new MySkin);

  • 相关阅读:
    指针问题,p+i什么意思i代表什么
    怎么用C语言写一个飞机程序
    switch()语句中()中必须是常量吗
    一元二次方程运行结果中输入上系数后总显示输入不合法无论系数可以得出实根
    我想学号图论求大神请教
    c-freelib库
    十进制转十六进制问题(有代码)
    关于逐个读取同一目录下txt文本的问题
    JAVA-JDK1.7-ConCurrentHashMap-测试和验证
    JAVA-JDK1.7-ConCurrentHashMap-源码并且debug说明
  • 原文地址:https://www.cnblogs.com/cuizhf/p/5893636.html
Copyright © 2011-2022 走看看