?? dndpopup.java
字號:
/** * File and FTP Explorer * Copyright 2002 * BOESCH Vincent * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package javaexplorer.gui.menu;import java.awt.*;import java.awt.event.*;import javaexplorer.Launcher;import javaexplorer.gui.listener.*;import javaexplorer.model.*;import javaexplorer.ressource.*;import javaexplorer.util.XFileBuffer;import javax.swing.*;/** *@author BOESCH Vincent *@created 21 janvier 2002 *@version 3.3 */public class DNDPopup extends JPopupMenu implements ActionListener { private XFile _dropDir = null; DropRunner _dropRun = new DropRunner(); private JMenuItem _jmiCancel = new JMenuItem(TextRessource.MAINFRAME_GLOBAL_CANCEL, ImageRessource.iiStop); private JMenuItem _jmiCopy = new JMenuItem(TextRessource.MAINFRAME_GLOBAL_COPY, ImageRessource.iiCopyThb); private JMenuItem _jmiMove = new JMenuItem(TextRessource.MAINFRAME_GLOBAL_MOVE, ImageRessource.iiCutThb); private JMenuItem _jmiFake = new JMenuItem(); private Launcher _launcher = null; private XFile[] _tb_xf = null; Thread _thdDrop = null; private MenuListener ml = new MenuListener(); /** * Constructeur objet DNDPopup * *@param launcher Lanceur de rattachement */ public DNDPopup(Launcher launcher) { super(); _launcher = launcher; setBorderPainted(true); _jmiCopy.addActionListener(this); _jmiCopy.addMouseListener(ml); _jmiMove.addActionListener(this); _jmiMove.addMouseListener(ml); _jmiCancel.addActionListener(this); _jmiCancel.addMouseListener(ml); _jmiFake.addActionListener(this); Font f = _jmiFake.getFont(); _jmiFake.setFont(new Font(f.getName(), Font.BOLD, f.getSize() + 1)); add(_jmiFake); addSeparator(); add(_jmiCopy); add(_jmiMove); addSeparator(); add(_jmiCancel); } /** * Impl閙entation de l'interface ActionListener * *@param e Description of the Parameter */ public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); boolean perform = false; boolean forMove = false; if (obj == _jmiCopy) { perform = true; } else if (obj == _jmiMove) { perform = true; forMove = true; } this.setVisible(false); //Traitements encapsul閟 dans un Thread pour ne pas bloquer le rafraichissement if (perform) { if (_thdDrop != null) { try { _thdDrop.join(); } catch (InterruptedException ie) { _thdDrop = null; } } _dropRun.setParameters(_tb_xf, forMove, _dropDir); _thdDrop = new Thread(_dropRun); _thdDrop.setPriority(Thread.MIN_PRIORITY); _thdDrop.start(); } } /** * Mise
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -