Package de.netsysit.view

Source Code of de.netsysit.view.PersonalTreeCellRenderer

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package de.netsysit.view;

import de.netsysit.model.PolicyModel;
import de.netsysit.model.PersonalTreeNode;
import de.netsysit.policymanager.PolicyUtilities;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;

/**
*
* @author Ducksoul
*/
public class PersonalTreeCellRenderer extends DefaultTreeCellRenderer {

    public PersonalTreeCellRenderer() {
    }

    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
            boolean expanded, boolean leaf, int row, boolean hasFocus) {
       
        super.getTreeCellRendererComponent(
                        tree,
                        value,
                        selected,
                        expanded,
                        leaf,
                        row,
                        hasFocus);
       
        PersonalTreeNode node = (PersonalTreeNode) value;
        setIcon(null);
       
        setSize(new Dimension(200, 23));
        setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    
       
        if(node.isactive()) {
            setFont(getFont().deriveFont(Font.BOLD));
        } else setFont(getFont().deriveFont(Font.PLAIN));
        return this;
    }
}
TOP

Related Classes of de.netsysit.view.PersonalTreeCellRenderer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.