本文整理汇总了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();
}
}
}
}
示例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();
}
}
}
}
示例3: getHomeDirectory
import com.googlecode.vfsjfilechooser2.utils.SwingCommonsUtilities; //导入依赖的package包/类
/**
*
* @return
*/
public FileObject getHomeDirectory()
{
return SwingCommonsUtilities.getVFSFileChooserDefaultDirectory();
}
示例4: actionPerformed
import com.googlecode.vfsjfilechooser2.utils.SwingCommonsUtilities; //导入依赖的package包/类
public void actionPerformed(ActionEvent e)
{
FileObject fo = SwingCommonsUtilities.getVFSFileChooserDefaultDirectory();
fileChooser.setCurrentDirectoryObject(fo);
}
示例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);
}
}