1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
116 * @see #LIVE_DRAG_MODE
117 * @see #setDragMode
118 */
119 public static final int OUTLINE_DRAG_MODE = 1;
120
121 private int dragMode = LIVE_DRAG_MODE;
122 private boolean dragModeSet = false;
123 private transient List<JInternalFrame> framesCache;
124 private boolean componentOrderCheckingEnabled = true;
125 private boolean componentOrderChanged = false;
126
127 /**
128 * Creates a new <code>JDesktopPane</code>.
129 */
130 public JDesktopPane() {
131 setUIProperty("opaque", Boolean.TRUE);
132 setFocusCycleRoot(true);
133
134 setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
135 public Component getDefaultComponent(Container c) {
136 JInternalFrame jifArray[] = getAllFrames();
137 Component comp = null;
138 for (JInternalFrame jif : jifArray) {
139 comp = jif.getFocusTraversalPolicy().getDefaultComponent(jif);
140 if (comp != null) {
141 break;
142 }
143 }
144 return comp;
145 }
146 });
147 updateUI();
148 }
149
150 /**
151 * Returns the L&F object that renders this component.
152 *
153 * @return the <code>DesktopPaneUI</code> object that
154 * renders this component
155 */
156 public DesktopPaneUI getUI() {
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
116 * @see #LIVE_DRAG_MODE
117 * @see #setDragMode
118 */
119 public static final int OUTLINE_DRAG_MODE = 1;
120
121 private int dragMode = LIVE_DRAG_MODE;
122 private boolean dragModeSet = false;
123 private transient List<JInternalFrame> framesCache;
124 private boolean componentOrderCheckingEnabled = true;
125 private boolean componentOrderChanged = false;
126
127 /**
128 * Creates a new <code>JDesktopPane</code>.
129 */
130 public JDesktopPane() {
131 setUIProperty("opaque", Boolean.TRUE);
132 setFocusCycleRoot(true);
133
134 setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
135 public Component getDefaultComponent(Container c) {
136 JInternalFrame[] jifArray = getAllFrames();
137 Component comp = null;
138 for (JInternalFrame jif : jifArray) {
139 comp = jif.getFocusTraversalPolicy().getDefaultComponent(jif);
140 if (comp != null) {
141 break;
142 }
143 }
144 return comp;
145 }
146 });
147 updateUI();
148 }
149
150 /**
151 * Returns the L&F object that renders this component.
152 *
153 * @return the <code>DesktopPaneUI</code> object that
154 * renders this component
155 */
156 public DesktopPaneUI getUI() {
|