本文整理了Java中javax.swing.JTree.putClientProperty()
方法的一些代码示例,展示了JTree.putClientProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.putClientProperty()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:putClientProperty
暂无
代码示例来源:origin: JetBrains/jediterm
public static void setLineStyleAngled(final JTree component) {
component.putClientProperty("JTree.lineStyle", "Angled");
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
/**
* Restores the given open paths on the treeModel.
*
* @param paths a List of TreePaths which are going to be opened.
*/
public void restoreExpandedPaths(List paths) {
tree.putClientProperty(UIUtils.PROP_EXPANSION_TRANSACTION, Boolean.TRUE); // NOI18N
for (Object p : paths) {
tree.expandPath((TreePath)p);
}
tree.putClientProperty(UIUtils.PROP_EXPANSION_TRANSACTION, Boolean.FALSE); // NOI18N
}
代码示例来源:origin: stackoverflow.com
private JTree getJTree() {
JTree jTree = new JTree();
jTree.setOpaque(true);
jTree.setBackground(Color.white);
UIDefaults paneDefaults = new UIDefaults();
paneDefaults.put("Tree.selectionBackground",null);
JTextPane pane = new JTextPane();
jTree.putClientProperty("Nimbus.Overrides",paneDefaults);
jTree.putClientProperty("Nimbus.Overrides.InheritDefaults",false);
jTree.setCellRenderer( new LocalRenderer() );
return jTree;
}
代码示例来源:origin: org.glassfish.external/antlr
public JTreeASTPanel(TreeModel tm, TreeSelectionListener listener) {
// use a layout that will stretch tree to panel size
setLayout(new BorderLayout());
// Create tree
tree = new JTree(tm);
// Change line style
tree.putClientProperty("JTree.lineStyle", "Angled");
// Add TreeSelectionListener
if (listener != null)
tree.addTreeSelectionListener(listener);
// Put tree in a scrollable pane's viewport
JScrollPane sp = new JScrollPane();
sp.getViewport().add(tree);
add(sp, BorderLayout.CENTER);
}
}
代码示例来源:origin: toplink.essentials/toplink-essentials
public JTreeASTPanel(TreeModel tm, TreeSelectionListener listener) {
// use a layout that will stretch tree to panel size
setLayout(new BorderLayout());
// Create tree
tree = new JTree(tm);
// Change line style
tree.putClientProperty("JTree.lineStyle", "Angled");
// Add TreeSelectionListener
if (listener != null)
tree.addTreeSelectionListener(listener);
// Put tree in a scrollable pane's viewport
JScrollPane sp = new JScrollPane();
sp.getViewport().add(tree);
add(sp, BorderLayout.CENTER);
}
}
代码示例来源:origin: antlr/antlr3
public JTreeStringTemplatePanel(TreeModel tm, TreeSelectionListener listener) {
// use a layout that will stretch tree to panel size
setLayout(new BorderLayout());
// Create tree
tree = new JTree(tm);
// Change line style
tree.putClientProperty("JTree.lineStyle", "Angled");
// Add TreeSelectionListener
if (listener != null)
tree.addTreeSelectionListener(listener);
// Put tree in a scrollable pane's viewport
JScrollPane sp = new JScrollPane();
sp.getViewport().add(tree);
add(sp, BorderLayout.CENTER);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-antlr
public JTreeASTPanel(TreeModel tm, TreeSelectionListener listener) {
// use a layout that will stretch tree to panel size
setLayout(new BorderLayout());
// Create tree
tree = new JTree(tm);
// Change line style
tree.putClientProperty("JTree.lineStyle", "Angled");
// Add TreeSelectionListener
if (listener != null)
tree.addTreeSelectionListener(listener);
// Put tree in a scrollable pane's viewport
JScrollPane sp = new JScrollPane();
sp.getViewport().add(tree);
add(sp, BorderLayout.CENTER);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
public JTreeStringTemplatePanel(TreeModel tm, TreeSelectionListener listener) {
// use a layout that will stretch tree to panel size
setLayout(new BorderLayout());
// Create tree
tree = new JTree(tm);
// Change line style
tree.putClientProperty("JTree.lineStyle", "Angled");
// Add TreeSelectionListener
if (listener != null)
tree.addTreeSelectionListener(listener);
// Put tree in a scrollable pane's viewport
JScrollPane sp = new JScrollPane();
sp.getViewport().add(tree);
add(sp, BorderLayout.CENTER);
}
}
代码示例来源:origin: org.activecomponents.jadex/jadex-commons-gui
/**
* Create a tree expansion handler for a given tree.
*/
public TreeExpansionHandler(JTree tree)
{
this.tree = tree;
this.expanded = new HashSet();
tree.addTreeExpansionListener(this);
tree.getModel().addTreeModelListener(this);
List tehs = (List)tree.getClientProperty(TreeExpansionHandler.class);
if(tehs==null)
{
tehs = new ArrayList();
tree.putClientProperty(TreeExpansionHandler.class, tehs);
}
tehs.add(this);
}
代码示例来源:origin: org.n52.wps/52n-wps-install-wizard
public CheckNodeTree(CheckNode[] nodeList){
this.nodes = nodeList;
JTree tree = new JTree( nodes[0] );
tree.setCellRenderer(new CheckRenderer());
tree.getSelectionModel().setSelectionMode(
TreeSelectionModel.SINGLE_TREE_SELECTION
);
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.addMouseListener(new NodeSelectionListener(tree));
JScrollPane sp = new JScrollPane(tree);
sp.setPreferredSize(new Dimension(400,250));
this.setPreferredSize(new Dimension(400,250));
this.add(sp);
}
代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-explorer
/*******************************************************************************
*
******************************************************************************/
@Override
public void setBackground (final Color color)
{
super.setBackground(color);
if (tree != null)
{
tree.setBackground(color);
tree.putClientProperty("JTree.lineStyle", "None"); // FIXME: move elsewhere
}
}
代码示例来源:origin: org.junit/com.springsource.junit
public TestSuitePanel() {
super(new BorderLayout());
setPreferredSize(new Dimension(300, 100));
fTree= new JTree();
fTree.setModel(null);
fTree.setRowHeight(20);
ToolTipManager.sharedInstance().registerComponent(fTree);
fTree.putClientProperty("JTree.lineStyle", "Angled");
fScrollTree= new JScrollPane(fTree);
add(fScrollTree, BorderLayout.CENTER);
}
代码示例来源:origin: de.sciss/jtreetable
private void updateTreeClientProperties(JTree tree) {
if (isNimbus()) {
UIDefaults map = new UIDefaults();
// Problematic for 1.6 & 1.7 compatibility
Painter<JComponent> painter = new Painter<JComponent>() {
public void paint(Graphics2D g, JComponent c, int w, int h) {}
};
map.put("Tree:TreeCell[Enabled+Selected].backgroundPainter", painter);
map.put("Tree:TreeCell[Focused+Selected].backgroundPainter", painter);
// map.put("\"Tree.cellEditor\"[Enabled+Focused].backgroundPainter", painter);
tree.putClientProperty("Nimbus.Overrides", map);
} else {
tree.putClientProperty("Nimus.Overrides", null);
}
}
代码示例来源:origin: de.sciss/jtreetable
@Override
public void prepareForTree() {
super.prepareForTree();
if (System.getSecurityManager() != null)
return;
UIDefaults map = getDefaults();
if (map == current)
return;
current = map;
clearCachedOverrides(tree, Region.TREE);
tree.putClientProperty("Nimbus.Overrides", map);
focus = false;
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime
public static void initUI(JScrollPane selectedTreePane, JTree tree) {
// customize tree selection colors
UIDefaults defaults = new UIDefaults();
Painter<JComponent> painter = (g, c, w, h) -> g.fillRect(0, 0, w, h);
defaults.put("Tree:TreeCell[Enabled+Selected].backgroundPainter", painter);
defaults.put("Tree:TreeCell[Enabled+Focused].backgroundPainter", painter);
defaults.put("Tree:TreeCell[Focused+Selected].backgroundPainter", painter);
tree.putClientProperty("Nimbus.Overrides", defaults);
// Fix http://forge.codelutin.com/issues/2781
selectedTreePane.getViewport().setBackground(Color.WHITE);
}
代码示例来源:origin: igniterealtime/Spark
/**
* Constructs a new CheckBox tree.
*
* @param rootNode Node that is the root of this tree.
*/
public CheckTree(CheckNode rootNode) {
tree = new JTree(rootNode);
tree.setCellRenderer(new CheckRenderer());
tree.setRowHeight(18);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setToggleClickCount(1000);
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.addMouseListener(new NodeSelectionListener(tree));
setLayout(new BorderLayout());
add(tree, BorderLayout.CENTER);
}
代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit
public HelpTOCPanel(HelpViewerInterface helpViewer)
{
super(new BorderLayout());
this.helpViewer = helpViewer;
nodes = new Hashtable();
toc = new TOCTree();
// looks bad with the OS X L&F, apparently...
if(!OperatingSystem.isMacOSLF())
toc.putClientProperty("JTree.lineStyle", "Angled");
toc.setCellRenderer(new TOCCellRenderer());
toc.setEditable(false);
toc.setShowsRootHandles(true);
add(BorderLayout.CENTER,new JScrollPane(toc));
load();
} //}}}
代码示例来源:origin: Multibit-Legacy/multibit-hd
/**
* <p>Disables the background selection rendering in the Nimbus LAF</p>
*
* @param tree The JTree with the Nimbus LAF
*/
public static void disableTreeViewSelection(JTree tree) {
// Create a null painter
Painter painter = new Painter() {
public void paint(Graphics2D g, Object o, int w, int h) {
// Do nothing
}
};
UIDefaults treeTheme = new UIDefaults();
treeTheme.put("Tree:TreeCell[Focused+Selected].backgroundPainter", painter);
treeTheme.put("Tree:TreeCell[Enabled+Selected].backgroundPainter", painter);
tree.putClientProperty("Nimbus.Overrides", treeTheme);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private void initTree() {
JTree tree = new JTree(getRootNode());
tree.setCellRenderer(new CheckBoxTreeRenderer());
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.putClientProperty("JTree.lineStyle", "Angled"); //NOI18N
NodeSelectionListener listener = new NodeSelectionListener(tree);
tree.addMouseListener(listener);
tree.addKeyListener(listener);
tree.expandRow(0);
tree.setShowsRootHandles(true);
tree.setSelectionRow(0);
initTree(tree);
scrollPane.add(tree);
scrollPane.setViewportView(tree);
}
代码示例来源:origin: de.sciss/jtreetable
protected JTree createAndConfigureTree() {
JTree tree = createTree(treeTable.getTreeTableModel());
if (treeTable.getSelectionModel() == null) {
treeTable.setSelectionModel(tree.getSelectionModel());
} else {
tree.setSelectionModel(treeTable.getSelectionModel());
}
tree.setOpaque(false);
tree.setRowHeight(20);
tree.putClientProperty("JTree.lineStyle", "None");
InputMap inputs = tree.getInputMap();
remap(inputs, KeyEvent.VK_LEFT);
remap(inputs, KeyEvent.VK_RIGHT);
updateTreeClientProperties(tree);
return tree;
}
内容来源于网络,如有侵权,请联系作者删除!