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


Java HyperlinkProvider类代码示例

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


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

示例1: interactiveTreeTableLinkRendererSimpleText

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
     * Issue #??-swingx: hyperlink in JXTreeTable hierarchical column not
     * active.
     * 
     */
    public void interactiveTreeTableLinkRendererSimpleText() {
        AbstractHyperlinkAction<Object> simpleAction = new AbstractHyperlinkAction<Object>(null) {

            @Override
            public void actionPerformed(ActionEvent e) {
                LOG.info("hit: " + getTarget());
                
            }
            
        };
        JXTreeTable tree = new JXTreeTable(new FileSystemModel());
        HyperlinkProvider provider =  new HyperlinkProvider(simpleAction);
        tree.getColumn(2).setCellRenderer(new DefaultTableRenderer(provider));
        tree.setTreeCellRenderer(new DefaultTreeRenderer( //provider));
                new WrappingProvider(provider)));
//        tree.setCellRenderer(new LinkRenderer(simpleAction));
        tree.setHighlighters(HighlighterFactory.createSimpleStriping());
        JFrame frame = wrapWithScrollingInFrame(tree, "table and simple links");
        frame.setVisible(true);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:JXTreeTableIssues.java

示例2: interactiveTreeLinkRendererSimpleText

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
public void interactiveTreeLinkRendererSimpleText() {
        AbstractHyperlinkAction<Object> simpleAction = new AbstractHyperlinkAction<Object>(null) {

            public void actionPerformed(ActionEvent e) {
                LOG.info("hit: " + getTarget());
                
            }
            
        };
        JXTree tree = new JXTree(new FileSystemModel());
        tree.setRolloverEnabled(true);
        HyperlinkProvider provider =  new HyperlinkProvider(simpleAction);
        tree.setCellRenderer(new DefaultTreeRenderer(provider));
//        tree.setCellRenderer(new LinkRenderer(simpleAction));
        tree.setHighlighters(HighlighterFactory.createSimpleStriping());
        JFrame frame = wrapWithScrollingInFrame(tree, "tree and simple links");
        frame.setVisible(true);
        
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:JXHyperlinkVisualCheck.java

示例3: interactiveTableHyperlinkNoTooltip

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * Table url activation, disabled tooltips.
 */
public void interactiveTableHyperlinkNoTooltip() {
    JXTable table = new JXTable(createModelWithLinks());
    EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
    LinkModelAction<?> action = new LinkModelAction<LinkModel>(visitor) {

        @Override
        protected void updateFromTarget() {
            super.updateFromTarget();
            putValue(Action.SHORT_DESCRIPTION, null);
        }
        
    };
    // set the default renderer for LinkModel - which is basically
    // a bean wrapped around an URL
    table.setDefaultRenderer(LinkModel.class, new DefaultTableRenderer
            (new HyperlinkProvider(action, LinkModel.class)));
    JXFrame frame = wrapWithScrollingInFrame(table, visitor.getOutputComponent(), "table and simple links");
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:JXHyperlinkVisualCheck.java

示例4: interactiveTableHyperlinkLFStripingHighlighter

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/** 
 * Check visuals of hyperlink and highlighter.
 * Issue #513-swingx: no rollover effect for disabled table.
 * Hyperlink is disabled automatically by DefaultVisuals, no need
 * to disable the xxRolloverController.
 * 
 */
public void interactiveTableHyperlinkLFStripingHighlighter() {
    EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
    final JXTable table = new JXTable(createModelWithLinks());
    LinkModelAction<?> action = new LinkModelAction<LinkModel>(visitor);
    table.setDefaultRenderer(LinkModel.class, new DefaultTableRenderer
            (new HyperlinkProvider(action, LinkModel.class)));
    table.setHighlighters(HighlighterFactory.createSimpleStriping());
    Action enabled = new AbstractAction("toggle table enabled") {

        public void actionPerformed(ActionEvent e) {
            table.setEnabled(!table.isEnabled());
            
        }
        
    };
    JXFrame frame = wrapWithScrollingInFrame(table, visitor.getOutputComponent(), 
            "show link renderer in table with LF striping highlighter");
    addAction(frame, enabled);
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:JXHyperlinkVisualCheck.java

示例5: interactiveListHyperlinkSimpleText

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * Simple target action.
 *
 */
public void interactiveListHyperlinkSimpleText() {
    AbstractHyperlinkAction<Object> linkAction = new AbstractHyperlinkAction<Object>(null) {

        public void actionPerformed(ActionEvent e) {
            LOG.info("hit: " + getTarget());
        }
        
    };
    JXList list = new JXList(createTextOnlyListModel(20));
    list.setRolloverEnabled(true);
    list.setCellRenderer(new DefaultListRenderer(
            new HyperlinkProvider(linkAction)));
    JFrame frame = wrapWithScrollingInFrame(list, "show simple link renderer in list");
    frame.setVisible(true);

}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:JXHyperlinkVisualCheck.java

示例6: installRenderers

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * Install renderers which use the prepared string representations.
 * Note: this method is called after the binding (aka: attach models)
 * because it installs per-column renderers which in this setup can be done only 
 * after the columns are created. 
 */
private void installRenderers() {
    initStringRepresentation();
    StringValue sv = stringValues.get("name");
    table.setDefaultRenderer(Contributor.class, new DefaultTableRenderer(sv));
    list.setCellRenderer(new DefaultListRenderer(sv));
    tree.setCellRenderer(new DefaultTreeRenderer(sv));
    treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
    
    for (int i = 1; i < keys.length; i++) {
        installColumnRenderers(i, new DefaultTableRenderer(stringValues.get(keys[i])));
    }
    // <snip> Unrelated, just for fun: Hyperlink 
    // Use a hyperlinkRenderer for the email column
    HyperlinkProvider provider = new HyperlinkProvider(new ContributorMailAction(
            stringValues.get("email")));
    installColumnRenderers(keys.length - 1, new DefaultTableRenderer(provider));
    table.getColumnExt(keys.length - 1).setToolTipText(
            "Note: the mail-to action will do nothing in security restricted environments");
    // </snip>
    table.packAll();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:HighlighterExtDemo.java

示例7: createDefaultRenderers

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * Creates default cell renderers for <code>Object</code>s,
 * <code>Number</code>s, <code>Date</code>s, <code>Boolean</code>s, 
 * <code>Icon/Image/</code>s and <code>URI</code>s.
 * <p>
 * Overridden to replace all super default renderers with SwingX variants and
 * additionally register a default for <code>URI</code> types. Note: the latter
 * registration will fail silently in headless environments or when the runtime
 * context doesn't support Desktop.
 * 
 * <p>
 * {@inheritDoc}
 * 
 * @see org.jdesktop.swingx.renderer.DefaultTableRenderer
 * @see org.jdesktop.swingx.renderer.ComponentProvider
 */
@Override
protected void createDefaultRenderers() {
    defaultRenderersByColumnClass = new UIDefaults(8, 0.75f);
    // configured default table renderer (internally LabelProvider)
    setDefaultRenderer(Object.class, new DefaultTableRenderer());
    setDefaultRenderer(Number.class, new DefaultTableRenderer(
            StringValues.NUMBER_TO_STRING, JLabel.RIGHT));
    setDefaultRenderer(Date.class, new DefaultTableRenderer(
            StringValues.DATE_TO_STRING));
    // use the same center aligned default for Image/Icon
    TableCellRenderer renderer = new DefaultTableRenderer(new MappedValue(
            StringValues.EMPTY, IconValues.ICON), JLabel.CENTER);
    setDefaultRenderer(Icon.class, renderer);
    setDefaultRenderer(ImageIcon.class, renderer);
    // use a ButtonProvider for booleans
    setDefaultRenderer(Boolean.class, new DefaultTableRenderer(
            new CheckBoxProvider()));
    
    try {
        setDefaultRenderer(URI.class, new DefaultTableRenderer(
                new HyperlinkProvider(new HyperlinkAction())
        ));
    } catch (Exception e) {
        // nothing to do - either headless or Desktop not supported
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:43,代码来源:JXTable.java

示例8: interactiveTableHyperlinkSimpleText

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
     * Table with both simple "hyperlinks" targets and url activation.
     */
    public void interactiveTableHyperlinkSimpleText() {
        JXTable table = new JXTable(createModelWithLinks());
        EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
        LinkModelAction<?> action = new LinkModelAction<LinkModel>(visitor);
        // set the default renderer for LinkModel - which is basically
        // a bean wrapped around an URL
        table.setDefaultRenderer(LinkModel.class, new DefaultTableRenderer
                (new HyperlinkProvider(action, LinkModel.class)));
        // JW: editor mis-use is not recommended but possible...
        // the LinkRenderer in its role as editor is not yet deprecated but should
        // soon. Without registering a specialized editor the column should
        // not editable - otherwise the "normal" default editor would jump in
//        LinkModelAction action2 = new LinkModelAction<LinkModel>(visitor);
        // table.setDefaultEditor(LinkModel.class, new LinkRenderer(action2, LinkModel.class));

        // simple activatable action on the target in the first column
        AbstractHyperlinkAction<Object> simpleAction = new AbstractHyperlinkAction<Object>(null) {
            
            public void actionPerformed(ActionEvent e) {
                LOG.info("hit: " + getTarget());
                
            }
            
        };
        // the action will be activated only if the column is not-editable
        // here that's done in the model
        // TODO JW: revisit
        table.getColumn(0).setCellRenderer(new DefaultTableRenderer(
                new HyperlinkProvider(simpleAction)));

        JXFrame frame = wrapWithScrollingInFrame(table, visitor.getOutputComponent(), "table and simple links");
        frame.setVisible(true);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:37,代码来源:JXHyperlinkVisualCheck.java

示例9: interactiveListHyperlikPlayer

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * Custom link target action in JXList.
 */
public void interactiveListHyperlikPlayer() {
    AbstractHyperlinkAction<Player> linkAction = new AbstractHyperlinkAction<Player>() {

        public void actionPerformed(ActionEvent e) {
            LOG.info("hit: " + getTarget());
            
        }
        
        @Override
        protected void installTarget() {
            setName(getTarget() != null ? getTarget().name : "");
        }
        
    };
    
    JXList list = new JXList(createPlayerModel(), true);
    list.setRolloverEnabled(true);
    // descending order - check if the action is performed for the 
    // correct value
    list.setSortOrder(SortOrder.DESCENDING);
    list.setCellRenderer(new DefaultListRenderer(
            new HyperlinkProvider(linkAction, Player.class)));
    JFrame frame = wrapWithScrollingInFrame(list, "show simple bean link renderer in list");
    frame.setVisible(true);

}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:JXHyperlinkVisualCheck.java

示例10: interactiveListHyperlink

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * ListModel with LinkModel.
 *
 */
public void interactiveListHyperlink() {
    EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
    JXList list = new JXList(createListModelWithLinks(20));
    list.setRolloverEnabled(true);
    LinkModelAction<?> action = new LinkModelAction<LinkModel>(visitor);
    list.setCellRenderer(new DefaultListRenderer(
            new HyperlinkProvider(action, LinkModel.class)));
    JFrame frame = wrapWithScrollingInFrame(list, visitor.getOutputComponent(), "show link renderer in list");
    frame.setVisible(true);

}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:JXHyperlinkVisualCheck.java

示例11: interactiveListHyperlinkLFStripingHighlighter

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * Visuals of Hyperlink/Highlighter interaction.
 *
 */
public void interactiveListHyperlinkLFStripingHighlighter() {
    EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
    JXList list = new JXList(createListModelWithLinks(20));
    LinkModelAction<?> action = new LinkModelAction<LinkModel>(visitor);
    list.setCellRenderer(new DefaultListRenderer(
            new HyperlinkProvider(action, LinkModel.class)));
    list.setRolloverEnabled(true);
    list.setHighlighters(HighlighterFactory.createSimpleStriping());
    JFrame frame = wrapWithScrollingInFrame(list, visitor.getOutputComponent(), 
            "show link renderer in list with LFStriping highlighter");
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:17,代码来源:JXHyperlinkVisualCheck.java

示例12: installLinkRenderer

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
private void installLinkRenderer(JXTable table) {
    LinkModelAction<?> action = new LinkModelAction<LinkModel>() {

        @Override
        public void actionPerformed(ActionEvent e) {
            LOG.info("activated link: " + getTarget());
        }
         
    };
    TableCellRenderer linkRenderer = new DefaultTableRenderer(
            new HyperlinkProvider(action, LinkModel.class));
    table.setDefaultRenderer(LinkModel.class, linkRenderer);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:JXTableVisualCheck.java

示例13: interactiveTestRolloverHighlightAndLink

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
/**
 * Issue #20: Highlighters and LinkRenderers don't work together
 * fixed with overhaul of SwingX renderers?
 */
public void interactiveTestRolloverHighlightAndLink() {
    JXList list = new JXList(createListModelWithLinks());
    EditorPaneLinkVisitor editorPaneLinkVisitor = new EditorPaneLinkVisitor();
    LinkModelAction<?> action = new LinkModelAction<LinkModel>(editorPaneLinkVisitor);
    HyperlinkProvider h = new HyperlinkProvider(action, LinkModel.class);
    list.setCellRenderer(new DefaultListRenderer(h));
    list.setRolloverEnabled(true);
    list.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, new Color(0xF0, 0xF0, 0xE0), 
            null));
    showWithScrollingInFrame(list, editorPaneLinkVisitor.getOutputComponent(), "rollover highlight with links");
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:JXListVisualCheck.java

示例14: assertHyperlinkProvider

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
private void assertHyperlinkProvider(Class<?> clazz) {
    DefaultTableRenderer renderer = (DefaultTableRenderer) table.getDefaultRenderer(clazz);
    assertTrue("expected hyperlinkProvider but was:" + renderer.getComponentProvider(),
           renderer.getComponentProvider() instanceof HyperlinkProvider );
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:6,代码来源:JXTableUnitTest.java

示例15: bind

import org.jdesktop.swingx.renderer.HyperlinkProvider; //导入依赖的package包/类
private void bind() throws URISyntaxException {
    // <snip> Hyperlink with desktop action
    // default browser action, text defaults to url
    plainBrowse.setURI(new URI("https://swingx.dev.java.net"));
    // default mailer action, text defaults to uri
    plainMail.setURI(new URI("mailto:[email protected]"));
    // default browser action, custom inject properties from resources
    customBrowse.setURI(new URI("http://wiki.java.net/bin/view/Javadesktop/SwingLabsSwingX"));
    // </snip>
    DemoUtils.setSnippet("Hyperlink with desktop action", plainBrowse, plainMail, customBrowse);
    
    // <snip> Hyperlink with custom action
    customLink.setAction(createLinkAction());
    // </snip>
    DemoUtils.setSnippet("Hyperlink with custom action", customLink);
    
    // <snip> List with hyperlink renderer
    // model containing URIs
    linkList.setModel(new DefaultComboBoxModel(new Object[] {
            new URI("https://swingx.dev.java.net"),
            new URI("http://wiki.java.net/bin/view/Javadesktop/SwingLabsSwingX"),
            new URI("http://forums.java.net/jive/forum.jspa?forumID=73")
    }));
    // enable rollover
    linkList.setRolloverEnabled(true);
    // set a renderer delegating to a HyperlinkProvider configured
    // with raw HyperlinkAction
    linkList.setCellRenderer(new DefaultListRenderer(new HyperlinkProvider(
            new HyperlinkAction())));
    //</snip>
    DemoUtils.setSnippet("List with hyperlink renderer", linkList);
    
    // <snip> Tree with hyperlink renderer
    // model containing URIs wrapped in treeNodes
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(
            new URI("http://java.net"));
    for (int i = 0; i < linkList.getElementCount(); i++) {
        root.add(new DefaultMutableTreeNode(linkList.getElementAt(i)));
    }
    linkTree.setModel(new DefaultTreeModel(root));
    linkTree.expandAll();
    // enable rollover
    linkTree.setRolloverEnabled(true);
    // set a renderer delegating to wrapper around a HyperlinkProvider
    // configured with a raw HyperlinkAction 
    linkTree.setCellRenderer(new DefaultTreeRenderer(new WrappingProvider(
            new HyperlinkProvider(new HyperlinkAction()))));
    // </snip>
    DemoUtils.setSnippet("Tree with hyperlink renderer", linkTree);
    
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:52,代码来源:HyperlinkDemo.java


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