📄 form.java
字号:
package com.cownew.uidesigner.model;import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.util.ArrayList;import java.util.List;public class Form extends Element{ static final long serialVersionUID = 1; public static String COMPONENTS = "components"; protected List<Component> components = new ArrayList<Component>(); public void addComponent(Component component) { components.add(component); fireStructureChange(COMPONENTS, components); } public void removeComponent(Component component) { components.remove(component); fireStructureChange(COMPONENTS, components); } public List<Component> getComponents() { return this.components; } public InputStream getAsStream() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(os); out.writeObject(this); out.close(); InputStream istream = new ByteArrayInputStream(os.toByteArray()); os.close(); return istream; } public static Form makeFromStream(InputStream istream) throws IOException, ClassNotFoundException { ObjectInputStream ois = new ObjectInputStream(istream); Form form = (Form) ois.readObject(); ois.close(); return form; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -