RT…………如何实现?例如,登陆前主窗口根据一个全局变量Boolean lg……某些按钮是不可见的,在登陆的子窗口验证过后并关闭窗口后改变lg为TRUE,然后主窗口上的某些按钮如何变成可见的?主要是代码加在哪里?
/*我的判断代码*/
if(true){
if(goodsstoresystem.SQLAction.Global.ad){
this.GoodsM.setEnabled(true);
this.ProviderM.setEnabled(true);
}else{
this.GoodsM.setEnabled(false);
this.ProviderM.setEnabled(false);
}
if(goodsstoresystem.SQLAction.Global.lg){
this.AdminLoad.setEnabled(false);
}else{
this.AdminLoad.setEnabled(true);
}
}
/*我的判断代码*/
if(true){
if(goodsstoresystem.SQLAction.Global.ad){
this.GoodsM.setEnabled(true);
this.ProviderM.setEnabled(true);
}else{
this.GoodsM.setEnabled(false);
this.ProviderM.setEnabled(false);
}
if(goodsstoresystem.SQLAction.Global.lg){
this.AdminLoad.setEnabled(false);
}else{
this.AdminLoad.setEnabled(true);
}
}
解决方案 »
- 紧急求助,写一个可以上传附件的jsp代码,采用ajax无刷新上传,上传没问题,但是提交其他信息得到的是null值
- 请教关于openfire的几个简单问题
- 简单正则表达式问题,输出为什么会是false呢?
- 关于静态和动态方法的问题
- 请问一下如何模拟"ctrl"键????????????
- 小问题:java中哪个函数是将int转化成String的函数?
- 大家快快来救救...我..啊.
- 求救:关于表格中单元格合并拆分的问题!
- 我刚刚开始写java程序,碰了一个钉子(巨简单的问题,白送分了)
- 怎样在cmp中建立跨多表的查询和更新?
- 请问如何使用substance.jar来改变application的界面皮肤?(本人菜鸟)
- 简单Swing问题
GoodsStoreSystemApp.java
GoodsStoreSystemView.java
我在想是不是需要做多一个线程来进行判断……不过做线程又不会……哎~纠结……谢谢你的回复
JF_Login jflo=new JF_Login();//新建一个登陆窗口对象
JudgeThread jut=new JudgeThread();//建立判断线程
jut.start();
jflo.setVisible(true);
}public class JudgeThread extends Thread{
@Override
public void run(){
if(true){
if(goodsstoresystem.SQLAction.Global.ad){
goodsstoresystem.GoodsStoreSystemView.GoodsM.setEnabled(true);
goodsstoresystem.GoodsStoreSystemView.ProviderM.setEnabled(true);
}else{
goodsstoresystem.GoodsStoreSystemView.GoodsM.setEnabled(false);
goodsstoresystem.GoodsStoreSystemView.ProviderM.setEnabled(false);
}
if(goodsstoresystem.SQLAction.Global.lg){
goodsstoresystem.GoodsStoreSystemView.AdminLoad.setEnabled(false);
}else{
goodsstoresystem.GoodsStoreSystemView.AdminLoad.setEnabled(true);
}
}
}
}以上是我做的线程……………………
哪位达人能告诉我我错在哪里么?主界面依然不会改变
jut.start(); 不会阻塞当前线程,也就是说,这个start以后,直接往后运行程序了。
为什么不能直接写在AdminLoadMousePressed方法中呢?
并且,我很奇怪,你这些设置,为什么没有对jflo这个frame进行操作呢?
如果说你的设置控件是否可变的动作,都是在JF_Login的构造方法中完成的,那你应该把全局变量的设置放在构造窗体之前才对吧?