當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。