编程:一键打开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); } }); } }更多推荐
发布评论