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


Java JXTree.setEditable方法代码示例

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


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

示例1: interactiveTreeEditingRToLDatePicker

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * visualize datepicker editing of the hierarchical column, both
 * in a tree and a xTree switching CO.
 *
 * standard editor
 */
public void interactiveTreeEditingRToLDatePicker() {
    TreeModel model = createTreeModelWithDates();
    JTree tree =  new JTree(model); 
    tree.setEditable(true);
    tree.setCellEditor(new DefaultTreeCellEditor(tree, null, new DatePickerCellEditor()));
    JXTree xTree = new JXTree(model);
    xTree.setEditable(true);
    xTree.setCellEditor(new DefaultTreeCellEditor(tree, null, new DatePickerCellEditor()));
    final JXFrame frame = wrapWithScrollingInFrame(tree, xTree, "standard Editing (DatePicker): compare tree and xtree");
    addComponentOrientationToggle(frame);
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:DatePickerCellEditorVisualCheck.java

示例2: interactiveXTreeEditingRToLDatePicker

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * visualize date picker editing of the hierarchical column, both
 * in a tree and a xTree switching CO.
 * using DefaultXTreeCellEditor.
 */
public void interactiveXTreeEditingRToLDatePicker() {
    TreeModel model = createTreeModelWithDates();
    JTree tree =  new JTree(model); 
    tree.setEditable(true);
    tree.setCellEditor(new DefaultXTreeCellEditor(tree, null, new DatePickerCellEditor()));
    JXTree xTree = new JXTree(model);
    xTree.setEditable(true);
    xTree.setCellEditor(new DefaultXTreeCellEditor(xTree, null, new DatePickerCellEditor()));
    final JXFrame frame = wrapWithScrollingInFrame(tree, xTree, "XEditing(DatePicker): compare tree and xtree");
    addComponentOrientationToggle(frame);
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:18,代码来源:DatePickerCellEditorVisualCheck.java

示例3: createTree

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
public static JComponent createTree() {
    JTree jtree = new JTree();
    JXTree tree = new JXTree(jtree.getModel());
    tree.setEditable(true);

    // Stuff the action map.
    ActionMap map = tree.getActionMap();
    Action action = new MyAction("print", "Print on JTree");
    map.put(action.getValue(Action.NAME), action);
    action = new MyAction("find", "Find on JTree");
    map.put(action.getValue(Action.NAME), action);

    return tree;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:TargetableActionTest.java

示例4: interactiveTransparentRenderer

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
public void interactiveTransparentRenderer() throws IOException {
    final JXTree tree = new JXTree(new ComponentTreeTableModel(new JXFrame()));
    tree.setEditable(true);
    StringValue sv = new StringValue() {

        public String getString(Object value) {
            if (value instanceof Component) {
                return ((Component) value).getName();
            }
            return " - no component - ";
        }};
    DefaultTreeRenderer renderer = new DefaultTreeRenderer(sv);
    tree.setCellRenderer(renderer);
    tree.setForeground(Color.WHITE);
    JXPanel panel = new JXPanel(new BorderLayout());
    ImagePainter imagePainter = new ImagePainter(XTestUtils.loadDefaultImage()); 
    imagePainter.setFillHorizontal(true);
    imagePainter.setFillVertical(true);
    panel.setBackgroundPainter(imagePainter);
    panel.add(new JScrollPane(tree));
    
    JXFrame frame = wrapInFrame(panel, "renderer");
    WrappingProvider provider = (WrappingProvider) renderer.getComponentProvider();
    provider.getWrappee().getRendererComponent(null).setOpaque(false);
    tree.setOpaque(false);
    ((JComponent) tree.getParent()).setOpaque(false);
    ((JComponent) tree.getParent().getParent()).setOpaque(false);
    Action edit = new AbstractActionExt("edit") {

        public void actionPerformed(ActionEvent e) {
            if (tree.isSelectionEmpty()) return;
            TreePath path = tree.getSelectionPath();
            Component comp = (Component) path.getLastPathComponent();
            String oldName = comp.getName();
            if (oldName == null) {
                oldName = "none";
            }
            String changed = oldName.length() > 60 ? oldName.substring(0, 20) :
                oldName + "+++++++++++++++++++++++++++++++++++++++++++++";
            tree.getModel().valueForPathChanged(path, changed);
        }
        
    };
    addAction(frame, edit);
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:47,代码来源:TreeRendererIssues.java

示例5: interactiveDatePickerCellEditorXTree

import org.jdesktop.swingx.JXTree; //导入方法依赖的package包/类
/**
 * Issue ??-swingx: picker cell editor popup commit/cancel 
 * transfers focus out-off the tree (1.5)
 * 
 * 
 * a) commit by keyboard - commit okay but focus moved where?
 * b) click into popup to commit - did not commit. 
 *    Now fixed (CellEditorRemover copes with popup) okay committed, 
 *    but focus where (as in a)?
 * c) click on month navigation - editing canceled fixed. 
 * d) click in month navigation, then cancel by keyboard - 
 *    focus where?
 *    
 * focus handling is done in BasicTreeUI.completeEditing - and
 * does not cope with popup. All termination is done in uidelegate,
 * no central method in the tree called.
 *      
 * independent on stopCellEditing flag - semantic in tree is
 * different from semantic in table (first is "how" to terminate, 
 * second is "if" to terminate)  
 *    
 */
public void interactiveDatePickerCellEditorXTree() {
    final JXTree tree = new JXTree(createTreeModelWithDates());
    tree.setEditable(true);
    tree.setCellEditor(new DefaultXTreeCellEditor(tree, null, new DatePickerCellEditor()));
    Action action = new AbstractAction("toggle terminate") {

        public void actionPerformed(ActionEvent e) {
            tree.setInvokesStopCellEditing(!tree.getInvokesStopCellEditing());
            
        }
        
    };
    JXFrame frame = wrapWithScrollingInFrame(tree, "JXTree - date picker cell editor");
    addAction(frame, action);
    frame.add(new JTextField("yet another thing to focus"), BorderLayout.SOUTH);
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:40,代码来源:DatePickerCellEditorVisualCheck.java


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