|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
在NC中,我在初化时,将按钮设置为 button1.setEnable(false),但是在后面的操作中,始终不法将按钮将灰色设为正常状态,只有在初始化才可以设,请各们高手帮帮忙看看.
package nc.ui;
import java.awt.Button;
import javax.swing.JComboBox;
import nc.ui.pub.ButtonObject;
import nc.ui.pub.ClientEnvironment;
import nc.ui.pub.ToftPanel;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillEditEvent;
import nc.ui.pub.bill.BillEditListener;
import nc.ui.pub.bill.BillItem;
public class FileViaUI extends ToftPanel implements BillEditListener {
protected BillCardPanel myCardBill;
protected String billType="100402";
private String openFilePath_3;
private String openFilePath_2;
private String openFileName;
private int targ;
private ButtonObject[] allButtonList;
private ButtonObject send = new ButtonObject("发送", "发送模板", 1);
private ButtonObject brush = new ButtonObject("刷新", "刷新模板", 1);
private ButtonObject browse_1=new ButtonObject("数据文件","数据文件",2);
private ButtonObject browse_2=new ButtonObject("回执目录","回执目录",2);
private ButtonObject browse_3=new ButtonObject("加载完成转移目录","加载完成转移目录",2);
public FileViaUI() {
super();
try{
init();
}catch(Exception e){
e.printStackTrace();
}
}
private void init() {
initButtons();
initUI();
getBillCardPanel().setHeadItem("pk_billType", billType);
setLayout(new java.awt.BorderLayout());
add(getBillCardPanel(),java.awt.BorderLayout.CENTER);
}
private void initUI(){
send.setEnabled(false);
System.out.println("isEnable--"+send.isEnabled());
getBillCardPanel().getHeadItem("URLAddress").setValue("http://127.0.0.1:80/service/XChangeServlet?account=nc5.5&receiver=0001");
}
private void initButtons() {
allButtonList = new ButtonObject[] { send, brush,browse_1,browse_2,browse_3 };
setButtons(allButtonList);
}
protected BillCardPanel getBillCardPanel() {
if(myCardBill==null)
{
try {
myCardBill=new BillCardPanel();
ClientEnvironment cd=getClientEnvironment();
String operator=cd.getUser().getPrimaryKey();
String pk_corp=cd.getCorporation().getPk_corp();
myCardBill.loadTemplet(billType,null,operator,pk_corp);
//增加单据编辑监听
myCardBill.addEditListener(this);
} catch (java.lang.Throwable ivjExc) {
ivjExc.printStackTrace();
}
}
return myCardBill;
}
@Override
public String getTitle() {
// TODO Auto-generated method stub
return null;
}
@Override
public void onButtonClicked(ButtonObject button) {
if(button==send)
{
send();
}
if(button==brush)
{
brush();
}
if(button==browse_1)
{
browse_1();
}
if(button==browse_2)
{
browse_2();
}
if(button==browse_3)
{
browse_3();
}
}
private void browse_3() {
openFilePath_3=new OpenUI().getFileDir();
getBillCardPanel().getHeadItem("successmove").setValue(openFilePath_3);
targ++;
if(targ==3)
{
send.setEnabled(true);
targ=3;
}
}
private void browse_2() {
openFilePath_2=new OpenUI().getFileDir();
getBillCardPanel().getHeadItem("ts").setValue(openFilePath_2);
targ++;
if(targ==3)
{
send.setEnabled(true);
targ=3;
}
}
private void browse_1() {
openFileName=new OpenUI().getFileName();
getBillCardPanel().getHeadItem("currbusidigit").setValue(openFileName);
targ++;
if(targ==3)
{
send.setEnabled(true);
targ=3;
}
}
private void brush() {
// TODO Auto-generated method stub
send.setEnabled(true);
System.out.println("isEnable--"+send.isEnabled()); //在此打印出来的为true,但是按钮不为正常状态
}
private void send() {
// TODO Auto-generated method stub
}
public void afterEdit(BillEditEvent arg0) {
// TODO Auto-generated method stub
}
public void bodyRowChange(BillEditEvent arg0) {
// TODO Auto-generated method stub
}
public ButtonObject getSend() {
return send;
}
} |
|