`
sdyouyun
  • 浏览: 119275 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

InstallAnyWhere中,自定义面板的一个例子

阅读更多
自定义面板需要依赖于InstallAnyWhere的主jar包IAClasses.zip。
package com.cvicse.inforguard.install;

import java.awt.Color;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;

import com.zerog.ia.api.pub.CustomCodePanel;
import com.zerog.ia.api.pub.CustomCodePanelProxy;

public class EnCompentPanel extends CustomCodePanel implements ActionListener {
    private static final long serialVersionUID = 1222L;
    private boolean inited = false;

    private JLabel jLabelInfor = null;
    private JLabel jLabelError = null;
    private JCheckBox jCheckBoxMC = null;
    private JCheckBox jCheckBoxConsole = null;
    private JTextPane jTextPaneInfor = null;
    //资源类,存放了所有的文字提示信息
    public iRes res = null;

    public EnCompentPanel() {
	//得到一个英文的资源类
	res = new ResEnglish();
    }

    public boolean setupUI(CustomCodePanelProxy customCodePanelProxy) {
	if (inited == true)
	    return true;
	inited = true;
	//在面板下方,显示错误提示信息的label
	jLabelError = new JLabel();
	jLabelError.setBounds(new Rectangle(15, 185, 300, 18));
	jLabelError.setText("");
	
	//jLabelInfor是面板最上方的信息提示框
	jLabelInfor = new JLabel();
	jLabelInfor.setBounds(new Rectangle(5, 5, 377, 110));
	jLabelInfor.setVerticalTextPosition(SwingConstants.TOP);
	jLabelInfor.setVerticalAlignment(SwingConstants.TOP);
	jLabelInfor.setText("");
	jLabelInfor.setBorder(BorderFactory.createLineBorder(Color.GRAY));
	
	//面板的默认宽、高
	this.setSize(404, 310);
	this.setLayout(null);
	//将用到的控件都添加到面板中去
	this.add(jLabelInfor, null);
	this.add(jLabelError, null);
	this.add(getJCheckBoxMC(), null);
	this.add(getJCheckBoxConsole(), null);
	this.add(getJTextPaneInfor(), null);

	return true;
    }

    public void panelIsDisplayed() {
    }

    //点击下一步按钮时触发的事件,返回true时可以进入下一步,返回false时停留在本页面
    public boolean okToContinue() {
	if (!jCheckBoxMC.isSelected()) {
	    if (!jCheckBoxConsole.isSelected()) {
		jLabelError.setText(res.getComponentjLabelErrorText());
		return false;
	    }
	} else {
	    jLabelError.setText("");
	}
	
	//以下一段设置InstallAnyWhere中的环境变量
	if (jCheckBoxMC.isSelected()) {
	    customCodePanelProxy.setVariable("mc", "mcSelect");
	} else {
	    customCodePanelProxy.setVariable("mc", "mcNotSelect");
	}
	if (jCheckBoxConsole.isSelected()) {
	    customCodePanelProxy.setVariable("console", "consoleSelect");
	} else {
	    customCodePanelProxy.setVariable("console", "consoleNotSelect");
	}
	return true;
    }

    //点击上一步按钮时触发的事件,返回true时可以进入下一步,返回false时停留在本页面
    public boolean okToGoPrevious() {
	jLabelError.setText("");
	return true;
    }
    //此面板显示在右上角的标题
    public String getTitle() {
	return res.getComponentPanelTitle();
    }

    public void actionPerformed(ActionEvent arg0) {
	// TODO Auto-generated method stub
    }

    private JCheckBox getJCheckBoxMC() {
	if (jCheckBoxMC == null) {
	    jCheckBoxMC = new JCheckBox();
	    jCheckBoxMC.setBounds(new Rectangle(10, 128, 147, 21));
	    jCheckBoxMC.setText("InforGuard MC");
	    jCheckBoxMC.setBackground(Color.white);
	    jCheckBoxMC.setSelected(true);
	}
	return jCheckBoxMC;
    }

    private JCheckBox getJCheckBoxConsole() {
	if (jCheckBoxConsole == null) {
	    jCheckBoxConsole = new JCheckBox();
	    jCheckBoxConsole.setBounds(new Rectangle(10, 148, 163, 26));
	    jCheckBoxConsole.setText("InforGuard Console");
	    jCheckBoxConsole.setBackground(Color.white);
	    jCheckBoxConsole.setSelected(true);
	}
	return jCheckBoxConsole;
    }

    private JTextPane getJTextPaneInfor() {
	if (jTextPaneInfor == null) {
	    jTextPaneInfor = new JTextPane();
	    jTextPaneInfor.setBounds(new Rectangle(8, 8, 362, 100));
	    jTextPaneInfor.setText(res.getComponentjTextPaneInfor());
	    jTextPaneInfor.setEditable(false);
	}
	return jTextPaneInfor;
    }
}


编写完成后,将编译好的代码打为一个zip包。然后在installanywhere的工程里添加一个Custom Code的panel,然后在这个panel里选择刚才打出的zip包,并指定类名即可。

另,界面的设计可以使用Eclipse Visual Editor或者其他支持Swing图形界面设置的工具来设计。
3
0
分享到:
评论
2 楼 sdyouyun 2012-11-19  
simusuishi 写道
你的意思是说:必须要做一个图形界面,才能在installanywhere安装的过程中出现这个自定义panel?
我就是用你的这个方法,做的一个panel,现在就是显示不出来这个界面。正在晕眩中。。。
请房主指教,先谢谢了!

不同的版本可能不一样吧 好久没搞这个了 现在也都记不清了呢
1 楼 simusuishi 2012-09-19  
你的意思是说:必须要做一个图形界面,才能在installanywhere安装的过程中出现这个自定义panel?
我就是用你的这个方法,做的一个panel,现在就是显示不出来这个界面。正在晕眩中。。。
请房主指教,先谢谢了!

相关推荐

    InstallAnywhere7.1Enterprise

    工具:InstallAnywhere7.1Enterprise 条件:jar+tomcat(编译后的webProject)+mysql InstallAnywhere7.1Enterprise 这个功能跟强大。 下面是另外一个: 让你的WEB工程编程EXE。便捷安装轻松卸载。 以前发过一个:...

    InstallAnywhere 2009 Enterprise Edition Crack

    用于InstallAnywhere2009的自学研究,请勿用于商业用途,否则责任自负。

    Installanywhere 2010操作手册

    Installanywhere 2010操作手册 Installanywhere 2010操作手册 Installanywhere 2010操作手册

    InstallAnywhere打包JAVA项目完成示例加讲解

    本文是对我们的javaweb项目(J2se)通过InstallAnywhere完整打包的一个记录文档,里面不但有每一步打包的步骤而且还有详细的讲解。

    Installanywhere

    当你第一次打开IA的时候,缺省的是common designer,你只需要做一些简单的配置,比如产品的名称,需要安装的文件,要不要绑定虚拟机等等,然后就可以build出一个安装程序了。Advanced Designer是为高级用户设置的,...

    installanywhere2009破解方法及补丁

    工具版本:InstallAnywhere 2009 Enterprise build 3657 使用方法: 把IAClasses.zip覆盖安装目录下的IAClasses.zip. 默认安装目录为C:\Program Files\InstallAnywhere 2009 Enterprise,则覆盖该目录下的...

    InstallAnywhere教程和参考

    InstallAnywhere教程和参考,InstallAnywhere教程和参考InstallAnywhere教程和参考InstallAnywhere教程和参考

    installanywhere注册文件

    installanywhere注册文件

    InstallAnywhere 2009 简体/繁体中文语言包

    现在只要将压缩包中的内容解压到IA2009安装文件夹,修改InstallAnywhere.lax文件中的lax.command.line.args=-locale 后面跟上区域代码就可以了。原来是en,并且原来使用不了fr和de,现在只要有对应的语言包文件就...

    InstallAnyWhere打包方法

    最近项目中用到了InstallAnyWhere,搞了好久都知道一点关于InstallAnyWhere打包方法。在这里分享给大家。希望对需要的朋友们有所帮助。

    installAnyWhere 2008 VP1破解文件

    打开${user.home}/InstallAnywhere/95/Enterprise/preferences/com.zerog.ia.jdev.properties,加入一行“ProductCode_Ent=7758521”。7758521是随便写的,写什么都行,别为空就可以,这就是序列号了。 Step 7: ...

    InstallAnyWhere Linux 打包VM环境

    InstallAnyWhere在打包的时候可以提供多种选项,如针对不同的操作系统,是否包含vm(即jre)等。 installanywhere的jre以vm的形式存在,必须放在installanywhere的安装目录下的resource\installer_vms文件夹下, ...

    InstallAnywhere 使用客户端验证的说明文档

    InstallAnywhere 使用客户端验证的说明文档,文档说明了怎么使用eclipse编写一个自定义验证jar,如何在installAnyWhere里面引用并验证。

    installanywhere打包J2EE工程

    installanywhere打包J2EE工程

    installanywhere使用说明

    installanywhere使用说明.doc。其中包含关于installanywhere的具体使用说明,以及图片说明

    installanywhere视频教学

    installanywhere视频教学,很好的视频教学!!!

    installanywhere 打包最详细说明

    包含插件制作,等关键信息,制作java web 安装包的详尽说明

    InstallAnywhere2009破解版

    InstallAnywhere2009破解版,整理重发的,可解压,可用,可破解。

    InstallAnywhere v5.5.1--专业、强大的安装工具

    可以在你的开发团队甚至是整个企业内部,将安装器的可重用性由一个项目传递到另一个项目也可源自于第三方的供应商。 ·完全的鼠标拖动支持,上下文右击菜单可以快速地获取常用的功能。 ·源路径管理,开发者可以...

Global site tag (gtag.js) - Google Analytics