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

📄 stringeditor.java

📁 SWING的界面UI包 SWING的界面UI包
💻 JAVA
字号:
/*
 * TextEditor.java
 *
 * Created on 2007年8月13日, 上午9:53
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package dyno.swing.designer.properties.editors;

import dyno.swing.designer.properties.ValidationException;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.JTextField;


/**
 *
 * @author William Chen
 */
public class StringEditor extends AbstractPropertyEditor {
    private JPanel panel;
    private JTextField textField;

    /** Creates a new instance of TextEditor */
    public StringEditor() {
        panel = new JPanel(new BorderLayout());
        textField = new JTextField();
        panel.add(textField, BorderLayout.CENTER);
        textField.setBorder(null);
        textField.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    firePropertyChanged();
                }
            });
    }

    public void setValue(Object value) {
        textField.setText((String) value);
    }

    public Object getValue() {
        return textField.getText();
    }

    public Component getCustomEditor() {
        return panel;
    }

    @Override
    public void validateValue() throws ValidationException {
    }
}

⌨️ 快捷键说明

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