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

📄 jtextcomponent.java

📁 纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统
💻 JAVA
字号:
/* class JTextComponent
 *
 * Copyright (C) 2001  R M Pitman
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package charvax.swing.text;

import charvax.swing.JComponent;

/**
 * JTextComponent is a much-simplified version of the Swing
 * java.swing.text.JTextComponent class, and is the base class 
 * for JTextArea.
 */
public abstract class JTextComponent
    extends JComponent
{
    public JTextComponent()
    {
    }

    public String getDocument() 
    { 
	return _document.toString(); 
    }

    public void setDocument(String document_) 
    { 
	_document = new StringBuffer(document_); 
    }

    public synchronized String getText() {
	return _document.toString();
    }

    public synchronized void setText(String text_)
    {
	_document = new StringBuffer(text_);
    }

    public int getCaretPosition()
    {
	return _caretPosition;
    }

    public void setCaretPosition(int caret_)
    {
	_caretPosition = caret_;
    }

    /** Returns the boolean flag indicating whether this TextComponent
     * is editable or not.
     */
    public boolean isEditable() { return _editable; }

    /**
     * Sets the boolean that indicates whether this TextComponent should be
     * editable or not.
     */
    public void setEditable(boolean editable_)
    {
	_editable = editable_;
    }

    //====================================================================
    // INSTANCE VARIABLES

    /** Index (from the start of the string) where next character will 
     * be inserted.
     */
    protected int _caretPosition;

    protected StringBuffer _document;

    protected boolean _editable = true;
}

⌨️ 快捷键说明

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