• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JXTree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jdesktop.swingx.JXTree的典型用法代码示例。如果您正苦于以下问题:Java JXTree类的具体用法?Java JXTree怎么用?Java JXTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JXTree类属于org.jdesktop.swingx包,在下文中一共展示了JXTree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: applyFont

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
@Override
protected void applyFont(JTable table, Font font) {
    JXTreeTable treeTable = (JXTreeTable) table;
    if (treeTable.getModel() != null && impl != null) {
        int hierarchicalColumn = treeTable.getHierarchicalColumn();
        TableCellRenderer cellRenderer = treeTable.getCellRenderer(0, hierarchicalColumn);
        if (cellRenderer instanceof DesktopAbstractTable.StylingCellRenderer) {
            cellRenderer = ((DesktopAbstractTable.StylingCellRenderer) cellRenderer).getDelegate();
        }
        if (cellRenderer instanceof JXTree) {
            // default JXTreeTable renderer for hierarchical column is JXTree
            ((JXTree) cellRenderer).setFont(font);
        }
    }
    super.applyFont(table, font);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:DesktopTreeTable.java


示例2: interactiveDropOnVisualsTree

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
     * Issue #370-swingx: drop-on not shown correctly.
     * 
     * Check core default renderer as renderer in Table.
     */
    public void interactiveDropOnVisualsTree() {
        JXTree xTable = new JXTree(AncientSwingTeam.createNamedColorTreeModel());
        installTransferHandler(xTable);
        xTable.setCellRenderer(new DefaultTreeRenderer());
        JTree table = new JTree(xTable.getModel());
        installTransferHandler(table);
//        xTable.setDropMode(DropMode.USE_SELECTION);
//        table.setDropMode(DropMode.USE_SELECTION);
        xTable.setDropMode(DropMode.ON_OR_INSERT);
        table.setDropMode(DropMode.ON_OR_INSERT);
        JXFrame frame = wrapWithScrollingInFrame(xTable, table,
                "JXTree <-> core tree: drop-on appearance");
        JTextField textField = new JTextField("drag me over first column....");
        textField.setDragEnabled(true);
        addStatusComponent(frame, textField);
        show(frame);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:DNDRendererVisualCheck.java


示例3: interactiveXTreeLabelFormattingHighlighter

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * Custom format on JTree/JXTree (latter with highlighter).
 *
 */
public void interactiveXTreeLabelFormattingHighlighter() {
    TreeModel model = createComponentHierarchyModel();
    JTree tree = new JTree(model);
    StringValue converter = new StringValue() {

        public String getString(Object value) {
            if (value instanceof Component) {
                return "Name: " + ((Component) value).getName();
            }
            return StringValues.TO_STRING.getString(value);
        }
        
    };
    tree.setCellRenderer(new DefaultTreeRenderer(converter));
    JXTree xtree = new JXTree(model);
    xtree.setHighlighters(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.RED,
            Color.YELLOW));
    xtree.setRolloverEnabled(true);
    // share renderer
    xtree.setCellRenderer(tree.getCellRenderer());
    final JXFrame frame = wrapWithScrollingInFrame(tree, xtree, "custom format - tree vs. xtree (+Rollover renderer)");
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:TreeRendererTest.java


示例4: testTreeIconsUpdateUI

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * Sanity: icons updated on LF change.
 */
public void testTreeIconsUpdateUI() {
    JXTree tree = new JXTree();
    DefaultTreeRenderer renderer = new DefaultTreeRenderer();
    tree.setCellRenderer(renderer);
    WrappingIconPanel before = (WrappingIconPanel) renderer.getTreeCellRendererComponent(tree, "", false, false, true, -1, false);
    Icon leaf = before.getIcon();
    assertNotNull("sanity", leaf);
    assertEquals("sanity", UIManager.getIcon("Tree.leafIcon"), leaf);
    String lf = UIManager.getLookAndFeel().getName();
    setSystemLF(!defaultToSystemLF);
    if (lf.equals(UIManager.getLookAndFeel().getName())) {
        LOG.info("cannot run test - equal LF" + lf);
        return;
    }
    SwingUtilities.updateComponentTreeUI(tree);
    WrappingIconPanel after = (WrappingIconPanel) renderer.getTreeCellRendererComponent(tree, "", false, false, true, -1, false);
    Icon leafAfter = after.getIcon();
    assertNotNull("sanity", leafAfter);
    assertFalse("sanity", leaf.equals(leafAfter));
    assertEquals("icon must be updated", UIManager.getIcon("Tree.leafIcon"), leafAfter);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:25,代码来源:TreeRendererIssues.java


示例5: testFindDialogNew

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * Issue #718-swingx: shared FindPanel not updated on LF change.
 * 
 * Here: check that dialog is new for different owner and old has been disposed.
 */
@Test
public void testFindDialogNew() {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXFrame frame = new JXFrame();
    JXTable table = new JXTable();
    frame.add(table);
    JComponent findPanel = SearchFactory.getInstance().getSharedFindPanel();
    // show search dialog for a searchable
    SearchFactory.getInstance().showFindDialog(table, table.getSearchable());
    Window window = SwingUtilities.getWindowAncestor(findPanel);
    assertSame(frame, window.getOwner());
    // setup of second searchable
    JXFrame second = new JXFrame();
    JXTree tree = new JXTree();
    second.add(tree);
    // show search dialog for a searchable
    SearchFactory.getInstance().showFindDialog(tree, tree.getSearchable());
    assertFalse("previous window must not be displayable", window.isDisplayable());
    assertSame(second, SwingUtilities.getWindowAncestor(findPanel).getOwner());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:FindTest.java


示例6: interactiveRolloverDisabledClickTree

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * Issue #1374-swingx: Rollover click must be disabled if target disabled
 * 
 * Visual test for JXTable, adapted from reporter's test case
 */
public void interactiveRolloverDisabledClickTree() {
    JXTree table = new JXTree();
    table.setEnabled(false);
    table.setRolloverEnabled(true);
    final JXFrame frame = showWithScrollingInFrame(table, "disable tree must not trigger rollover renderer");
    // rollover-enabled default renderer
    DefaultTreeRenderer renderer = new DefaultTreeRenderer() {
        @Override
        public void doClick() {
            JOptionPane.showMessageDialog(frame, "Click");
        }
        
        @Override
        public boolean isEnabled() {
            return true;
        }
    };
    table.setCellRenderer(renderer);
    addEnabledToggle(frame, table);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:RolloverVisualCheck.java


示例7: interactiveTreeTableStringValueComponent

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
     * Issue ??-swingx: TreeTable doesn't return correct string value for hierarchical column.
     * 
     * This is probably a variant of not using the table's renderer (at least I expect it 
     * to be solved then at the latest). In the meantime, might want to do something special
     * for the hierarchical column?
     */
    public void interactiveTreeTableStringValueComponent() {
        TreeTableModel model = new ComponentTreeTableModel(new JXFrame());
        JXTreeTable treeTable = new JXTreeTable(model);
        treeTable.setRootVisible(true);
        treeTable.expandAll();
        LOG.info(treeTable.getStringAt(3, 0));
//        treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
        JXTree tree =  new JXTree(model);
//        tree.setCellRenderer(new DefaultTreeRenderer(sv));
        HighlightPredicate predicate = new PatternPredicate("null", 0, PatternPredicate.ALL);
        ColorHighlighter hl = new ColorHighlighter(predicate, null, Color.RED);
        treeTable.addHighlighter(hl);
        tree.addHighlighter(hl);
        JXFrame frame = wrapWithScrollingInFrame( treeTable, "string rep in hierarchical column");
        show(frame);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:24,代码来源:ComponentAdapterIssues.java


示例8: interactiveTreeStringValueComponent

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
     * Issue ??-swingx: TreeTable doesn't return correct string value for hierarchical column.
     * 
     * This is probably a variant of not using the table's renderer (at least I expect it 
     * to be solved then at the latest). In the meantime, might want to do something special
     * for the hierarchical column?
     */
    public void interactiveTreeStringValueComponent() {
        TreeTableModel model = new ComponentTreeTableModel(new JXFrame());
        JXTreeTable treeTable = new JXTreeTable(model);
        treeTable.setRootVisible(true);
        treeTable.expandAll();
        LOG.info(treeTable.getStringAt(3, 0));
//        treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
        JXTree tree =  new JXTree(model);
//        tree.setCellRenderer(new DefaultTreeRenderer(sv));
        HighlightPredicate predicate = new PatternPredicate("null", 0, PatternPredicate.ALL);
        ColorHighlighter hl = new ColorHighlighter(predicate, null, Color.RED);
        treeTable.addHighlighter(hl);
        tree.addHighlighter(hl);
        JXFrame frame = wrapWithScrollingInFrame( tree, "string rep in hierarchical column");
        show(frame);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:24,代码来源:ComponentAdapterIssues.java


示例9: showActionMaps

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
public static void showActionMaps() {
    System.out.println("\nActionMap keys for JXTable\n===================");
    showActionMap(new JXTable());

    System.out.println("\nActionMap keys for JXEditorPane\n==================");
    showActionMap(new JXEditorPane());

    System.out.println("\nActionMap keys for an HTML JXEditorPane\n==================");
    showActionMap(new JXEditorPane("text/html", ""));

    System.out.println("\nActionMap keys for JXTree\n====================");
    showActionMap(new JXTree());

    System.out.println("\nActionMap keys for JXTreeTable\n====================");
    showActionMap(new JXTreeTable());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:17,代码来源:TargetableActionTest.java


示例10: initComponents

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
     * 
     */
    private void initComponents() {
        tree = new JXTree();
        tree.setName("componentTree");
        tree.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
        add(new JScrollPane(tree), BorderLayout.CENTER);
        
        JComponent control = new JXPanel();
        refreshButton = new JButton();
        refreshButton.setName("refreshButton");

        expandButton = new JButton();
        expandButton.setName("expandButton");
        
        collapseButton = new JButton();
        collapseButton.setName("collapseButton");
        
//        control.add(refreshButton);
        control.add(expandButton);
        control.add(collapseButton);
        add(control, BorderLayout.SOUTH);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:25,代码来源:XTreeDemo.java


示例11: initComponents

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * This method is called from within the constructor to initialize the form.
 */
private void initComponents() {

    table = new JXTable(createTableModel());

    // table = new JXTreeTable(new ActionMapTreeTableModel(new
    // JXTreeTable()));

    list = new JXList(createListModel());

    tree = new JXTree(createTreeModel());

    // control components
    nextButton = new JButton("Find next");
    radioGroup = new JXRadioGroup();
    inputText = new JTextField();
    patternText = new JTextField();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:DecoratorDemo.java


示例12: createPainterDemo

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
private void createPainterDemo() {
    painterDisplay = createPainterDisplay();
    
    JComponent painterControlPanel =new JXPanel(new BorderLayout());
    painterControlPanel.add(painterDisplay);
    painterControlPanel.add(createPainterPropertiesPanel(), BorderLayout.SOUTH);
    
    painterDemos = new JXTree();
    painterDemos.setRootVisible(false);
    // PENDING JW: weird sizing in splitpane
    JSplitPane contents = new JSplitPane();
    contents.setDividerLocation(240);
    contents.setContinuousLayout(true);
    contents.setRightComponent(painterControlPanel);
    contents.setLeftComponent(new JScrollPane(painterDemos));
    add(contents);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:18,代码来源:PainterDemo.java


示例13: mousePressed

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
    JXTree tree = (JXTree) e.getComponent();
    Point mousePoint = e.getPoint();
    int labelRow = tree.getRowForLocation(mousePoint.x, mousePoint.y);
    // default selection
    if (labelRow >= 0)
        return;
    int row = tree.getClosestRowForLocation(mousePoint.x, mousePoint.y);
    Rectangle bounds = tree.getRowBounds(row);
    if (bounds == null) {
        row = -1;
    } else {
        if ((bounds.y + bounds.height < mousePoint.y)
                || bounds.x > mousePoint.x) {
            row = -1;
        }
    }
    // no hit
    if (row < 0)
        return;
    tree.dispatchEvent(new MouseEvent(tree, e.getID(), e.getWhen(), e
            .getModifiers(), bounds.x + bounds.width - 2, mousePoint.y, e
            .getClickCount(), e.isPopupTrigger(), e.getButton()));
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:26,代码来源:TreeRolloverProducer.java


示例14: updateRolloverPoint

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
@Override
protected void updateRolloverPoint(JComponent component, Point mousePoint) {
    JXTree tree = (JXTree) component;
    int row = tree.getClosestRowForLocation(mousePoint.x, mousePoint.y);
    Rectangle bounds = tree.getRowBounds(row);
    if (bounds == null) {
        row = -1;
    } else {
        if ((bounds.y + bounds.height < mousePoint.y)
                || bounds.x > mousePoint.x) {
            row = -1;
        }
    }
    int col = row < 0 ? -1 : 0;
    rollover.x = col;
    rollover.y = row;
}
 
开发者ID:sing-group,项目名称:aibench-project,代码行数:18,代码来源:TreeRolloverProducer.java


示例15: getSelectionBackground

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected Color getSelectionBackground() {
    Color selection = null;
    if (isDropOn()) {
        selection = getDropCellBackground();
        if (selection != null) return selection;
    }
    if (getComponent() instanceof JXTree) {
        return ((JXTree) getComponent()).getSelectionBackground();
    }
    return UIManager.getColor("Tree.selectionBackground");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:TreeCellContext.java


示例16: getSelectionForeground

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected Color getSelectionForeground() {
    Color selection = null;
    if (isDropOn()) {
        selection = getDropCellForeground();
        if (selection != null) return selection;
    }
    if (getComponent() instanceof JXTree) {
        return ((JXTree) getComponent()).getSelectionForeground();
    }
    return UIManager.getColor("Tree.selectionForeground");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:TreeCellContext.java


示例17: setUp

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    JXTree tree = new JXTree();
    model = tree.getModel();
    root = (DefaultMutableTreeNode) model.getRoot();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:8,代码来源:TreeUtilitiesTest.java


示例18: interactiveTreeBorderHighlighter

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * Show variants of border Highlighters.
 *
 */
public void interactiveTreeBorderHighlighter() {
    JXTree tree = new JXTree();
    tree.expandAll();
    tree.setVisibleRowCount(tree.getRowCount());
    // need SwingX highlighter
    tree.setCellRenderer(new DefaultTreeRenderer());
    tree.setHighlighters(new BorderHighlighter(BorderFactory.createLineBorder(Color.GREEN, 1)));
    showWithScrollingInFrame(tree, "Border Highlighters");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:HighlighterClientVisualCheck.java


示例19: interactiveTreeRendererExtendsOpacity

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
 * Issue swingx-1514: icon background always highlighted. <p>
 * Actually a problem introduced by #3789 version of JXPanel
 * Not special to the hierarchical nature, same for list
 * 
 * Not fixed (1.6.5) for Nimbus (and potentially other synth-based lafs)
 * 
 * @see org.jdesktop.swingx.renderer.RendererVisualCheck#interactiveIconTextAlignmentAndExtendsOpacity
 */
public void interactiveTreeRendererExtendsOpacity() {
    JXTree table = new JXTree();
    table.expandAll();
    final WrappingProvider wrapper = new WrappingProvider();
    table.setCellRenderer(new DefaultTreeRenderer(wrapper));
    table.addHighlighter(HighlighterFactory.createSimpleStriping());
    JXFrame frame = wrapWithScrollingInFrame(table, "background on icon?");
    addAction(frame, createToggleExtendsOpacityAction(wrapper, table));
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:RendererVisualCheck.java


示例20: interactiveDisabledCollectionViews

import org.jdesktop.swingx.JXTree; //导入依赖的package包/类
/**
     * Issue #282-swingx: compare disabled appearance of
     * collection views.
     * Check if extended renderers behave correctly. Still open: header 
     * renderer disabled.
     */
    public void interactiveDisabledCollectionViews() {
        final JXTable table = new JXTable(new AncientSwingTeam());
//        table.setDefaultRenderer(Object.class, new DefaultTableRenderer());
        table.setEnabled(false);
        final JXList list = new JXList(new String[] {"one", "two", "and something longer"});
        list.setEnabled(false);
//        list.setCellRenderer(new DefaultListRenderer());
        final JXTree tree = new JXTree(new FileSystemModel());
        tree.setEnabled(false);
        JComponent box = Box.createHorizontalBox();
        box.add(new JScrollPane(table));
        box.add(new JScrollPane(list));
        box.add(new JScrollPane(tree));
        JXFrame frame = wrapInFrame(box, "disabled collection views");
        AbstractAction action = new AbstractAction("toggle disabled") {

            @Override
            public void actionPerformed(ActionEvent e) {
                table.setEnabled(!table.isEnabled());
                list.setEnabled(!list.isEnabled());
                tree.setEnabled(!tree.isEnabled());
            }
            
        };
        addAction(frame, action);
        frame.setVisible(true);
        
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:35,代码来源:RendererVisualCheck.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultAcsClient类代码示例发布时间:2022-05-22
下一篇:
Java SecretVerifier类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap