⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toocomtreecellrenderer.java

📁 toocom源代码,主要应用在本体匹配方面!
💻 JAVA
字号:
package toocom.ui;

import javax.swing.*;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.*;

/**
 * This class represents the tree cell renderer used to display the cells of the ontology summary.
 *
 * @author Fr閐閞ic F黵st
 */
public class TooCoMTreeCellRenderer extends DefaultTreeCellRenderer{
	
	private ImageIcon conceptIcon;
	private ImageIcon relationIcon;
	private ImageIcon instanceIcon;
	private ImageIcon axiomIcon;

    public TooCoMTreeCellRenderer(){
    	this.conceptIcon = new InterfaceIcon(Constants.CONCEPT_SUMMARY_ICON);
    	this.relationIcon = new InterfaceIcon(Constants.RELATION_SUMMARY_ICON);
    	this.instanceIcon = new InterfaceIcon(Constants.INSTANCE_SUMMARY_ICON);
    	this.axiomIcon = new InterfaceIcon(Constants.AXIOM_SUMMARY_ICON);
    }

    public Component getTreeCellRendererComponent(JTree tree,Object value,boolean sel,boolean expanded,boolean leaf,int row,boolean hasFocus){
    	super.getTreeCellRendererComponent(tree,value,sel,expanded,leaf,row,hasFocus);
        if(value.toString().indexOf("C-") == 0){
        	this.setIcon(conceptIcon);
        	this.setText(value.toString().substring(2));
		}
		if(value.toString().indexOf("R-") == 0){
        	this.setIcon(relationIcon);
        	this.setText(value.toString().substring(2));
		}
		if(value.toString().indexOf("I-") == 0){
        	this.setIcon(instanceIcon);
        	this.setText(value.toString().substring(2));
		}
		if(value.toString().indexOf("A-") == 0){
        	this.setIcon(axiomIcon);
        	this.setText(value.toString().substring(2));
		}
        return this;
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -