当前位置: 首页>>代码示例>>Java>>正文


Java JTree.setBackground方法代码示例

本文整理汇总了Java中javax.swing.JTree.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JTree.setBackground方法的具体用法?Java JTree.setBackground怎么用?Java JTree.setBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTree的用法示例。


在下文中一共展示了JTree.setBackground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: editLaF

import javax.swing.JTree; //导入方法依赖的package包/类
public final void editLaF(JTree tree) {
    UIDefaults paneDefaults = new UIDefaults();
    paneDefaults.put("Tree.selectionBackground", null);
    tree.putClientProperty("Nimbus.Overrides", paneDefaults);
    tree.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
    tree.setBackground(Color.WHITE);
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:8,代码来源:TreeSelectionRenderer.java

示例2: initializeTree

import javax.swing.JTree; //导入方法依赖的package包/类
private void initializeTree() {
    tree = new JTree();
    tree.setCellRenderer(new CustomTreeRenderer());
    tree.setVisibleRowCount(8);
    tree.setBackground(background);
    tree.addTreeSelectionListener(this);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setShowsRootHandles(true);

}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:11,代码来源:JTreeComboBox.java

示例3: createDocPane

import javax.swing.JTree; //导入方法依赖的package包/类
private JTree createDocPane() {
    final DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    for (Map.Entry<?,? extends List<?>> docEntry : getDoc().getItemTree()
        .entrySet()) {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(docEntry.getKey());
        root.add(node);
        for (Object rule : docEntry.getValue()) {
            node.add(new DefaultMutableTreeNode(rule));
        }
    }
    final JTree result = new JTree(root) {
        @Override
        public String getToolTipText(MouseEvent evt) {
            if (getRowForLocation(evt.getX(), evt.getY()) == -1) {
                return null;
            }
            TreePath curPath = getPathForLocation(evt.getX(), evt.getY());
            Object userObject =
                ((DefaultMutableTreeNode) curPath.getLastPathComponent()).getUserObject();
            return getToolTip(userObject);
        }
    };
    result.setRootVisible(false);
    result.setShowsRootHandles(true);
    DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) result.getCellRenderer();
    renderer.setBackgroundNonSelectionColor(null);
    renderer.setBackgroundSelectionColor(null);
    renderer.setTextSelectionColor(null);
    renderer.setLeafIcon(null);
    renderer.setClosedIcon(null);
    renderer.setOpenIcon(null);
    result.setCellRenderer(renderer);
    ToolTipManager.sharedInstance()
        .registerComponent(result);
    result.addMouseListener(new DismissDelayer(result));
    for (int i = 0; i < root.getChildCount(); i++) {
        result
            .expandPath(new TreePath(((DefaultMutableTreeNode) root.getChildAt(i)).getPath()));
    }
    result.setBackground(null);
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:43,代码来源:ControlDisplay.java


注:本文中的javax.swing.JTree.setBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。