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

📄 stringwrapper.java

📁 SWING的界面UI包 SWING的界面UI包
💻 JAVA
字号:
/* * StringSourceCoder.java * * Created on 2007-9-15, 22:07:52 * * To change this template, choose Tools | Templates * and open the template in the editor. */package dyno.swing.designer.properties.wrappers.primitive;import dyno.swing.designer.properties.ValidationException;import dyno.swing.designer.properties.wrappers.*;import java.io.BufferedReader;import java.io.StringReader;/** * * @author William Chen */public class StringWrapper implements Encoder, Decoder, SourceCoder {    @Override    public String getJavaCode(Object value) {        if (value == null) {            return "null";        } else {            return "\"" + replaceCR((String) value) + "\"";        }    }    String replaceCR(String string) {        try {            StringReader r = new StringReader(string);            BufferedReader br = new BufferedReader(r);            String line;            String code = "";            int count=0;            while ((line = br.readLine()) != null) {                if(count!=0)                    code+="\\n";                code += line;                count++;            }            return code;        } catch (Exception e) {            e.printStackTrace();            return string;        }    }    public String encode(Object v) {        return (String)v;    }    public Object decode(String txt) {        return txt;    }    public void validate(String txt) throws ValidationException {    }}

⌨️ 快捷键说明

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