• 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);

  • 相关阅读:
    如何量化用户体验UE(How To Quantify The User Experience)[网摘]
    完美简单的loading外部文件.
    FLV播放器 源码二例
    让你的网站上实时更新各大网站的新闻
    我的第一次涂鸦
    Alan Cooper 的交互设计观 [网摘]
    把视频文件自动的在服务器端转换成FLV文件的FFMPEG的编译方法[网摘]
    ASP.NET 页面生命周期
    ASP.NET MVC Area操作
    浅谈DataAnnotations
  • 原文地址:https://www.cnblogs.com/cuizhf/p/5893636.html
Copyright © 2020-2023  润新知