编程:一键打开2个弹出窗口(Programing: open 2 popup windows with one click)

编程入门 行业动态 更新时间:2024-10-07 20:36:54
编程:一键打开2个弹出窗口(Programing: open 2 popup windows with one click)

是否有可能在java或其他编程语言中打开2个弹出窗口,只需点击一下,其中一个在一定时间后自动关闭? 先谢谢你!

is it possible in java or other programing language to open 2 popup windows with one click and one of them to be closed automatically after a certain time? Thank you in advance!

最满意答案

是的,在编程中的事情可以完成

我显示了2个弹出式菜单,您可以使用计时器或线程关闭其中的一个,并且您可以使用尺寸方法更改它们的大小

我不打算写所有的代码,因为你问你是否可以打开2弹出窗口,只需一次点击或不打开我只需点击一下打开2弹出窗口

package experiments; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; public class CreateDialogFromOptionPane { public static void main(final String[] args) { final JFrame parent = new JFrame(); JButton button = new JButton(); button.setText("Click me to show dialog!"); parent.add(button); parent.pack(); parent.setVisible(true); button.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { new JFrame().setVisible(true); new JFrame().setVisible(true); } }); } }

yes in thing in the programing can be done

i show the 2 popup menu and you can close one of them after time by using timer or thread and you can change their size by using size method

i am not going to write all code because you ask if you can open 2 popup windows with one click or not i iust open the 2 popup windows with one click

package experiments; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; public class CreateDialogFromOptionPane { public static void main(final String[] args) { final JFrame parent = new JFrame(); JButton button = new JButton(); button.setText("Click me to show dialog!"); parent.add(button); parent.pack(); parent.setVisible(true); button.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { new JFrame().setVisible(true); new JFrame().setVisible(true); } }); } }

更多推荐

本文发布于:2023-08-07 12:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464052.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:一键   弹出窗口   Programing   open   windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!