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


Java JXTree.setRolloverEnabled方法代码示例

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


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

示例1: 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

示例2: 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

示例3: interactiveTreeURIRenderer

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
public void interactiveTreeURIRenderer() {
    JXTree tree = new JXTree(createTreeModelWithURI(20));
    tree.setRolloverEnabled(true);
    // PENDING JW: how to have "mixed" user object types? HyperlinkAction throws on f.i. String ..
    ComponentProvider<?> provider = new HyperlinkProvider(new HyperlinkAction());
    tree.setCellRenderer(new DefaultTreeRenderer(new WrappingProvider(provider)));
    showWithScrollingInFrame(tree, "tree with uri renderer");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:RendererVisualCheck.java

示例4: interactiveTestTreeLinkRenderer

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * extended link renderer in tree.
 *
 */
public void interactiveTestTreeLinkRenderer() {
    EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
    JXTree tree = new JXTree(createTreeModelWithLinks(20));
    tree.setRolloverEnabled(true);
    LinkModelAction<LinkModel> action = new LinkModelAction<LinkModel>(visitor);
    ComponentProvider<JXHyperlink> context = new HyperlinkProvider(action, LinkModel.class);
    tree.setCellRenderer(new DefaultTreeRenderer(new WrappingProvider(context)));
    JFrame frame = wrapWithScrollingInFrame(tree, visitor.getOutputComponent(), "show link renderer in list");
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:RendererVisualCheck.java

示例5: interactiveTreeFancyButton

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * PENDING JW: really fancify or remove ;-)
 */
public void interactiveTreeFancyButton() {
    JXTree tree = new JXTree();
    tree.setRowHeight(30);
    MattePainter painter = new MattePainter(Color.YELLOW);
    Highlighter hl = new PainterHighlighter(HighlightPredicate.ROLLOVER_ROW, painter);
    tree.addHighlighter(hl);
    ComponentProvider<?> provider = new NormalButtonProvider(StringValues.TO_STRING, JLabel.LEADING);
    tree.setCellRenderer(new DefaultTreeRenderer(provider));
    tree.setRolloverEnabled(true);
    showWithScrollingInFrame(tree, "Fancy..");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:RendererIssues.java

示例6: interactiveAnimatedIconPainterHighlightTree

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * Issue #862-swingx: SwingX rendering components should be PainterAware.
 * 
 * Currently this works only with a local version which has WrappingIconPanel
 * implement the PainterAware by delegating to its content delegate. 
 */
public void interactiveAnimatedIconPainterHighlightTree()  {
    TreeModel model = new FileSystemModel();
    JXTree tree = new JXTree(model);
    tree.setRolloverEnabled(true);
    
    tree.setCellRenderer(new DefaultTreeRenderer(StringValues.FILE_NAME));
    ImagePainter imagePainter = new ImagePainter(XTestUtils.loadDefaultImage("green-orb.png"));
    imagePainter.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    final RelativePainter<?> painter = new RelativePainter<Component>(imagePainter);
    PainterHighlighter iconHighlighter = new PainterHighlighter();
    iconHighlighter.setHighlightPredicate(HighlightPredicate.ROLLOVER_ROW);
    iconHighlighter.setPainter(painter);
    ActionListener l = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            double fraction = painter.getXFactor();
            fraction = fraction > 1 ? 0.0 : fraction + 0.1;
            painter.setXFactor(fraction);
        }
        
    };
    tree.addHighlighter(iconHighlighter);
    showWithScrollingInFrame(tree, 
            "Animated highlighter: marching icon on rollover");
    Timer timer = new Timer(100, l);
    timer.start();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:33,代码来源:PainterVisualCheck.java

示例7: testTreeRolloverProducerComponentListener

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * Issue #1193-swingx: fix rollover mouse to cell mapping on scrolling/resizing.
 *  
 */
@Test
public void testTreeRolloverProducerComponentListener() {
    JXTree table = new JXTree();
    assertComponentListener(table, false);
    table.setRolloverEnabled(true);
    assertComponentListener(table, true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:12,代码来源:RolloverTest.java

示例8: interactiveTreeRolloverScroll

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * Issue #1193-swingx: rollover state not updated on scrolling/mouseWheel
 * 
 * visualize behaviour on 
 * - scrolling (with mouse wheel)
 * - resizing (added custom actions)
 */
public void interactiveTreeRolloverScroll() {
    final JXTree table = new JXTree(new FileSystemModel());
    table.setCellRenderer(new DefaultTreeRenderer());
    table.setRolloverEnabled(true);
    table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null));
    final JXFrame frame = getResizableFrame(table);
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:RolloverVisualCheck.java

示例9: interactiveTreeRollover

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * Issue ??: background highlighter not working in JXTree.
 * Not really an issue, works fine with SwingX renderer.
 */
public void interactiveTreeRollover() {
    final JXTree table = new JXTree(treeTableModel);
    // Note: we need swingx renderer to make some decorations work reliably.
    table.setCellRenderer(new DefaultTreeRenderer());
    table.setRolloverEnabled(true);
    table.setComponentPopupMenu(createPopup());
    final CompoundHighlighter compoundHighlighter = new CompoundHighlighter(foregroundHighlighter);
    table.setHighlighters(compoundHighlighter);
    JTree tree = new JTree(treeTableModel);
    tree.setComponentPopupMenu(createPopup());
    JXFrame frame = wrapWithScrollingInFrame(table, tree, "JXTree (at left) with rollover");
    Action toggleAction = new AbstractAction("toggle foreground/background") {
        boolean isBackground;
        public void actionPerformed(ActionEvent e) {
            if (isBackground) {
                compoundHighlighter.addHighlighter(foregroundHighlighter);
                compoundHighlighter.removeHighlighter(backgroundHighlighter);
            } else {
                compoundHighlighter.addHighlighter(backgroundHighlighter);
                compoundHighlighter.removeHighlighter(foregroundHighlighter);
                
            }
            isBackground = !isBackground;
            
        }
        
    };
    addAction(frame, toggleAction);
    addMessage(frame, "background highlight not working in JXTree (with core renderer)");
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:36,代码来源:RolloverVisualCheck.java


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