Java examples for Swing:JFrame
get Active Top Level Frame
/*/* w w w. ja v a2s. c om*/ * @(#)GeneralUtil.java 1.13 10/03/24 * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ //package com.java2s; public class Main { public static Frame getActiveTopLevelFrame() { Frame[] frames = Frame.getFrames(); int index = -1; if (frames == null) return null; for (int i = 0; i < frames.length; i++) { if (frames[i].getFocusOwner() != null) { index = i; } } return (index >= 0 ? frames[index] : null); } }