Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JDesktopPane和JInternalFrame帮助!_Java_Collections_Jinternalframe_Jlayeredpane_Jdesktoppane - Fatal编程技术网

Java JDesktopPane和JInternalFrame帮助!

Java JDesktopPane和JInternalFrame帮助!,java,collections,jinternalframe,jlayeredpane,jdesktoppane,Java,Collections,Jinternalframe,Jlayeredpane,Jdesktoppane,您好 我有一个关于将重复的JinternalFrame限制为JDesktopPane的问题。 基本上,向JDesktopPane添加一个实例JInternalFrame是全面的。 但是限制JDesktopPane上同一实例的重复JInternalFrame,并使该实例位于JDesktopPane的顶层 我如何实现这一点? 我是否要将所有实例存储到ArrayList中,并检查是否已打开了有关执行的实例 非常感谢您的回复 谢谢, 西里尔H./** *方法来搜索活动的内部框架窗口 *并根据结果返回tr

您好

我有一个关于将重复的JinternalFrame限制为JDesktopPane的问题。 基本上,向JDesktopPane添加一个实例JInternalFrame是全面的。 但是限制JDesktopPane上同一实例的重复JInternalFrame,并使该实例位于JDesktopPane的顶层

我如何实现这一点? 我是否要将所有实例存储到ArrayList中,并检查是否已打开了有关执行的实例

非常感谢您的回复

谢谢, 西里尔H.

/**
*方法来搜索活动的内部框架窗口
*并根据结果返回true或false。此方法使用内部帧名称
*/
公共布尔搜索框架(字符串搜索,JInternalFrame框架[])
{
for(int i=0;i
/**
 * method to search for active internal frame windows
 * and return true or false depending on the outcome. this method uses internalframe names
 */
public boolean searchIFrame(String search, JInternalFrame frame[])
{
    for(int i = 0; i < frame.length; i++)
        if(frame[i].getTitle().toString().equals(search))
            return true;
        return false;
}

//its implementation in your program. "Information Form" is the internalframe's name
//jdesk is the desktoppane object or instance
boolean srch = searchIFrame("Information Form", jdesk.getAllFrames());
    if(!srch) {        
                VisitationForm at = new VisitationForm();
                at.pack();
                jdesk.add(at);

                try
                {
                    at.setSelected(true);
                    at.setVisible(true);
                    // We're done, so clear the feedback message
                    //bar.setString(" ");
                    //bar.setIndeterminate(false);
                    at.requestFocus();

                }
                catch (PropertyVetoException pve)
                {
                    //bar.setString(" ");
                    //bar.setIndeterminate(false);

                    // Then display the error in a dialog box
                    System.out.println(pve);
                }

            }