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


Java SwingCommonsUtilities类代码示例

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


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

示例1: mouseClicked

import com.googlecode.vfsjfilechooser2.utils.SwingCommonsUtilities; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent evt) {
    // System.out.println("count2:" + evt.getClickCount());

    // Note: we can't depend on evt.getSource() because of backward
    // compatability
    if ((list != null) && SwingUtilities.isLeftMouseButton(evt)
            && (evt.getClickCount() == 2)) {
        int index = SwingCommonsUtilities.loc2IndexFileList(list,
                evt.getPoint());

        if (index >= 0) {
            FileObject f = (FileObject) list.getModel()
                    .getElementAt(index);

            if (getFileChooser().isTraversable(f)) {
                list.clearSelection();
                changeDirectory(f);
            } else {
                getFileChooser().approveSelection();
            }
        }
    }
}
 
开发者ID:shevek,项目名称:vfsjfilechooser,代码行数:25,代码来源:BasicVFSFileChooserUI.java

示例2: mouseClicked

import com.googlecode.vfsjfilechooser2.utils.SwingCommonsUtilities; //导入依赖的package包/类
public void mouseClicked(MouseEvent evt)
{
    // System.out.println("count2:" + evt.getClickCount());

    // Note: we can't depend on evt.getSource() because of backward
    // compatability
    if ((list != null) && SwingUtilities.isLeftMouseButton(evt) &&
            (evt.getClickCount() == 2))
    {
        int index = SwingCommonsUtilities.loc2IndexFileList(list,
                evt.getPoint());

        if (index >= 0)
        {
            FileObject f = (FileObject) list.getModel()
                                            .getElementAt(index);

            if (getFileChooser().isTraversable(f))
            {
                list.clearSelection();
                changeDirectory(f);
            }
            else
            {
                getFileChooser().approveSelection();
            }
        }
    }
}
 
开发者ID:fracpete,项目名称:vfsjfilechooser2,代码行数:30,代码来源:BasicVFSFileChooserUI.java

示例3: getHomeDirectory

import com.googlecode.vfsjfilechooser2.utils.SwingCommonsUtilities; //导入依赖的package包/类
/**
 *
 * @return
 */
public FileObject getHomeDirectory()
{
    return SwingCommonsUtilities.getVFSFileChooserDefaultDirectory();
}
 
开发者ID:fracpete,项目名称:vfsjfilechooser2,代码行数:9,代码来源:AbstractVFSFileSystemView.java

示例4: actionPerformed

import com.googlecode.vfsjfilechooser2.utils.SwingCommonsUtilities; //导入依赖的package包/类
public void actionPerformed(ActionEvent e)
{
    FileObject fo = SwingCommonsUtilities.getVFSFileChooserDefaultDirectory();
    fileChooser.setCurrentDirectoryObject(fo);
}
 
开发者ID:fracpete,项目名称:vfsjfilechooser2,代码行数:6,代码来源:DefaultAccessoriesPanel.java

示例5: mouseClicked

import com.googlecode.vfsjfilechooser2.utils.SwingCommonsUtilities; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent evt) {
    JComponent source = (JComponent) evt.getSource();

    int index;

    if (source instanceof JList) {
        index = SwingCommonsUtilities.loc2IndexFileList(list,
                evt.getPoint());
    } else if (source instanceof JTable) {
        JTable table = (JTable) source;
        Point p = evt.getPoint();
        index = table.rowAtPoint(p);

        if (SwingCommonsUtilities.pointOutsidePrefSize(table, index,
                table.columnAtPoint(p), p)) {
            return;
        }

        // Translate point from table to list
        if ((index >= 0) && (list != null)
                && listSelectionModel.isSelectedIndex(index)) {
            // Make a new event with the list as source, placing the
            // click in the corresponding list cell. 
            Rectangle r = list.getCellBounds(index, index);
            evt = new MouseEvent(list, evt.getID(), evt.getWhen(),
                    evt.getModifiers(), r.x + 1, r.y + (r.height / 2),
                    evt.getClickCount(), evt.isPopupTrigger(),
                    evt.getButton());
        }
    } else {
        return;
    }

    if ((index >= 0) && SwingUtilities.isLeftMouseButton(evt)) {
        VFSJFileChooser fc = getFileChooser();

        // For single click, we handle editing file name
        if ((evt.getClickCount() == 1) && source instanceof JList) {
            if ((!fc.isMultiSelectionEnabled()
                    || (fc.getSelectedFiles().length <= 1))
                    && (index >= 0)
                    && listSelectionModel.isSelectedIndex(index)
                    && (getEditIndex() == index) && (editFile == null)) {
                editFileName(index);
            } else {
                if (index >= 0) {
                    setEditIndex(index);
                } else {
                    resetEditIndex();
                }
            }
        } else if (evt.getClickCount() == 2) {
            // System.out.println("double click");

            // on double click (open or drill down one directory) be
            // sure to clear the edit index
            resetEditIndex();
        }
    }

    // Forward event to Basic
    if (getDoubleClickListener() != null) {
        getDoubleClickListener().mouseClicked(evt);
    }
}
 
开发者ID:shevek,项目名称:vfsjfilechooser,代码行数:67,代码来源:VFSFilePane.java


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