Swing , Multiple Screens , Transfer of control(Swing , 多画面 , 控制转移)
问题描述
我正在开发一个摇摆应用程序.我正在使用两个屏幕
I am developing a swing application. I am using two screens
1.屏幕 1 中的按钮将启动屏幕 2.
1.A button from screen1 will launch screen 2.
伪代码:
ScreenA extends JFrame{
onButtonClick(){
Screen2.setVisible(true);
}
System.out.println("Hai");
}
Screen2 extends JFrame{
onButtonClick{
Hide this screen;
}
}
现在的输出是:
- 将显示屏幕 22.Hai会被打印出来.
我的目标:我只想在单击屏幕 2 中的按钮并且屏幕 2 消失时才显示 hai.
My Objective : I want to display hai only when a button from screen 2 is clicked and screen 2 dissppears.
我如何实现它?
我尝试在屏幕二中为按钮点击设置一个标志.但程序只是通过条件并继续下一行.我如何保持控制?
I tried setting a flag for buttonclicked in screen two. But the program just passes through the condition and goes on to the next line . How do i keep the control ?
推荐答案
使用模式对话框.有关详细信息,请参阅如何制作对话框.
Use a modal dialog. See How to Make Dialogs for more details.
这篇关于Swing , 多画面 , 控制转移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Swing , 多画面 , 控制转移
基础教程推荐
- Struts2 URL 无法访问 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 存储 20 位数字的数据类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
