zoukankan      html  css  js  c++  java
  • 替换AsWing的JTree组件中的图标

    代码
        public class CollapsedFolderIcon implements Icon, UIResource{
            
    private var iconImg:DisplayObject;
            
    public function CollapsedFolderIcon(){
                iconImg 
    = SystemImages.getJiahao2();
            }
            
            
    public function getIconWidth(c:Component) : int {
                
    return iconImg.width;
            }
            
            
    public function getIconHeight(c:Component) : int {
                
    return iconImg.height;
            }
            
            
    public function updateIcon(com:Component, g:Graphics2D, x:int, y:int):void {
                
                
            }
            
            
    public function getDisplay(c:Component):DisplayObject{
                
    return iconImg;
            }
            
        }
    代码
        public class ExpandedFolderIcon implements Icon, UIResource{
            
    private var iconImg:DisplayObject;
            
    public function ExpandedFolderIcon(){
                iconImg 
    = SystemImages.getJianhao2();
            }
            
            
    public function getIconWidth(c:Component) : int {
                
    return iconImg.width;
            }
            
            
    public function getIconHeight(c:Component) : int {
                
    return iconImg.height;
            }
            
            
    public function updateIcon(com:Component, g:Graphics2D, x:int, y:int):void {
                
                
            }
            
            
    public function getDisplay(c:Component):DisplayObject{
                
    return iconImg;
            }
            
        }
                var ui:ComponentUI = tree.getUI();
                ui.putDefault(
    "Tree.folderExpandedIcon",ExpandedFolderIcon);
           //ui.putDefault("Tree.folderExpandedIcon",new AssetIcon(xxx));错误

                ui.putDefault(
    "Tree.folderCollapsedIcon",CollapsedFolderIcon);
  • 相关阅读:
    使用 OpenSmtp.dll 发送邮件 (记录) 西安
    国庆假期加班头疼 西安
    asp.net 下 使用 showModalDialog 模式窗口 (记录) 西安
    严重声讨 西安
    牙痛,医生说我这是根尖周炎,有点郁闷
    Google域名被国内某商抢注 竟只得重金去赎
    Windows自带的一个罕为人知的无敌命令
    在CSS中使用继承
    删除字符串最后一个字符的几种方法
    如何在一个RowFilter过的dataview中增加一行
  • 原文地址:https://www.cnblogs.com/sagacite/p/1872766.html
Copyright © 2011-2022 走看看