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

📄 j2dareaadapter.java

📁 SWING的界面UI包 SWING的界面UI包
💻 JAVA
字号:
/*
 * JTextAreaAdapter.java
 *
 * Created on 2007年8月15日, 下午11:48
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package dyno.swing.designer.beans.adapters.component;

import dyno.swing.designer.beans.DesignerEditor;
import dyno.swing.designer.beans.SwingDesigner;
import dyno.swing.designer.beans.editors.TextAreaEditor;
import dyno.swing.designer.properties.ValidationException;

import java.awt.Component;
import java.awt.Rectangle;

import javax.swing.text.JTextComponent;


/**
 *
 * @author William Chen
 */
public class J2DAreaAdapter extends CompositeComponentAdapter {
    protected DesignerEditor designerEditor = new TextAreaEditor();

    /** Creates a new instance of JTextAreaAdapter */
    public J2DAreaAdapter(SwingDesigner designer, Component component) {
        super(designer, component);
    }

    public DesignerEditor getDesignerEditor(int x, int y) {
        return designerEditor;
    }

    public void validateBeanValue(Object value)
        throws ValidationException {
    }

    public void setBeanValue(Object value) {
        JTextComponent textArea = (JTextComponent) component;
        textArea.setText((String) value);
        textArea.setCaretPosition(0);
    }

    public Object getBeanValue() {
        JTextComponent textArea = (JTextComponent) component;

        return textArea.getText();
    }

    public Rectangle getEditorBounds(int x, int y) {
        Rectangle bounds = component.getBounds();
        bounds.x = 1;
        bounds.y = 1;
        bounds.width -= 1;
        bounds.height -= 1;

        return bounds;
    }
}

⌨️ 快捷键说明

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