JB里,窗口和窗口之间怎么互相调用,然后怎么关闭?

ansys0 2003-02-22 04:27:25
?
...全文
27 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
shine333 2003-02-25
  • 打赏
  • 举报
回复
setVisible(true) does the same thing as what show()
wangyaoxing 2003-02-24
  • 打赏
  • 举报
回复
首先还要设置
b.setvisible(true);
shine333 2003-02-22
  • 打赏
  • 举报
回复
在A里面加上让B.show();的东西,
比如 button是让A里面B出现的按钮,
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
B.show();
}
});

如果想让B隋A自动出现,B.show()就放在构件器里,
ansys0 2003-02-22
  • 打赏
  • 举报
回复
to shine333(shine)


谢谢:)
ansys0 2003-02-22
  • 打赏
  • 举报
回复
不是这样的,我的意思是两个窗口的调用,A窗口要调用B窗口,不知道调用的代码怎么写?
凌波微搏 2003-02-22
  • 打赏
  • 举报
回复
上上头说漏了,参照jdk文档
shine333 2003-02-22
  • 打赏
  • 举报
回复
new Frame/Dialog/JFrame/JDialog/OrTheirChildren().show();不就好了吗,
关的时候dispose(); 好像和JB 没什么关系,不管你用什么,都是差不多的在某个按钮上添加事件吗
凌波微搏 2003-02-22
  • 打赏
  • 举报
回复
import javax.swing.*;

public class Test5 extends JFrame
{
public Test5(){
this.setTitle("test");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(400,300);
this.setVisible(true);
}
public static void main(String [] args)
{
new Test5();
}
}
凌波微搏 2003-02-22
  • 打赏
  • 举报
回复
呼,手头有参考书吗?这个可是非常常用的一个类啊,
或者参照jdk
ansys0 2003-02-22
  • 打赏
  • 举报
回复
JFrame不懂怎么调用啊.
凌波微搏 2003-02-22
  • 打赏
  • 举报
回复
呼,不知道楼主是色么意思,无论是JDialog,JFrame,你要怎么调呢?关闭?有方法的呀。

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧