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

📄 button.java

📁 基于eclipse的工具开发代码
💻 JAVA
字号:
package com.cownew.uidesigner.components.button;

import java.util.ArrayList;
import java.util.List;

import com.cownew.ctk.common.StringUtils;
import com.cownew.uidesigner.common.CodeGenUtils;
import com.cownew.uidesigner.model.AbstractButton;

public class Button extends AbstractButton
{
	private static final long serialVersionUID = 1L;

	public List<String> generateCode(String parentId)
	{
		List<String> list = new ArrayList<String>();
		StringBuffer line1 = new StringBuffer();
		line1.append("JButton ").append(getId()).append("= new JButton(")
				.append(StringUtils.doubleQuoted(getText())).append(");");

		list.add(line1.toString());

		StringBuffer line2 = new StringBuffer();
		line2.append(getId()).append(".setBounds(").append(
				CodeGenUtils.translateBounds(getBounds())).append(");");

		list.add(line2.toString());

		StringBuffer line3 = new StringBuffer();
		line3.append(parentId).append(".add(").append(getId()).append(");");

		list.add(line3.toString());

		return list;
	}

}

⌨️ 快捷键说明

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