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

📄 jtextviewer.java

📁 JavaExplorer是一个独立于平台的浏览器
💻 JAVA
字号:
/**  * XFile 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.viewer;import java.awt.*;//import java.io.*;import javaexplorer.Launcher;import javaexplorer.gui.listener.ViewerListener;import javaexplorer.model.XFile;import javaexplorer.util.ExplorerUtil;import javax.swing.*;public class JTextViewer extends JScrollPane implements Viewer {    private Font _defaultFont = new Font("Arial", Font.PLAIN, 10);    private XFile _xfile = null;    private JTextArea _jtaText = new JTextArea();    private Launcher _launcher = null;    /**     *  Constructor for the JTextViewer object     */    public JTextViewer() {        super();        _jtaText.setEditable(true);        _jtaText.setForeground(Color.blue);        _jtaText.setFont(_defaultFont);        JPanel p = new JPanel();        //p.setBackground(Color.white);        p.setLayout(new BorderLayout());        p.add(_jtaText, BorderLayout.CENTER);        getViewport().add(p);    }    /**     *  Adds a feature to the ViewerListener     *  attribute of the JTextViewer object     *     *@param  vl  The feature to be added to     *      the ViewerListener attribute     */    public void addViewerListener(ViewerListener vl) {        _jtaText.addMouseListener(vl);    }    /**     *  Description of the Method     *     *@param  e_zoomFactor  Description of     *      Parameter     */    public void applyZoom(int e_zoomFactor) {        Font f = _jtaText.getFont();        switch (e_zoomFactor) {        case ExplorerUtil.ZOOM_IN:            f = new Font(f.getName(), f.getStyle(), f.getSize() + 1);            break;        case ExplorerUtil.ZOOM_OUT:            f = new Font(f.getName(), f.getStyle(), Math.max(f.getSize() - 1, 2));            break;        default:        case ExplorerUtil.ZOOM_FIT:        case ExplorerUtil.ZOOM_NO:            f = _defaultFont;            break;        }        _jtaText.setFont(f);    }    /**     *  Description of the Method     *     *@param  text  Description of Parameter     */    private void displayText(String text) {        _jtaText.setText(text);        _jtaText.setCaretPosition(0);        repaint();    }    /**     */    public void freeRessource() {    }    /**     *  Gets the XFile attribute of the JTextViewer     *  object     *     *@return    The XFile value     */    public XFile getXFile() {        return _xfile;    }    /**     * Retourne le texte contenu dans le buffer de visu     * (si modifi

⌨️ 快捷键说明

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