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


Java JXFrame类代码示例

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


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

示例1: interactiveRolloverHighlight

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Plain RolloverHighlighter. 
 * Issue #513-swingx: no rollover effect for disabled table.
 *
 */
public void interactiveRolloverHighlight() {
    final JXTable table = new JXTable(tableModel);
    ColorHighlighter colorHighlighter = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null);
    table.addHighlighter(colorHighlighter);
    Action action = new AbstractAction("toggle table enabled") {

        @Override
        public void actionPerformed(ActionEvent e) {
            table.setEnabled(!table.isEnabled());
            
        }
        
    };
    JXFrame frame = showWithScrollingInFrame(table, "rollover highlight, enabled/disabled table");
    addAction(frame, action);
    frame.pack();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:HighlighterClientVisualCheck.java

示例2: interactiveIconTextAlignmentAndExtendsOpacity

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Requirement: left aligned icon and right aligned text.
 * http://forums.java.net/jive/thread.jspa?messageID=398448#398448
 * 
 * Issue #1309-swingx: WrappingProvider needs option to "highlight" the icon as well.
 */
public void interactiveIconTextAlignmentAndExtendsOpacity() {
    ListModel files = createFileListModel();
    final JXList list = new JXList(files);
    ComponentProvider<?> text = new LabelProvider(StringValues.FILE_NAME, JLabel.TRAILING);
    final WrappingProvider wrapper = new WrappingProvider(IconValues.FILE_ICON, text, true);
    wrapper.setExtendsComponentOpacity(true);
    list.setCellRenderer(new DefaultListRenderer(wrapper));
    list.addHighlighter(HighlighterFactory.createSimpleStriping());
    JXFrame frame =showWithScrollingInFrame(list, "alignment in wrappingProvider");
    Action action = new AbstractAction("toggle icon opacity") {
        
        @Override
        public void actionPerformed(ActionEvent e) {
            wrapper.setExtendsComponentOpacity(!wrapper.getExtendsComponentOpacity());
            list.repaint();
        }
    };
    addAction(frame, action);
    JLabel label = new JLabel(IconValues.FILE_ICON.getIcon(list.getElementAt(1)));
    addStatusComponent(frame, label);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:RendererVisualCheck.java

示例3: interactiveTableCompareFocusedCellBackground

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Compare core table using core default renderer vs. swingx default renderer.<p>
 * Unselected background of lead is different for editable/not-editable cells.
 */
@SuppressWarnings("deprecation")
public void interactiveTableCompareFocusedCellBackground() {
    TableModel model = new AncientSwingTeam() {
        @Override
        public boolean isCellEditable(int row, int column) {
            return column != 0;
        }
    };
    
    JTable xtable = new JTable(model);
    xtable.setBackground(HighlighterFactory.NOTEPAD); // ledger
    JTable table = new JTable(model);
    table.setBackground(new Color(0xF5, 0xFF, 0xF5)); // ledger
    TableCellRenderer renderer = new DefaultTableRenderer();
    table.setDefaultRenderer(Object.class, renderer);
    JXFrame frame = wrapWithScrollingInFrame(xtable, table, "JTable: Unselected focused background: core/ext renderer");
    addStatusComponent(frame, new JLabel("background for unselected lead: first column is not-editable"));    
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:24,代码来源:RendererVisualCheck.java

示例4: interactiveTableCustomColorRendererWithHighlighter

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Compare xtable using custom color renderer - standard vs. ext.<p>
 * Adds highlighter ... running amok.
 */
public void interactiveTableCustomColorRendererWithHighlighter() {
    TableModel model = new AncientSwingTeam();
    JXTable xtable = new JXTable(model);
    xtable.addHighlighter(
            HighlighterFactory.createSimpleStriping(HighlighterFactory.GENERIC_GRAY));
    xtable.setDefaultRenderer(Color.class, new ColorRenderer(true));
    JXTable table = new JXTable(model);
    table.addHighlighter(
            HighlighterFactory.createSimpleStriping(HighlighterFactory.GENERIC_GRAY));
    TableCellRenderer renderer = createColorRendererExt();
    table.setDefaultRenderer(Color.class, renderer);
    JXFrame frame = wrapWithScrollingInFrame(xtable, table, "JXTable/highlighter: Custom color renderer - standard/ext");
    addStatusMessage(frame, "Highlighter hide custom color renderer background for unselected");
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:RendererVisualCheck.java

示例5: interactiveTableCustomColorRendererWithHighlighterDontTouch

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Compare xtable using custom color renderer - standard vs. ext.<p>
 * Adds highlighter which respects renderer's dont touch.
 */
public void interactiveTableCustomColorRendererWithHighlighterDontTouch() {
    TableModel model = new AncientSwingTeam();
    JXTable xtable = new JXTable(model);
    Highlighter highlighter = createPropertyRespectingHighlighter(
            HighlighterFactory.createSimpleStriping(HighlighterFactory.GENERIC_GRAY));

    xtable.addHighlighter(highlighter);
    xtable.setDefaultRenderer(Color.class, new ColorRenderer(true));
    JXTable table = new JXTable(model);
    table.addHighlighter(highlighter);
    TableCellRenderer renderer = createColorRendererExt();
    table.setDefaultRenderer(Color.class, renderer);
    JXFrame frame = wrapWithScrollingInFrame(xtable, table, "JXTable/highlighter dont-touch: Custom color renderer - standard/ext");
    addStatusMessage(frame, "Highlighter doesn't touch custom color renderer visual properties");
    frame.pack();
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:22,代码来源:RendererVisualCheck.java

示例6: interactiveTableAndTreeCustomColorRenderingController

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * xtable/xlist using the same custom component controller.<p>
 * 
 */
public void interactiveTableAndTreeCustomColorRenderingController() {
    TableModel tableModel = new AncientSwingTeam();
    ComponentProvider<JLabel> controller = createColorRenderingLabelController();
    JXTable xtable = new JXTable(tableModel);
    xtable.setDefaultRenderer(Color.class, new DefaultTableRenderer(controller));
    TreeModel model = createTreeColorModel();
    JTree tree = new JTree(model);
    ComponentProvider<?> wrapper = new WrappingProvider(controller); //;createColorRenderingLabelController());
    TreeCellRenderer renderer = new DefaultTreeRenderer(wrapper);
    tree.setCellRenderer(renderer);
    JXFrame frame = wrapWithScrollingInFrame(xtable, tree, "JXTable/JXTree: Custom color renderer - sharing the component controller");
    addMessage(frame, "share provider in table and in wrappingProvider does not work?");
    frame.pack();
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:RendererVisualCheck.java

示例7: interactiveDropOnHierachicalColumnBlinks

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Issue #766-swingx: drop image is blinking over hierarchical column.
 * 
 * Core bug: <a
 * href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6700748">#6700748</a>
 * 
 * Hacks around, use one or other: 
 * - the usual performance optimization (override validate etc to do nothing) 
 * - rendering component return false on isVisible
 */
public void interactiveDropOnHierachicalColumnBlinks() {
    JXTreeTable xTable = new JXTreeTable(new ComponentTreeTableModel(
            new JXFrame()));
    installTransferHandler(xTable);
    xTable.putClientProperty(JXTreeTable.DROP_HACK_FLAG_KEY, Boolean.TRUE);
    xTable.expandAll();
    xTable.setVisibleColumnCount(10);
    JXFrame frame = wrapWithScrollingInFrame(xTable,
            "TreeTable hierarchical: blink on drop over?");
    JTextField textField = new JTextField(
            "drag me over hierarchical column ..");
    textField.setDragEnabled(true);
    addStatusComponent(frame, textField);
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:DNDRendererVisualCheck.java

示例8: interactiveDropOnPlainLabelTableBlinks

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Issue #766-swingx: drop image is blinking over hierarchical column.
 * 
 * Check plain JLabel as renderer in Table.
 */
public void interactiveDropOnPlainLabelTableBlinks() {
    JXTable xTable = new JXTable(new AncientSwingTeam());
    installTransferHandler(xTable);
    TableCellRenderer renderer = new TableCellRenderer() {
        JLabel label = new JLabel();
        public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {
            label.setText(String.valueOf(value));
            return label;
        }
        
    };
    xTable.getColumn(0).setCellRenderer(renderer);
    JXFrame frame = wrapWithScrollingInFrame(xTable,
    "Plain label as renderer: blink on drop over?");
    JTextField textField = new JTextField("drag me over first column....");
    textField.setDragEnabled(true);
    addStatusComponent(frame, textField);
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:DNDRendererVisualCheck.java

示例9: interactiveDropOnVisualsTable

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
     * Issue #370-swingx: drop-on not shown correctly.
     * 
     * Check core default renderer as renderer in Table.
     */
    public void interactiveDropOnVisualsTable() {
        JXTable xTable = new JXTable(new AncientSwingTeam());
        installTransferHandler(xTable);
        xTable.getColumn(0).setCellRenderer(new DefaultTableCellRenderer());
        JTable table = new JTable(new AncientSwingTeam());
        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,
                "JXTable (first column core renderer) <-> core table: 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

示例10: interactiveDropOnVisualsList

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
     * Issue #370-swingx: drop-on not shown correctly.
     * 
     * Check core default renderer as renderer in Table.
     */
    public void interactiveDropOnVisualsList() {
        JXList xTable = new JXList(AncientSwingTeam.createNamedColorListModel());
        installTransferHandler(xTable);
        JList table = new JList(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,
                "JXList <-> core list: drop-on appearance");
        JTextField textField = new JTextField("drag me over first column....");
        textField.setDragEnabled(true);
        addStatusComponent(frame, textField);
        show(frame);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:22,代码来源:DNDRendererVisualCheck.java

示例11: interactiveDropOnVisualsTree

import org.jdesktop.swingx.JXFrame; //导入依赖的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

示例12: interactiveIconPainterHighlight

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Use highlighter with background image painter. Shared by table and list.
 */
public void interactiveIconPainterHighlight() throws Exception {
    TableModel model = new AncientSwingTeam();
    JXTable table = new JXTable(model);
    ComponentProvider<JLabel> controller = new LabelProvider(
            JLabel.RIGHT);
    table.getColumn(0).setCellRenderer(
            new DefaultTableRenderer(controller));
    final ImagePainter imagePainter = new ImagePainter(XTestUtils.loadDefaultImage());
    HighlightPredicate predicate = new ColumnHighlightPredicate(0);
    Highlighter iconHighlighter = new PainterHighlighter(predicate, imagePainter );
    Highlighter alternateRowHighlighter = HighlighterFactory.createSimpleStriping();
    table.addHighlighter(alternateRowHighlighter);
    table.addHighlighter(iconHighlighter);
    // re-use component controller and highlighter in a JXList
    JXList list = new JXList(createListNumberModel(), true);
    list.setCellRenderer(new DefaultListRenderer(controller));
    list.addHighlighter(alternateRowHighlighter);
    list.addHighlighter(iconHighlighter);
    list.toggleSortOrder();
    final JXFrame frame = showWithScrollingInFrame(table, list,
            "image highlighting plus striping");
    frame.pack();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:PainterVisualCheck.java

示例13: interactiveValueBasedGradientHighlightPlusStriping

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
     * Use transparent gradient painter for value-based background highlighting
     * with SwingX extended default renderer. Shared by table and list with
     * striping.
     */
    public void interactiveValueBasedGradientHighlightPlusStriping() {
        TableModel model = new AncientSwingTeam();
        JXTable table = new JXTable(model);
        ComponentProvider<JLabel> controller = new LabelProvider(
                JLabel.RIGHT) ;
        RelativePainterHighlighter gradientHighlighter = 
            createRelativeGradientHighlighter(HorizontalAlignment.RIGHT, 100);
        table.addHighlighter(gradientHighlighter);
        Highlighter alternateRowHighlighter = HighlighterFactory.createSimpleStriping();
        table.addHighlighter(alternateRowHighlighter);
        table.addHighlighter(gradientHighlighter);
        // re-use component controller and highlighter in a JXList
        JXList list = new JXList(createListNumberModel(), true);
        list.setCellRenderer(new DefaultListRenderer(controller));
        list.addHighlighter(alternateRowHighlighter);
        list.addHighlighter(gradientHighlighter);
        list.toggleSortOrder();
        final JXFrame frame = wrapWithScrollingInFrame(table, list,
                "transparent value relative highlighting plus striping");
        addStatusMessage(frame,
                "uses a PainterAwareLabel in renderer");
        // crude binding to play with options - the factory is incomplete...
//        addStatusComponent(frame, createTransparencyToggle(gradientHighlighter));
//        show(frame);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:31,代码来源:PainterVisualCheck.java

示例14: interactiveXTreeLabelFormattingHighlighter

import org.jdesktop.swingx.JXFrame; //导入依赖的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

示例15: interactiveCompareTreeExtTreeColors

import org.jdesktop.swingx.JXFrame; //导入依赖的package包/类
/**
 * Custom tree colors in JTree. Compare core default renderer with Swingx
 * default renderer.
 * 
 */
public void interactiveCompareTreeExtTreeColors() {
    JTree xtree = new JTree();
    Color background = Color.MAGENTA;
    Color foreground = Color.YELLOW;
    xtree.setBackground(background);
    xtree.setForeground(foreground);
    DefaultTreeCellRenderer coreTreeCellRenderer = new DefaultTreeCellRenderer();
    // to get a uniform color on both tree and node
    // the core default renderer needs to be configured
    coreTreeCellRenderer.setBackgroundNonSelectionColor(background);
    coreTreeCellRenderer.setTextNonSelectionColor(foreground);
    xtree.setCellRenderer(coreTreeCellRenderer);
    JTree tree = new JTree();
    tree.setBackground(background);
    tree.setForeground(foreground);
    // swingx renderer uses tree colors
    tree.setCellRenderer(xTreeRenderer);
    final JXFrame frame = wrapWithScrollingInFrame(xtree, tree,
            "custom tree colors - core vs. ext renderer");
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:TreeRendererTest.java


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