本文整理汇总了Java中javax.swing.JTree.putClientProperty方法的典型用法代码示例。如果您正苦于以下问题:Java JTree.putClientProperty方法的具体用法?Java JTree.putClientProperty怎么用?Java JTree.putClientProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTree
的用法示例。
在下文中一共展示了JTree.putClientProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildTree
import javax.swing.JTree; //导入方法依赖的package包/类
/**
*
*/
private void buildTree() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("user");
tree = new JTree(root);
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.setCellRenderer(new NavigationTreeCellRenderer());
tree.setShowsRootHandles(true);
DefaultTreeSelectionModel model = new DefaultTreeSelectionModel();
model.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
graphsCategory = new DefaultMutableTreeNode("graphs");
mouseAdapter = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
itemSelected(e);
}
};
tree.addMouseListener(mouseAdapter);
root.add(graphsCategory);
loadGraphs();
}
示例2: restoreExpandedNodes
import javax.swing.JTree; //导入方法依赖的package包/类
static void restoreExpandedNodes(JTree tree, UIState uiState) {
try {
tree.putClientProperty(UIUtils.PROP_EXPANSION_TRANSACTION, Boolean.TRUE);
Enumeration<TreePath> paths = uiState.getExpandedPaths();
if (paths != null) while (paths.hasMoreElements())
tree.expandPath(paths.nextElement());
} finally {
tree.putClientProperty(UIUtils.PROP_EXPANSION_TRANSACTION, null);
}
}
示例3: 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
示例4: TreeDemo
import javax.swing.JTree; //导入方法依赖的package包/类
public TreeDemo() {
super(new GridLayout(1, 0));
// Create the nodes.
DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");
createNodes(top);
// Create a tree that allows one selection at a time.
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
// Listen for when the selection changes.
tree.addTreeSelectionListener(this);
if (playWithLineStyle) {
System.out.println("line style = " + lineStyle);
tree.putClientProperty("JTree.lineStyle", lineStyle);
}
// Create the scroll pane and add the tree to it.
JScrollPane treeView = new JScrollPane(tree);
// Create the HTML viewing pane.
htmlPane = new JEditorPane();
htmlPane.setEditable(false);
initHelp();
JScrollPane htmlView = new JScrollPane(htmlPane);
// Add the scroll panes to a split pane.
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setTopComponent(treeView);
splitPane.setBottomComponent(htmlView);
Dimension minimumSize = new Dimension(100, 50);
htmlView.setMinimumSize(minimumSize);
treeView.setMinimumSize(minimumSize);
splitPane.setDividerLocation(100);
splitPane.setPreferredSize(new Dimension(500, 300));
// Add the split pane to this panel.
add(splitPane);
}
示例5: TreeDemo
import javax.swing.JTree; //导入方法依赖的package包/类
public TreeDemo() {
super(new GridLayout(1,0));
//Create the nodes.
DefaultMutableTreeNode top =
new DefaultMutableTreeNode("The Java Series");
createNodes(top);
//Create a tree that allows one selection at a time.
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode
(TreeSelectionModel.SINGLE_TREE_SELECTION);
//Listen for when the selection changes.
tree.addTreeSelectionListener(this);
if (playWithLineStyle) {
System.out.println("line style = " + lineStyle);
tree.putClientProperty("JTree.lineStyle", lineStyle);
}
//Create the scroll pane and add the tree to it.
JScrollPane treeView = new JScrollPane(tree);
//Create the HTML viewing pane.
htmlPane = new JEditorPane();
htmlPane.setEditable(false);
initHelp();
JScrollPane htmlView = new JScrollPane(htmlPane);
//Add the scroll panes to a split pane.
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setTopComponent(treeView);
splitPane.setBottomComponent(htmlView);
Dimension minimumSize = new Dimension(100, 50);
htmlView.setMinimumSize(minimumSize);
treeView.setMinimumSize(minimumSize);
splitPane.setDividerLocation(100);
splitPane.setPreferredSize(new Dimension(500, 300));
//Add the split pane to this panel.
add(splitPane);
}
示例6: PackageBrowser
import javax.swing.JTree; //导入方法依赖的package包/类
public PackageBrowser(JFrame frame, String title, boolean modal) {
super(MainFrame.mainFrame,title, modal);
addWindowListener(WindowDisposer.getDisposer());
addKeyListener(WindowDisposer.getDisposer());
ActionEventHandler actionEventH = new ActionEventHandler();
LibComboActionEvnetHandler libComboHandler = new LibComboActionEvnetHandler();
PackageListSelectionEventHandler packageListSelectionEventH = new PackageListSelectionEventHandler();
ClassListSelectionEventHandler classListSelectionEventH = new ClassListSelectionEventHandler();
TreeExpansionEventHandler treeExpansionEventH = new TreeExpansionEventHandler();
tabbedPane = new JTabbedPane();
//List view tab
libListRenderer = new LibComboCellRenderer();
packageListRenderer = new PackageListCellRenderer();
classListRenderer = new ClassListCellRenderer();
libraryCombo = new JComboBox();
libraryCombo.setRenderer(libListRenderer);
libraryCombo.addActionListener(libComboHandler);
packageList = new JList();
packageList.setCellRenderer(packageListRenderer);
packageList.addListSelectionListener(packageListSelectionEventH);
classList = new JList();
classList.setCellRenderer(classListRenderer);
classList.addListSelectionListener(classListSelectionEventH);
listViewTab = new ListViewPanel(libraryCombo, packageList, classList);
tabbedPane.addTab("ListView", listViewTab);
tabbedPane.setTabPlacement(SwingConstants.TOP);
tabbedPane.setSelectedIndex(0);
tree = new JTree();
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.addTreeExpansionListener(treeExpansionEventH);
treeRenderer = new PackageBrowserTreeCellRenderer();
tree.setCellRenderer(treeRenderer);
//Tree view tab
treeViewTab = new TreeViewPanel(tree);
treeViewTab.setPackageBrowser(this);
tabbedPane.addTab("TreeView", treeViewTab);
//buttons panel
selectBtn = new JButton("Select");
selectBtn.setActionCommand("Select");
selectBtn.addActionListener(actionEventH);
selectBtn.setEnabled(true);
cancelBtn = new JButton("Close");
cancelBtn.setActionCommand("Close");
cancelBtn.addActionListener(actionEventH);
btnP = new JPanel();
FlowLayout btnL = new FlowLayout();
btnP.setLayout(btnL);
btnP.add(selectBtn);
btnP.add(cancelBtn);
setFirstData();
getContentPane().add(tabbedPane, BorderLayout.CENTER);
getContentPane().add(btnP, BorderLayout.SOUTH);
getContentPane().add(new JPanel(),BorderLayout.WEST);
getContentPane().add(new JPanel(),BorderLayout.EAST);
setSize(250,480);
setLocation(150, 150);
this.setResizable(false);
}