如何实现 触发某个事件后弹出新框架窗口,但原有的框架窗口就变成不活动的,必须关闭弹出的窗口原窗口才可用? 如何实现 触发某个事件后弹出新框架窗口,但原有的框架窗口就变成不活动的,必须关闭弹出的窗口原窗口才可用? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接构造一个带有模式的Dialog 用JDialog的constructor中的第三个参数,将其设置为true。第三个参数为modal,具体含义为modal specifies whether dialog blocks user input to other top-level windows when shown.参考代码如下:import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JDialog;import javax.swing.JFrame;public class Finding { public static void main(String[] args) { final JFrame ownerFrame = new JFrame(); ownerFrame.setSize(200, 200); JButton button = new JButton("Owner"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JDialog dialog = new JDialog(ownerFrame, "goods", true); dialog.setSize(200, 200); dialog.setVisible(true); } }); ownerFrame.add(button); ownerFrame.setVisible(true); }} BigInteger 怎么转成 Long 类型的 用Eclipse打包java工程时,为什么我用的图片和文件不能被打包? 怎样 根据ip和端口远程访问电脑,进行数据采集 最近在做一个项目,要用到等比例缩放 刚学了二个小时的JAVA,写了个链表类,感觉很有意思 需要同时利用两个不同的JDK的东西,有什么好招? 为什么会报这个错? JAVA程序在哪运行呀! 关于数组的一个问题 急需java编写的类似QQ的例程。请大侠发给我!!! 求解编写一个显示金字塔的程序 java7什么时候可以使用呢
第三个参数为modal,具体含义为modal specifies whether dialog
blocks user input to other top-level windows when shown.
参考代码如下:import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
public class Finding
{
public static void main(String[] args)
{
final JFrame ownerFrame = new JFrame();
ownerFrame.setSize(200, 200);
JButton button = new JButton("Owner");
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JDialog dialog = new JDialog(ownerFrame, "goods", true);
dialog.setSize(200, 200);
dialog.setVisible(true);
}
});
ownerFrame.add(button);
ownerFrame.setVisible(true);
}
}