一个Runnable中有两个JFrame.调用JFileChooser后,第一个JFrame在应用程序栏中消失 [英] Two JFrames in one Runnable. First JFrame disappears in the application bar after calling a JFileChooser

查看:60
本文介绍了一个Runnable中有两个JFrame.调用JFileChooser后,第一个JFrame在应用程序栏中消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个多窗口界面ala GIMP.其中之一允许用户加载要在框架中显示的图像.因此,当程序加载时,所有窗口(目前有两个窗口,但我计划有三个)都显示在应用程序栏中.但是,当第二个窗口调用JFileChooser时,它会消失在应用程序栏中(但不会关闭).但是,如果我<Super>+<Tab><Alt>+<Tab>,它仍会出现在这里.当我单击显示/隐藏所有窗口"按钮时,它也会重新出现在应用程序栏中.

I'm trying to create a multi-windowed interface, ala GIMP. One of them allows the user to load an image, to be displayed in the frame. So, when the program loads, all windows (two for now but I plan to have three) are shown in the application bar. However, when the second* window invokes JFileChooser, it disappears in the application bar (but does not close). But if I <Super>+<Tab> or <Alt>+<Tab> it still appears there. It also reappears in the app bar when I click the "Show/Hide All Windows" button.

所有JFrame是从单个Runnable调用的.其他人遇到过这个问题吗?如何解决这一问题(即始终使所有窗口在应用程序栏中可见)?

All JFrames are invoked from a single Runnable. Anyone else encountered this issue? How do I work around this one (i.e., make all windows visible in the application bar at all times)?

谢谢!

*我把它称为第二个窗口,因为它是第二个被设置为true的窗口.

*I called it the second window since it is the second one that is setVisibled to true.

推荐答案

一个JFrame将出现在任务栏上. JWindow或JDialog不会出现在任务栏上.

A JFrame will appear on the task bar. A JWindow or JDialog do not appear on the task bar.

JFileChooser使用JDialog来显示日期,因此它不会出现在任务栏上.您需要指定一个JFrame作为文件选择器的所有者.选择的文件仍不会出现在任务栏上,但是当您单击代表所有者框架的图标时,它将与框架一起显示.

A JFileChooser uses a JDialog to display the date so it will not appear on the task bar. You need to specify a JFrame as the owner of the file chooser. The file choose will still not appear on the task bar, but when you click on the icon representing the owner frame it will become visible along with the frame.

这篇关于一个Runnable中有两个JFrame.调用JFileChooser后,第一个JFrame在应用程序栏中消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆