?? workflow_cellrender.java
字號:
package treedoc;
// 對樹型列表進行修飾的類
// 對樹型節點的ICON進行修飾的類
/**
* 名稱 : WORKFLOW_CELLRENDER
* 描述 : WWW.FANGFA.NET 工作流管理系統--樹型節點的圖標修飾類
* 版權信息 : Copyright (c) 2004 COMSCI
* @作者 : COMSCI Sichuan Fangfa Digital
* @版本 : 0.9 builder 2004091910
* @日期 : 2004/09/19
*/
import java.awt.*;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.border.*;
public class workflow_CellRender
extends DefaultTreeCellRenderer {
ImageIcon htmlIcon;
ImageIcon imageIcon, imageIcon1, imageIcon2, imageIcon3;
private Border lineBorder = BorderFactory.createLineBorder(Color.blue, 1);
private Border emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2);
public static final Color colorBackground1 = new Color(235, 245, 255); // background1
public static final Color colorBackground2 = new Color(206, 219, 247); // background2
public static final Color colorBackground3 = new Color(181, 199, 247); // background3
public static final Color colorBackground4 = new Color(51, 102, 204); // background4
public workflow_CellRender() {
imageIcon = new ImageIcon("resources/icon1.gif");
imageIcon1 = new ImageIcon("resources/icon3.gif");
imageIcon2 = new ImageIcon("resources/open.gif");
imageIcon3 = new ImageIcon("resources/about.gif");
}
//把樹型目錄列表上面的節點圖標根據子樹的類型重新設置
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean isSelected,
boolean expanded, boolean leaf,
int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, isSelected, expanded,
leaf, row, hasFocus);
DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) value;
this.setIcon(imageIcon);
this.setOpaque(true);
if (currentNode instanceof TreeNode) {
if (currentNode.getUserObject().toString().equals("工作流管理")) {
setIcon(imageIcon1);
}
if (currentNode.getUserObject().toString().equals("未提交工作流")) {
setIcon(imageIcon2);
}
if (currentNode.isLeaf() &&
!currentNode.getUserObject().toString().equals("正在運行的流程") &&
!currentNode.getUserObject().toString().equals("運行完畢的流程")) {
setIcon(imageIcon3);
}
}
if (isSelected) {
setForeground(tree.getForeground());
setBackground(colorBackground2);
}
else {
setForeground(tree.getForeground());
setBackground(tree.getBackground());
}
if (hasFocus) {
setBorder(lineBorder);
}
else {
setBorder(emptyBorder);
}
return this;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -