开发者

How would you chromatically run external JFrames?

开发者 https://www.devze.com 2023-01-04 00:51 出处:网络
I want to make an if statement, BUT I need to return the value of setVisible so I can make a statment like:

I want to make an if statement, BUT

I need to return the value of setVisible so I can make a statment like:

if开发者_开发百科(visible = false) { haha theres no code in here <_< }

I have no idea to return the value of setVisible.

EDIT: All of my JFrames are seperate programs called by the Main program, I want all of the frames to run individually and not together, chromatically one after the other at an actionPerformed event. But in the main program I need to determine whether a frame is set to visible, How would I go about doing this?

EDIT2: That or if there is some other way I could make an external JFrame run, when it closes it would assign something a value which would trigger the next external JFrame to run, but I cant seem to grasp what would trigger it.


Edit
It looks to me like you may want to be using a WindowListener. You can implement the WindowClosing method to have it display the next JFrame.

JFrame has the method isVisible(). You can use that to determine if the frame is visible or not.

if (!yourFrame.isVisible()) {
   // No code here...
}


if you see the prototype of the method setVisible, you will it doesn't return a value because it is a void method. If you want to obtain the visibility of a frame, you should instead isVisible.

0

精彩评论

暂无评论...
验证码 换一张
取 消