⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewerpopup.java

📁 JavaExplorer是一个独立于平台的浏览器
💻 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.internal.*;import javaexplorer.gui.listener.*;import javaexplorer.model.*;import javaexplorer.ressource.*;import javax.swing.*;/** *@author     BOESCH Vincent *@created    21 janvier 2002 *@version    3.3 */public class ViewerPopup extends JPopupMenu implements ActionListener {    private JInternalViewerFrame _jivf = null;    private JMenuItem _jmiClose = new JMenuItem(TextRessource.MAINFRAME_MENU_CLOSE,            ImageRessource.iiCloseThb);    private JMenuItem _jmiDelete = new JMenuItem(TextRessource.MAINFRAME_MENU_DELETE,            ImageRessource.iiDeleteThb);    private JMenuItem _jmiFake = new JMenuItem();    private JMenuItem _jmiZoom = new JMenuItem(TextRessource.MAINFRAME_TOOLBAR_ZOOM_TOOLTIP,            ImageRessource.iiZoomThb);    private JMenuItem _jmiZoomFit = new JMenuItem(TextRessource.MAINFRAME_TOOLBAR_ZOOMFIT_TOOLTIP,            ImageRessource.iiZoomFitThb);    private JMenuItem _jmiZoomIn = new JMenuItem(TextRessource.MAINFRAME_TOOLBAR_ZOOMIN_TOOLTIP,            ImageRessource.iiZoomInThb);    private JMenuItem _jmiZoomOut = new JMenuItem(TextRessource.MAINFRAME_TOOLBAR_ZOOMOUT_TOOLTIP,            ImageRessource.iiZoomOutThb);    private JMenuItem _jmiPrev = new JMenuItem(TextRessource.MAINFRAME_TOOLBAR_FILEPREV_TOOLTIP,            ImageRessource.iiPrev);    private JMenuItem _jmiNext = new JMenuItem(TextRessource.MAINFRAME_TOOLBAR_FILENEXT_TOOLTIP,            ImageRessource.iiNext);    private Launcher _launcher = null;    private MenuListener ml = new MenuListener();    /**     *  Constructeur objet ImagePopup     *     *@param  launcher  Description of the     *      Parameter     */    public ViewerPopup(Launcher launcher) {        super();        _launcher = launcher;        setBorderPainted(true);        _jmiZoom.addActionListener(this);        _jmiZoom.addMouseListener(ml);        _jmiZoomFit.addActionListener(this);        _jmiZoomFit.addMouseListener(ml);        _jmiZoomIn.addActionListener(this);        _jmiZoomIn.addMouseListener(ml);        _jmiZoomOut.addActionListener(this);        _jmiZoomOut.addMouseListener(ml);        _jmiClose.addActionListener(this);        _jmiClose.addMouseListener(ml);        _jmiDelete.addActionListener(this);        _jmiDelete.addMouseListener(ml);        _jmiPrev.addActionListener(this);        _jmiPrev.addMouseListener(ml);        _jmiNext.addActionListener(this);        _jmiNext.addMouseListener(ml);        _jmiFake.addActionListener(this);        Font f = _jmiFake.getFont();        _jmiFake.setFont(new Font(f.getName(), Font.BOLD, f.getSize() + 1));        add(_jmiFake);        addSeparator();        add(_jmiZoom);        add(_jmiZoomIn);        add(_jmiZoomOut);        addSeparator();        add(_jmiDelete);        addSeparator();        add(_jmiPrev);        add(_jmiNext);        addSeparator();        add(_jmiClose);    }    /**     *  Description de la methode     *     *@param  e  Description of the Parameter     */    public void actionPerformed(ActionEvent e) {        Object obj = e.getSource();        if (obj == _jmiZoom) {            _launcher.getMDIModel().changeResolution(_jivf, 0);        } else if (obj == _jmiZoomIn) {            _launcher.getMDIModel().changeResolution(_jivf, 1);        } else if (obj == _jmiZoomOut) {            _launcher.getMDIModel().changeResolution(_jivf, -1);        } else if (obj == _jmiClose) {            _launcher.getMDIModel().closeFrame(_jivf);        } else if (obj == _jmiDelete) {            XFile f = _jivf.getViewer().getXFile();            _launcher.getMDIModel().closeFrame(_jivf);            if (f.exists()) {                f.remove();            }            _launcher.getMDIModel().refreshDisks(f);        } else if (obj == _jmiPrev) {            _launcher.getMDIModel().changeFile(_jivf, true);        } else if (obj == _jmiNext) {            _launcher.getMDIModel().changeFile(_jivf, false);        }        this.setVisible(false);    }    /**     *  Description de la methode     */    public void refreshLanguage() {        _jmiZoom.setText(TextRessource.MAINFRAME_TOOLBAR_ZOOM_TOOLTIP);        _jmiZoomFit.setText(TextRessource.MAINFRAME_TOOLBAR_ZOOMFIT_TOOLTIP);        _jmiZoomIn.setText(TextRessource.MAINFRAME_TOOLBAR_ZOOMIN_TOOLTIP);        _jmiZoomOut.setText(TextRessource.MAINFRAME_TOOLBAR_ZOOMOUT_TOOLTIP);        _jmiClose.setText(TextRessource.MAINFRAME_MENU_CLOSE);        _jmiDelete.setText(TextRessource.MAINFRAME_MENU_DELETE);    }    /**     *  Sets the frame attribute of the ImagePopup     *  object     *     *@param  jivf  The new frame value     */    public void setFrame(JInternalViewerFrame jivf) {        _jivf = jivf;        if (_jivf == null) {            return;        }        _jmiFake.setText(_jivf.getViewer().getXFile().getName());        setVisible(true);    }    /**     *  Sets the launcher attribute of the     *  ImagePopup object     *     *@param  launcher  The new launcher value     */    public void setLauncher(Launcher launcher) {        _launcher = launcher;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -